[Antelope] code to calculate psa?

Gabe Plank gabe at seismo.unr.edu
Wed Jun 17 13:01:08 CDT 2009


All-

FYI

The original source is available online here:
http://www.aeic.alaska.edu/input/glenn/software/AEIC/db2ewpg/db2ewpg.txt

Thanks again to AEIC for this code. It is working OK for my PSA 
calculations now. I have removed the dependency on the earthworm header 
and made some other changes.

Here are a couple of things I thought would be good to share:

(1) dbgetv(tr, 0, "data", &ptr2data, 0 );
This call to the trloadchan in-memory table does NOT populate the 
allocated darray[MAXTRACELTH]. Rather, dbgetv creates a copy of the data 
and changes the value of ptr2data. Therefore, if you call trfree before 
transferring the return values to darray and resetting the pointer, 
ptr2data will become invalid. And (obviously) any other pointers to 
darray will not reference the data.

(2) The calibration multiplication loop in main() contains a critical 
bug. Be sure to change '<=' to '<' in the for loop. Otherwise your array 
will become npts+1 in length and will clobber memory.

(3) The PG{A,D,V} calculations are performed on a filtered waveform. I 
am not sure if this changes the results, but I could not justify the 
peakv calculations with direct measurements of the waveform.

Take care,
Gabe

-- 
// Gabe Plank
// Seismic Network Analyst
// Nevada Seismological Laboratory
// University of Nevada, Reno
// 775.784.7039



More information about the Antelope mailing list