Difficulty with getPAZ

Hello

I am probably doing something dumb, but I am having a hard time using the getPAZ on the IC network dataless (http://www.iris.edu/pub/RESPONSES/DATALESS_SEEDS/IC.dataless). When I run through a scan of the blockettes (blockette 50 and 52) I get the existence of such blockettes. However, I am unable to run getPAZ to retrieve the response information. This only appears to be a problem with historical epochs. I am able to retrieve the present epoch without any issues.

Below is the script I am running along with the output. Thanks for any ideas anyone can shed on this.

Thanks for your help,
Adam

#!/usr/bin/env python

from obspy.core import UTCDateTime
from obspy.xseed import Parser

#Get the PAZ from the following station
net = “IC”
sta = “BJT”
chan = “LHE”
loc = “00”
attime = UTCDateTime(2011,01,01,01,01,01)

#Read in the IC dataless
sp = Parser(‘IC.dataless’)

#Run through the dataless and try to find station sta
for cursta in sp.stations:
for blkt in cursta:
if blkt.id == 50:
#Find a blockette 50 and get the station call letters
stacall = blkt.station_call_letters.strip()
if stacall == sta and blkt.id == 52:
#Next we use blockette 52 to get the channel
if blkt.channel_identifier.strip() == chan and blkt.location_identifier.strip() == loc:
#Lets print the start and end date for this sta chan and loc
print “Here is the start:” + str(blkt.start_date)
print “Here is the end:” + str(blkt.end_date)

try:
paz=sp.getPAZ(net + ‘.’ + sta + ‘.’ + loc + ‘.’ + chan ,datetime=attime)
except:
print “Can not find a paz”

[aringler@aslres01 syncomppython]$ ./checkICdataless.py
/home/asluser/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/obspy/xseed/fields.py:359: UserWarning: Date is required.
warnings.warn(‘Date is required.’, UserWarning)
Here is the start:1999-02-10T00:00:00.000000Z
Here is the end:2010-10-19T00:00:00.000000Z
Here is the start:2010-10-19T00:00:00.000000Z
Here is the end:2013-04-17T00:00:00.000000Z
Can not find a paz
[aringler@aslres01 syncomppython]$

Hi Adam,

sorry for the late answer. It took a while to figure this one out.

The problem is that the SEED file is faulty. The channels, e.g. Blockette 52 are put below the wrong Blockette 50:

Blkt 50: IC.BJT | 1994-05-25T00:00:00.000000Z - 2010-10-19T00:00:00.000000Z
Blkt 50: IC.BJT | 2010-10-19T00:00:00.000000Z - 2013-04-17T00:00:00.000000Z
Blkt 50: IC.BJT | 2013-04-17T00:00:00.000000Z -
     Blkt 52: LHE.00 | 1999-02-10T00:00:00.000000Z - 2010-10-19T00:00:00.000000Z
     Blkt 52: LHE.00 | 2010-10-19T00:00:00.000000Z - 2013-04-17T00:00:00.000000Z

The times of the channels do not match the time of the station. Thus the ObsPy getPAZ() routine is not able to find the channels as it stops at the station level if the times do not agree. If this problem is more common we could adjust the getPAZ() routine to ignore the station times but for now the fix is to fix the file.

The code to create the above output is pasted below.

All the best!

Lion

from obspy.core import UTCDateTime
from obspy.xseed import Parser

#Get the PAZ from the following station
net = "IC"
sta = "BJT"
chan = "LHE"
loc = "00"
attime = UTCDateTime(2011, 01, 01, 01, 01, 01)

sp = Parser('IC.dataless')

for cursta in sp.stations:
     found_station = False
     for blkt in cursta:
         if blkt.id == 50 and blkt.network_code == net \
                 and blkt.station_call_letters == sta:
             found_station = True
             print "Blkt 50: " + blkt.network_code + "." + \
                 blkt.station_call_letters + " | " + \
                 str(blkt.start_effective_date) + " - " + \
                 str(blkt.end_effective_date)
         if found_station and blkt.id == 52 and blkt.channel_identifier == chan\
                 and blkt.location_identifier == loc:
             print "\tBlkt 52: " + blkt.channel_identifier + "." + \
                 blkt.location_identifier + " | " + \
                 str(blkt.start_date) + " - " + \
                 str(blkt.end_date)

> Hello
> I am probably doing something dumb, but I am having a hard time using the getPAZ on the IC network dataless (http://www.iris.edu/pub/RESPONSES/DATALESS_SEEDS/IC.dataless). When I run through a scan of the blockettes (blockette 50 and 52) I get the existence of such blockettes. However, I am unable to run getPAZ to retrieve the response information. This only appears to be a problem with historical epochs. I am able to retrieve the present epoch without any issues.
> Below is the script I am running along with the output. Thanks for any ideas anyone can shed on this.
> Thanks for your help,
> Adam
> #!/usr/bin/env python
> from obspy.core import UTCDateTime
> from obspy.xseed import Parser
> #Get the PAZ from the following station
> net = "IC"
> sta = "BJT"
> chan = "LHE"
> loc = "00"
> attime = UTCDateTime(2011,01,01,01,01,01)
> #Read in the IC dataless
> sp = Parser('IC.dataless')
> #Run through the dataless and try to find station sta
> for cursta in sp.stations:
> for blkt in cursta:
> if blkt.id == 50:
> #Find a blockette 50 and get the station call letters
> stacall = blkt.station_call_letters.strip()
> if stacall == sta and blkt.id == 52:
> #Next we use blockette 52 to get the channel
> if blkt.channel_identifier.strip() == chan and blkt.location_identifier.strip() == loc:
> #Lets print the start and end date for this sta chan and loc
> print "Here is the start:" + str(blkt.start_date)
> print "Here is the end:" + str(blkt.end_date)
> try:
> paz=sp.getPAZ(net + '.' + sta + '.' + loc + '.' + chan ,datetime=attime)
> except:
> print "Can not find a paz"
> [aringler@aslres01 syncomppython]$ ./checkICdataless.py
> /home/asluser/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/obspy/xseed/fields.py:359: UserWarning: Date is required.

Seems this is a duplicate of a problem reported here:
https://github.com/obspy/obspy/pull/586

Tobias

True. It is the same problem just with ArcLink. So I guess the same reasoning applies here. I'll fix it.

Cheers!

Lion

Hello Lion and Tobias,

Thanks so much for your help with this and your fix. I would guess this would actually be a common situation. Anytime you change a sensor at a station (and update the metadata) you would change blockette 52, but you might not change blockette 50.

Thanks again for your help,
Adam