usgs / groundmotion-processing

Parsing and processing ground motion data
Other
54 stars 41 forks source link

Units for Event Depth Are Incorrect #1029

Closed ghost closed 1 year ago

ghost commented 1 year ago

Describe the bug

gmprocess is designed to handle units of both m and km for event depth. When creating the obspy Origin object units for depth are expected to be in m, so the code converts depth from km to m here: Click Me

However viewing the origin object that is read from the ASDF file using the getEvent method shows the depth is being stored in km (34.9), not m. This leads to the wrong depth being outputted in mtables (because origin.depth_km takes origin.depth and divides by 1000).

I am confused about why the Origin object is not saving the depth in the correct units. From my tests, I can save the depth to a different value if I feed it a float (constant depth=34900.0), but if I give it depth1000 (or depth1000. or float(depth)*1000) the units are always saved as km in the eventobj in ASDF. So I'm not sure where this issue stems from and am would like someone with more expertise to advise on an appropriate resolution.

To Reproduce gmrecords download -e ak022ctr3qn3;gmrecords assemble;gmrecords process;gmrecords sm;gmrecords mtables

Check the event csv file and it should show depth as 0.03 (correct value is 34.9)

ghost commented 1 year ago

Cannot reproduce this with the latest version of gmprocess.

emthompson-usgs commented 1 year ago

That is mysterious. I don't think we've done anything in the recent changes to affect this. But, if it isn't happening anymore, that's great!