kasra-hosseini / obspyDMT

A Python toolbox for the query, retrieval, processing and management of seismological data sets, including very large, heterogeneous and/or dynamically growing ones.
http://kasra-hosseini.github.io/obspyDMT/
Other
89 stars 58 forks source link

Events after filtering #40

Closed HongjianFang closed 6 years ago

HongjianFang commented 6 years ago

Hi Kasra, Thanks for the great code. I got one question about the '#Events after filtering', the number of events drops a lot after filtering, see the following:

N LAT LON DEP DATETIME MAG AUTH EV_ID FLY


1 -15.364 -172.932 38 2017-12-24T17:33:40 5.5 None 20171224_173340.a NAN 2 -17.336 -177.537 392 2017-12-16T11:22:24 5.5 None 20171216_112224.a NAN 3 -20.833 -173.721 7 2017-12-11T10:50:00 5.7 None 20171211_105000.a NAN .. 158 -18.608 -174.713 122 2013-02-10T09:37:11 5.6 None 20130210_093711.a NAN 159 -15.805 -172.967 18 2013-02-07T07:19:51 5.8 None 20130207_071951.a NAN 160 -16.117 -173.235 19 2013-01-27T09:59:29 5.7 None 20130127_095929.a NAN

Number of events/intervals: 160 Time for retrieving and saving the event info: 0:00:30

Couldn't write catalog object to QuakeML as:

: 'NoneType' object has no attribute 'uncertainty' Proceed without ..

Events after filtering: 6

Based on what did you do the filtering? I tried to download some events using the conventional way, and there are available.

Thank you. Fang

kasra-hosseini commented 6 years ago

Hi Fang,

Can you send me the obspyDMT command(s)? The events are "filtered" based on the inputs specified by the option flags which includes event datetimes, magnitudes, depth range, latitudes, and longitudes. As an example, the following command line creates a dataset for all events with magnitude more than 5 that occurred in 2015:

obspyDMT --datapath mag_5_2015 --min_date 2015-01-01 --max_date 2016-01-01 --min_mag 5.0 --event_info

the output is:

Event(s) are based on:  IRIS

#N    LAT       LON       DEP  DATETIME             MAG   AUTH  EV_ID              FLY
--------------------------------------------------------------------------------
1       51.678  -173.489  40   2015-12-31T22:22:17  5.0   None  20151231_222217.a  NAN
2      -30.358  -178.007  27   2015-12-31T21:29:38  5.4   None  20151231_212938.a  NAN
3       11.153   -86.621  20   2015-12-31T10:56:58  5.8   None  20151231_105658.a  NAN
..
1729     6.501    60.244  23   2015-01-02T07:56:51  5.1   None  20150102_075651.a  NAN
1730    40.438  -125.565  10   2015-01-01T12:16:14  5.4   None  20150101_121614.a  NAN
1731    28.708    51.872  15   2015-01-01T08:49:54  5.1   None  20150101_084954.a  NAN
--------------------------------------------------------------------------------

Number of events/intervals: 1731
Time for retrieving and saving the event info: 0:00:16

#Events after filtering: 1731

Now, I can access either all these events or a subset of them. For example, I only need events with magnitude more than 6:

obspyDMT --datapath mag_5_2015 --min_date 2015-01-01 --max_date 2016-01-01 --min_mag 6.0 --event_info

and the output is:

#N    LAT       LON       DEP  DATETIME             MAG   AUTH  EV_ID              FLY
--------------------------------------------------------------------------------
1       51.678  -173.489  40   2015-12-31T22:22:17  5.0   None  20151231_222217.a  NAN
2      -30.358  -178.007  27   2015-12-31T21:29:38  5.4   None  20151231_212938.a  NAN
3       11.153   -86.621  20   2015-12-31T10:56:58  5.8   None  20151231_105658.a  NAN
..
1729     6.501    60.244  23   2015-01-02T07:56:51  5.1   None  20150102_075651.a  NAN
1730    40.438  -125.565  10   2015-01-01T12:16:14  5.4   None  20150101_121614.a  NAN
1731    28.708    51.872  15   2015-01-01T08:49:54  5.1   None  20150101_084954.a  NAN
--------------------------------------------------------------------------------

