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

Read event catalog #51

Closed okling closed 5 years ago

okling commented 5 years ago

Hi Kasra,

I had an issue when I was trying to read the event catalog.

I successfully downloaded a bunch of waveforms/stations for a specific event through ObspyDMT. However, I wasn't able to read the catalog from the EVENTS-INFO directory:

$ obspyDMT --datapath obspydmt-data --local --read_catalog "/Users/okling/Documents/obspyDMT/obspydmt-data/EVENTS-INFO/catalog.ml"
--------------------------------------------------------------------------------
           obspyDMT (obspy Data Management Tool)

    Python Toolbox for Retrieving, Processing and Management of
            Large Seismological Datasets

:copyright:
The ObsPy Development Team (devs@obspy.org)

Developed by Kasra Hosseini
email: kasra.hosseinizad@earth.ox.ac.uk

:license:
GNU General Public License, Version 3
(http://www.gnu.org/licenses/gpl-3.0-standalone.html)
--------------------------------------------------------------------------------

############################################################
WARNING: --min_date is set to 1970-01-01T00:00:00.000000Z
WARNING: --min_mag is set to 3.0
############################################################

obspyDMT primary mode: local

#Events after filtering: 0

==================================================
obspyDMT main program has finished!

/Users/okling/obspydmt-data
* Total time of execution: 0:00:02 (h:m:s)
==================================================

Here's what inside the catalog_table.txt, which shows that the event was recorded:

Command line:
-------------
/anaconda3/bin/obspyDMT --min_date 2018-08-18 --max_date 2018-08-20 --net=CH,OE,IV,GR,GE,BW --sta=* --loc= --cha=HHZ --station_rect=2.5/19.5/42/51 --event_rect=-179/-175/-20/-16 --min_mag 8.0 --preset 0 --offset 7200 --sampling_rate 20 --instrument_correction --corr_unit=DIS --pre_filt=0.001, 0.005, 10, 20 --data_source=all 

#N LAT       LON       DEP  DATETIME             MAG  AUTH  EV_ID              FLY  
--------------------------------------------------------------------------------
1   -18.113  -178.154  600  2018-08-19T00:19:40  8.2  None  20180819_001940.a  NAN
--------------------------------------------------------------------------------

The catalog.txt:

Command line:
-------------
/anaconda3/bin/obspyDMT --min_date 2018-08-18 --max_date 2018-08-20 --net=CH,OE,IV,GR,GE,BW --sta=* --loc= --cha=HHZ --station_rect=2.5/19.5/42/51 --event_rect=-179/-175/-20/-16 --min_mag 8.0 --preset 0 --offset 7200 --sampling_rate 20 --instrument_correction --corr_unit=DIS --pre_filt=0.001, 0.005, 10, 20 --data_source=all 

#number,event_id,datetime,latitude,longitude,depth,magnitude,magnitude_type,author,flynn_region,mrr,mtt,mpp,mrt,mrp,mtp,stf_func,stf_duration,t1,t2
1,20180819_001940.a,2018-08-19T00:19:40.670000Z,-18.1125,-178.1536,600.0,8.2,mww,None,NAN,None,None,None,None,None,None,triangle,59.432,2018-08-19T00:19:40.670000Z,2018-08-19T02:19:40.670000Z

The catalog.ml file

<?xml version='1.0' encoding='utf-8'?>
<q:quakeml xmlns:q="http://quakeml.org/xmlns/quakeml/1.2" xmlns="http://quakeml.org/xmlns/bed/1.2">
  <eventParameters publicID="smi:local/3426363e-469a-4e77-a669-4f1ed6b3acce"/>
</q:quakeml>

Any ideas on this? Thanks for your help!

Cheers, Angel

kasra-hosseini commented 5 years ago

Hi Angel,

First of all, sorry for the delay. I've been off sick a bit.

Regarding your questions: it seems that something went wrong when DMT wrote the .ml file. I used the commands that you sent:

obspyDMT --min_date 2018-08-18 --max_date 2018-08-20 --net=CH,OE,IV,GR,GE,BW --sta=* --loc= --cha=HHZ --station_rect=2.5/19.5/42/51 --event_rect=-179/-175/-20/-16 --min_mag 8.0 --preset 0 --offset 7200 --sampling_rate 20 --instrument_correction --corr_unit=DIS --pre_filt="(0.001, 0.005, 10, 20)" --data_source=all --req_parallel --req_np 4 --parallel_process --process_np 4 --sta="C*"

Please note that:

  1. I changed --pre_filt=0.001, 0.005, 10, 20 to --pre_filt="(0.001, 0.005, 10, 20)". The former cannot be interpreted correctly.
  2. Not for testing, but for actual data retrievel and processing, I usually use --req_parallel --req_np 4 --parallel_process --process_np 4 options to retrieve and process the data in parallel which significantly reduce the total time.
  3. I added sta="C*" for testing.

And the catalog.ml file is:

<?xml version='1.0' encoding='utf-8'?>
<q:quakeml xmlns:ns0="http://service.iris.edu/fdsnws/event/1/" xmlns:q="http://quakeml.org/xmlns/quakeml/1.2" xmlns="http://quakeml.org/xmlns/bed/1.2">
  <eventParameters publicID="smi:local/399a88b3-15e4-4124-902d-931bf7fe01d0">
    <event publicID="smi:service.iris.edu/fdsnws/event/1/query?eventid=10937540">
      <preferredOriginID>smi:service.iris.edu/fdsnws/event/1/query?originid=34103486</preferredOriginID>
      <preferredMagnitudeID>smi:service.iris.edu/fdsnws/event/1/query?magnitudeid=189300238</preferredMagnitudeID>
      <type>earthquake</type>
      <description ns0:FEcode="181">
        <text>FIJI ISLANDS REGION</text>
        <type>Flinn-Engdahl region</type>
      </description>
      <origin publicID="smi:service.iris.edu/fdsnws/event/1/query?originid=34103486" ns0:contributor="us" ns0:contributorOriginId="pt18231000" ns0:catalog="NEIC PDE" ns0:contributorEventId="pt18231000,at00pdom8q,us1000gcii">
        <time>
          <value>2018-08-19T00:19:40.670000Z</value>
        </time>
        <latitude>
          <value>-18.1125</value>
        </latitude>
        <longitude>
          <value>-178.1536</value>
        </longitude>
        <depth>
          <value>600000.0</value>
        </depth>
        <creationInfo>
          <author>at,pt,us</author>
        </creationInfo>
      </origin>
      <magnitude publicID="smi:service.iris.edu/fdsnws/event/1/query?magnitudeid=189300238">
        <mag>
          <value>8.2</value>
        </mag>
        <type>mww</type>
        <creationInfo>
          <author>us</author>
        </creationInfo>
      </magnitude>
    </event>
  </eventParameters>
</q:quakeml>

In the next step:

obspyDMT --datapath obspydmt-data --local --read_catalog "./obspydmt-data/EVENTS-INFO/catalog.ml"

and here is the output:

--------------------------------------------------------------------------------
           obspyDMT (obspy Data Management Tool)

    Python Toolbox for Retrieving, Processing and Management of
            Large Seismological Datasets

:copyright:
The ObsPy Development Team (devs@obspy.org)

Developed by Kasra Hosseini
email: kasra.hosseinizad@earth.ox.ac.uk

:license:
GNU General Public License, Version 3
(http://www.gnu.org/licenses/gpl-3.0-standalone.html)
--------------------------------------------------------------------------------

############################################################
WARNING: --min_date is set to 1970-01-01T00:00:00.000000Z
WARNING: --min_mag is set to 3.0
############################################################

obspyDMT primary mode: local

#N LAT       LON       DEP  DATETIME             MAG  AUTH  EV_ID              FLY
--------------------------------------------------------------------------------
1   -18.113  -178.154  600  2018-08-19T00:19:40  8.2  None  20180819_001940.a  NAN
--------------------------------------------------------------------------------

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

On a side note and when I want to use a local catalog:

  1. go to EVENTS-INFO and make a copy of catalog.txt, e.g., cp catalog.txt mycatalog.txt.
  2. slightly modify mycatalog.txt (usually I just need to remove the first 2-3 lines):
#number,event_id,datetime,latitude,longitude,depth,magnitude,magnitude_type,author,flynn_region,mrr,mtt,mpp,mrt,mrp,mtp,stf_func,stf_duration,t1,t2
1,20180819_001940.a,2018-08-19T00:19:40.670000Z,-18.1125,-178.1536,600.0,8.2,mww,None,NAN,None,None,None,None,None,None,triangle,59.432,2018-08-19T00:19:40.670000Z,2018-08-19T02:19:40.670000Z
  1. obspyDMT --datapath obspydmt-data --local --read_catalog "./obspydmt-data/EVENTS-INFO/mycatalog.txt"

(It is usually easier for me to generate a mycatalog.txt file for the events that I want to use.)

In any case, catalog.ml should also work, and it would be great if you could check the commands again and make sure that catalog.ml is not empty.

Hope this helps, and please write me if I can be of any help.

okling commented 5 years ago

Hi Kasra,

Thanks for the reply.

Your command line works! Using the parallel flag also increased the data download speed.

Note: While waiting for your reply, I tried adding a flag --event_catalog NEIC_USGS in my previous command line and this allowed me to write the catalog.ml.

Thanks again for your help.

kasra-hosseini commented 5 years ago

Great that it works now.