obspy.core.inventory.network.Network.select

Network.select(station=None, location=None, channel=None, time=None, starttime=None, endtime=None, sampling_rate=None, keep_empty=False)[source]

Returns the Network object with only the Stations / Channels that match the given criteria (e.g. all channels with channel="EHZ").

Warning

The returned object is based on a shallow copy of the original object. That means that modifying any mutable child elements will also modify the original object (see https://docs.python.org/2/library/copy.html). Use copy() afterwards to make a new copy of the data in memory.

Example

>>> from obspy import read_inventory, UTCDateTime
>>> net = read_inventory()[0]
>>> t = UTCDateTime(2008, 7, 1, 12)
>>> net = net.select(channel="[LB]HZ", time=t)
>>> print(net)  
Network GR (GRSN)
    Station Count: None/None (Selected/Total)
    -- - --
    Access: UNKNOWN
    Contains:
        Stations (2):
            GR.FUR (Fuerstenfeldbruck, Bavaria, GR-Net)
            GR.WET (Wettzell, Bavaria, GR-Net)
        Channels (4):
            GR.FUR..BHZ, GR.FUR..LHZ, GR.WET..BHZ, GR.WET..LHZ

The station, location and channel selection criteria may also contain UNIX style wildcards (e.g. *, ?, ...; see fnmatch()).

Parameters:
  • time (UTCDateTime) Only include stations/channels active at given point in time.
  • starttime (UTCDateTime) Only include stations/channels active at or after given point in time (i.e. channels ending before given time will not be shown).
  • endtime (UTCDateTime) Only include stations/channels active before or at given point in time (i.e. channels starting after given time will not be shown).
  • keep_empty (bool) If set to True, networks/stations that match themselves but have no matching child elements (stations/channels) will be included in the result.