uafgeotools / rtm

A Python package for locating infrasound sources using reverse time migration
https://uaf-rtm.readthedocs.io/
MIT License
38 stars 13 forks source link

example_regional.py fails due to traces with differing sample rates #58

Closed davidfee5 closed 2 years ago

davidfee5 commented 2 years ago

Currently example_regional.py fails on this line: st = gather_waveforms_bulk(FBX_LON, FBX_LAT, MAX_RADIUS, STARTTIME, ENDTIME, INFRASOUND_CHANNELS, time_buffer=TIME_BUFFER, remove_response=True)

as numerous TA stations have different sample rates from the 'EP' and '20' location codes and the stream merge cannot complete. Possible fix is to specify only the location codes we are interested in? I

liamtoney commented 2 years ago

After examining the output st with merging disabled (merge_fill_value=False), I found that the output of

np.unique([tr.stats.sampling_rate for tr in st])

is

[19.99994659423828,
 19.999948501586914,
 19.999950408935547,
 19.999988555908203,
 19.99999237060547,
 20.0,
 40.0,
 50.0,
 100.0]

So the issue is actually that some of the TA station traces with location code 20 have sampling rates slightly less than 20 Hz (huh??). Looks like the issue affects E17K, Q17K, and Q19K. Removing those offending station traces fixes the merge issue. But yes, we are getting duplicate data with the EP and 20 location codes.

The "quickfix" option that fixes both these issues is to follow your suggestion and add location='--,0?,EP' to the line, which excludes the 20 data.

Then the example runs and still gives a reasonable result. Ultimately, I think we could swap this out for a better, faster-running, regional example in the long-term!

davidfee5 commented 2 years ago

Definitely agreed