Building Station XML Files using NRL

Hi All,

A couple of quick questions about using the StationXML building tools within OBSPY.

Following the guide at: https://docs.obspy.org/tutorial/code_snippets/stationxml_file_from_scratch.html

A question I have regards how some fields are updated.

For example, after building several channels, then appending these to a station, appending the station to a network, and the network to an inventory object, there are some summary fields that don’t represent what is in the inventory. I was wondering how to force these to be updated.

I created a sample station similar to the above guide, then wrote the file to disk as a STATIONXML File. I read this in using read_inventory into the variable inv.

For example, looking at network:
In [3]: inv.networks[0]
Out [3]:

Network NY
Station Count: None/None (Selected/Total)


Access: UNKNOWN
Contains:
Stations (1):
NY.JNPT (Johnson Point, Banks Island, NWT, Canada)
Channels (2):
NY.JNPT…HHZ (2x)

The Station Count field is left as None/None.
The same happens if one looks at the station in more detail:

In [100]: inv.networks[0].stations[0]
Out[100]:
Station JNPT (Johnson Point, Banks Island, NWT, Canada)
Station Code: JNPT
Channel Count: None/None (Selected/Total)
None -
Access: None
Latitude: 0.0, Longitude: 0.0, Elevation: 0.0 m
Available Channels:
JNPT…HHZ (2x)

Although the information is there, and the 2 channels are present, it seems the channel count as displayed isn’t updated.

Is this information, such as the station count (for a network) and channel count (for a station) generated on the fly when printing, or is this more integral within the inventory. Is there a function or module to force this information to be updated after the data is added?

Another question is whether there is a way to have the network operating time field, ie, network.start_date and network.end_date, be (semi-automatically) filled based on the current station operating times. I would have the same question as to whether the similar helper routine was available for stations, to update their start/end dates based on the current channels (ie, if a new set of channels was added, expanding the operating window).

Thanks very much for any help.
Best,
Andrew

Hi Andrew,

unfortunately, I don't think that any such helper routines you describe
are available at the moment. So right now you'd have to iterate in
nested for loops over your final inventory and then update the
respective fields manually.

cheers,
T

Hi Tobias,

Thanks very much, I wondered as such, as I did check through myself quite extensively before posting

Am I correct though in understanding that these are really more aesthetic fields to display information, and wouldn’t actually affect the use of the StationXML file when applied to remove instrument response, for example.

Thanks,
Andrew

Hi Andrew,

while fields like total number of channels/stations are not vital
information, you should indeed make sure to accurately fill in start/end
dates for all included networks/stations/channels. After all, looking up
the appropriate response for a given waveform relies on this information..

cheers,
T