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").


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.


>>> 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
        Stations (2):
            GR.FUR (Fuerstenfeldbruck, Bavaria, GR-Net)
            GR.WET (Wettzell, Bavaria, GR-Net)
        Channels (4):

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

  • station (str) Potentially wildcarded station code. If not given, all station codes will be accepted.
  • location (str) Potentially wildcarded location code. If not given, all location codes will be accepted.
  • channel (str) Potentially wildcarded channel code. If not given, all channel codes will be accepted.
  • 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, stations that match themselves but have no matching child elements (channels) will be included in the result. This flag has no effect for initially empty stations which will always be retained if they are matched by the other parameters.