pysep.utils.curtail =================== .. py:module:: pysep.utils.curtail .. autoapi-nested-parse:: Utilities to curtail station lists based on source receiver parameters or to curtail streams due to missing data etc. Functions --------- .. autoapisummary:: pysep.utils.curtail.curtail_by_station_distance_azimuth pysep.utils.curtail.quality_check_waveforms_before_processing pysep.utils.curtail.quality_check_waveforms_after_processing pysep.utils.curtail.remove_traces_for_zero_trace_length pysep.utils.curtail.remove_traces_for_bad_data_types pysep.utils.curtail.remove_traces_w_masked_data pysep.utils.curtail.remove_for_clipped_amplitudes pysep.utils.curtail.rename_channels pysep.utils.curtail.remove_stations_for_missing_channels pysep.utils.curtail.remove_stations_for_insufficient_length pysep.utils.curtail.subset_streams Module Contents --------------- .. py:function:: curtail_by_station_distance_azimuth(event, inv, mindistance_km=0.0, maxdistance_km=1000000.0, minazimuth=0.0, maxazimuth=360.0) Remove stations that are greater than a certain distance from event Replaces the old `sta_limit_distance` function :type event: obspy.core.event.Event :param event: Event object to get location from :type inv: obspy.core.inventory.Inventory :param inv: inventory object to get locations from :type mindistance_km: float :param mindistance_km: minimum acceptable source-receiver distance in km :type maxdistance_km: float :param maxdistance_km: maximum acceptable source-receiver distance in km :type minazimuth: float :param minazimuth: minimum acceptable azimuth in deg :type maxazimuth: float :param maxazimuth: maximum acceptable azimuth in deg :rtype: obspy.core.inventory.Inventory :return: a curtailed inventory object which has had stations removed for unacceptable distance and azimuth values .. py:function:: quality_check_waveforms_before_processing(st, remove_clipped=True) Quality assurance to deal with bad data before running the preprocessing steps. Replaces: `do_waveform_QA` :type st: obspy.core.stream.Stream :param st: Stream object to pass through QA procedures :type remove_clipped: bool :param remove_clipped: boolean flag to turn on/off amplitude clipping check .. py:function:: quality_check_waveforms_after_processing(st, remove_insufficient_length=True) Quality assurance to deal with bad data after preprocessing, because preprocesing step will merge, filter and rotate data. Replaces: `do_waveform_QA` :type st: obspy.core.stream.Stream :param st: Stream object to pass through QA procedures :type remove_insufficient_length: bool :param remove_insufficient_length: boolean flag to turn on/off insufficient length checker .. py:function:: remove_traces_for_zero_trace_length(st) Related to Issue #117, traces can be returned from the data center that only have data arrays of length 1, causing their total length in time to be 0s. This will cause preprocessing to break during `estimate_prefilter_corners`, which requires `endtime` - `starttime` > 0. This function will cut out any traces that exhibit this unique behavior, and is complementary to `remove_stations_for_insufficient_length` which is run AFTER preprocessing. This is also run by default as it's assumed the User does NOT want a waveform with only one data point. :type st: obspy.core.stream.Stream :param st: Stream object to pass through QA procedures :rtype st: obspy.core.stream.Stream :return st: curtailed stream with zero-length traces removed .. py:function:: remove_traces_for_bad_data_types(st) Removed traces from a Stream that have unexpected data types. This might occur if e.g., you wildcard the channel and end up grabbing LOG data, which uses letters. :type st: obspy.core.stream.Stream :param st: Stream to check clipping for :rtype st: obspy.core.stream.Stream :return st: curtailed stream with clipped traces removed .. py:function:: remove_traces_w_masked_data(st) Merge operations may produce masked arrays which are data streams with gaps in them. Remove these from the stream .. py:function:: remove_for_clipped_amplitudes(st) Removed stations with clipped amplitudes replaces `clipping_handler.remove_clipped` TODO where is that clip factor coming from? :type st: obspy.core.stream.Stream :param st: Stream to check clipping for :rtype st: obspy.core.stream.Stream :return st: curtailed stream with clipped traces removed .. py:function:: rename_channels(st) Rename channels which intermix location names with channel names, For example: BHX00 -> BHX.00 We are assuming here that channel codes are either: '00' or '10' Historically this is to differentiate STS-1 (00) and STS-2 (10) Relevant reading: https://ds.iris.edu/ds/newsletter/vol1/no1/1/ specification-of-seismograms-the-location-identifier/ TODO old code strips channels down to 3 letters if they're 4. But can't we have 4 letter channel names? NZ does this. TODO Do we only expect location codes to be appended to channels? :type st: obspy.core.stream.Stream :param st: Stream to check incorrect channel naming for :rtype st: obspy.core.stream.Stream :return st: Stream with renamed channels and locations .. py:function:: remove_stations_for_missing_channels(st, required_number_channels=3, networks='LL') Remove LLNL stations (network=='LL') with missing channels. LLNL data is already problematic, so if there are signs of too many issues / problems for a given station then remove that station. :type st: obspy.core.stream.Stream :param st: Stream to check missing channels for :type required_number_channels: int :param required_number_channels: expected channels for each station :type networks: str :param networks: comma-separated list of network codes to check. This defaults to 'LL' because this function was meant to parse through LLNL data .. py:function:: remove_stations_for_insufficient_length(st) Remove stations if the length does not match the mode of all other lengths in the stream, which is assumed to be the expected length :type st: obspy.core.stream.Stream :param st: Stream to check for data gaps and insufficient start and end times .. py:function:: subset_streams(st_a, st_b) Given two streams of data, check if they have the same length. IF they do, return the streams. If they don't, subset the streams so they have the same lengths and the same station ids. :type st_a: obspy.core.stream.Stream :param st_a: stream A to check :type st_b: obspy.core.stream.Stream :param st_b: stream B to check :rtype: tuple of Streams :return: curtailed (or not) streams in the same order as input