Project

General

Profile

Bug #670

sac2wav -h and -l parameters not working correctly

Added by Rick DeWitt about 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Start date:
02/11/2015
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

When sac2wav is given any of these options, it produces WAV files with the wrong sample rates:
sac2wav -h 16000 *.sac
sac2wav -l 15 *.sac
sac2wav -l 30 *.sac
sac2wav -l 60 *.sac

However, the default case works correctly: sac2wav *.sac

The problem is with incorrect sscanf format codes for uint32_t when reading the numbers from the command line.

Associated revisions

Revision 6 (diff)
Added by Rick DeWitt about 9 years ago

#670 Fixed format strings for h and l options

History

#1 Updated by Rick DeWitt about 9 years ago

  • Resolution set to Fixed
  • Status changed from New to Resolved

Files changed: main.c

Fixed. Moved SCNu32 outside of double-quotes in two places.

Ran tests against:
ANMO.IU.00.LHZ.2010.058.06.30.00.069-2010.058.10.29.59.069.SAC (1 Hz)
ANMO.IU.00.BHZ.2010.058.06.30.00.019-2010.058.10.29.59.969.SAC (20Hz)
ANMO.IU.10.BHZ.2010.058.06.30.00.019-2010.058.10.29.59.994.SAC (40 Hz)
ANMO.IU.10.HHZ.2010.058.06.44.28.858-2010.058.10.25.08.388.SAC (100 Hz)

Permuted test as:
sac2wav -V -h 16000
sac2wav -V -l 15
sac2wav -V
sac2wav -V -60

All sample rates were correct in the output .WAV files. TimeLapse rates were also reported as expected, with the -V flag.

Exception: In two cases, the default sac2wav set a sample rate that was 1 Hz too small.
hexdump -C 00.B.WAV | grep ^00000050 had a sample rate of 2399, with 2400 expected.
hexdump -C 10.B.WAV | grep ^00000050 had a sample rate of 4799, with 4800 expected.

However, this rounding error did not show up with sac2wav -l 30.

Also available in: Atom PDF