GeoNet / fdsn

FDSN Web Services
MIT License
17 stars 15 forks source link

Can't find any broadband waveform #160

Closed hanbao-ucla closed 6 years ago

hanbao-ucla commented 6 years ago

Hi there,

I am trying to find some broadband waveform (BHZ) within the GEONET

inventory = client.get_stations(latitude=cat[0].origins[0].latitude, longitude=cat[0].origins[0].longitude, maxradius=90.0, channel="BHZ", level="channel", starttime = otime-300, endtime = otime+600) print(inventory) inventory.plot

but got no data.

Is it true that we don't have broadband over New Zealand?

Best, Han

francovm commented 6 years ago

Dear Han,

Good day! Regarding your query, you can request our broadband waveforms using the channels "HHZ" (High Broad Band). Also, remember that the waveform data is available through the FDSN - Dataselect service (get_waveform).

If you have further queries, we’ll be happy to assist.

Regards,

Franco

hanbao-ucla commented 6 years ago

Hi Franco,

Thanks for your reply!

I spend the whole day and finally make it worked with obspy. I also learned how to convert the StationXML file into dataless SEED file. Will let you know if I encounter any further issue.

Best, Han

hanbao-ucla commented 6 years ago

Hi, Franco,

It turns out that I don't have the station location for each SAC file I have now.

I followed the GEONET FDSN service https://www.geonet.org.nz/data/tools/FDSN, and first download the mseed file with the command:

curl -v --data-binary @post_input.txt http://service.geonet.org.nz/fdsnws/dataselect/1/query -o test_post.mseed

the post_input.txt file only have one line:

NZ HHZ 2018-09-28T10:13:00 2018-09-28T10:18:00

and then download the response XML file with the command:

curl "https://service.geonet.org.nz/fdsnws/station/1/query?start=2018-09-28T10:00:00&end=2018-09-28T10:30:00&net=NZ&channel=HHZ&level=response" -o response.xml

Finally I use obspy to remove instrument response and write over as:

from obspy import read, read_inventory st = read("test_minahasa.mseed") inv = read_inventory("response.xml","station.xml") pre_filt = [0.01, 0.015, 18, 20] for tr in st: tr.remove_response(inventory=inv, pre_filt=pre_filt, output="DISP", water_level=60, plot=False) tr.write(tr.id + ".r", format="SAC")

But all the SAC files I got doesn't have lat and lon. I am really confused. Any idea I should try out?

Many thanks. Han

hanbao-ucla commented 6 years ago

Some more info update...

I tried to use the java StationXML-converter (maintained by IRIS) to convert the StationXML file into dataless SEED, and use rdseed to extract SAC files with mseed and dataless SEED, and I finally got the station location (lat/lon).

Seems like the problem is from obspy. Any misbehavior I made when I was using obspy?

Best, Han

francovm commented 6 years ago

Hi Han,

Regarding the ObsPy problem, when you download the data and write it as a SAC file, the attribute dictionary isn't generated automatically. That is to say, the waveform data you have does not know its station coordinates as they are not stored in the MiniSEED file served by the FDSN web server, so the SAC header is not added.

You can populate this yourself fairly easily though.

for tr in st:

        tr.stats.sac = obspy.core.AttribDict()
         # Set any header you want - the names are the same as in the sac documentation
        tr.stats.stla = 11.2 # station latitude
        tr.stats.stlo = ... #station longitude    

st.write("filename", format='sac')  # Finally, write into a SAC file

When you write this stream/trace to a sac file, and load it in sac, you'll see the header values populated.

Also, this object (SACTrace) could be useful to manipulate SAC file.

https://docs.obspy.org/packages/autogen/obspy.io.sac.sactrace.html#module-obspy.io.sac.sactrace

Best,

Franco

hanbao-ucla commented 6 years ago

Hi Franco,

Thanks for your help. I got it. Really appreciate that.

Best, Han