Number of events/intervals: 1731
Time for retrieving and saving the event info: 0:00:02

#Events after filtering: 157

Which results in only 157 events out of 1731. Please note that I used --event_info, so this command line only downloads the event info without retrieving any waveforms.

So, I guess there is an option flag in your command line which "filters" the events. Anyway, it would be great if you can send your command line.

Cheers, Kasra

HongjianFang commented 6 years ago

Hello Kasra, Thank you for your replying. My command was obspyDMT --datapath tonga_seis --min_mag 5.5 --max_mag 7.5 --min_date 2013-01-01 --max_date 2018-01-01 --event_catalog NEIC_USGS --event_rect 177/190/-25/-14 --data_source IRIS --net CI --cha BHZ --meta_data

The output was:

N LAT LON DEP DATETIME MAG AUTH EV_ID FLY


1 -15.364 -172.932 38 2017-12-24T17:33:40 5.5 None 20171224_173340.a NAN 2 -17.336 -177.537 392 2017-12-16T11:22:24 5.5 None 20171216_112224.a NAN 3 -20.833 -173.721 7 2017-12-11T10:50:00 5.7 None 20171211_105000.a NAN .. 158 -18.608 -174.713 122 2013-02-10T09:37:11 5.6 None 20130210_093711.a NAN 159 -15.805 -172.967 18 2013-02-07T07:19:51 5.8 None 20130207_071951.a NAN 160 -16.117 -173.235 19 2013-01-27T09:59:29 5.7 None 20130127_095929.a NAN

Number of events/intervals: 160 Time for retrieving and saving the event info: 0:00:35

Couldn't write catalog object to QuakeML as:

: 'NoneType' object has no attribute 'uncertainty' Proceed without ..

Events after filtering: 6

I got the following directories in my 'tonga_seis': 20130607_125409.a 20150907_084609.a 20170102_131402.a EVENTS-INFO 20140504_091552.a 20161112_161549.a 20170617_222602.a

I checked this one 159 -15.805 -172.967 18 2013-02-07T07:19:51 5.8 None 20130207_071951.a NAN and it shows

screen shot 2018-03-27 at 09 16 41

Thank you, Fang

kasra-hosseini commented 6 years ago

Hi Fang,

Thank you very much for reporting this. There was indeed a problem with filtering the events, but it should be fixed now (version: 2.0.8):

https://github.com/kasra-hosseini/obspyDMT/commit/11995faf28099e9ea6855dfca18ff82bf61fe259#diff-bc79580e764cd38cf68af007f0ade7a3R266

Would you please update your DMT and try again?

I get the following output:

6.227216 sec to retrieve the event info form NEIC.

#N   LAT       LON       DEP  DATETIME             MAG  AUTH  EV_ID              FLY
--------------------------------------------------------------------------------
1     -15.364  -172.932  38   2017-12-24T17:33:40  5.5  None  20171224_173340.a  NAN
2     -17.336  -177.537  392  2017-12-16T11:22:24  5.5  None  20171216_112224.a  NAN
3     -20.833  -173.721  7    2017-12-11T10:50:00  5.7  None  20171211_105000.a  NAN
..
158   -18.608  -174.713  122  2013-02-10T09:37:11  5.6  None  20130210_093711.a  NAN
159   -15.805  -172.967  18   2013-02-07T07:19:51  5.8  None  20130207_071951.a  NAN
160   -16.117  -173.235  19   2013-01-27T09:59:29  5.7  None  20130127_095929.a  NAN
--------------------------------------------------------------------------------

Number of events/intervals: 160
Time for retrieving and saving the event info: 0:00:11

#Events after filtering: 160

The issue was with events with negative longitudes, e.g., 20130207_071951.a that you mentioned in the previous comment which has a longitude of -172.967. This should be solved now by mapping the longitudes from [-180 180] to [0 360] in the filtering step.

Please let me know if this fixed the problem.

Cheers, Kasra

HongjianFang commented 6 years ago

Hi Kasra, Thank you. It works now. I went through the code yesterday but did not find the problem. Turns out I chose the 'wrong place'. Haha, I'll go ahead and close the issue. Thank you again for this amazing work, I think it's going make my life easier for my future study.

Cheers, Fang