5.3.1.1. eqcorrscan.utils.catalog_utils.filter_picks¶
-
eqcorrscan.utils.catalog_utils.
filter_picks
(catalog, stations=None, channels=None, networks=None, locations=None, top_n_picks=None, evaluation_mode='all')[source]¶ Filter events in the catalog based on a number of parameters.
Parameters: - catalog (obspy.core.event.Catalog) – Catalog to filter.
- stations (list) – List for stations to keep picks from.
- channels (list) – List of channels to keep picks from.
- networks (list) – List of networks to keep picks from.
- locations (list) – List of location codes to use
- top_n_picks (int) – Filter only the top N most used station-channel pairs.
- evaluation_mode (str) – To select only manual or automatic picks, or use all (default).
Returns: Filtered Catalog - if events are left with no picks, they are removed from the catalog.
Return type: Note
Will filter first by station, then by channel, then by network, if using top_n_picks, this will be done last, after the other filters have been applied.
Note
Doesn’t work in place on the catalog, your input catalog will be safe unless you overwrite it.
Note
Doesn’t expand wildcard characters.
Example
>>> from obspy.clients.fdsn import Client >>> from eqcorrscan.utils.catalog_utils import filter_picks >>> from obspy import UTCDateTime >>> client = Client('NCEDC') >>> t1 = UTCDateTime(2004, 9, 28) >>> t2 = t1 + 86400 >>> catalog = client.get_events(starttime=t1, endtime=t2, minmagnitude=3, ... minlatitude=35.7, maxlatitude=36.1, ... minlongitude=-120.6, maxlongitude=-120.2, ... includearrivals=True) >>> print(len(catalog)) 12 >>> filtered_catalog = filter_picks(catalog, stations=['BMS', 'BAP', ... 'PAG', 'PAN', ... 'PBI', 'PKY', ... 'YEG', 'WOF']) >>> print(len(filtered_catalog)) 12 >>> stations = [] >>> for event in filtered_catalog: ... for pick in event.picks: ... stations.append(pick.waveform_id.station_code) >>> print(sorted(list(set(stations)))) ['BAP', 'BMS', 'PAG', 'PAN', 'PBI', 'PKY', 'WOF', 'YEG']