Avoiding earthquakes and other noisy data

All of the class constructors that use time series data can remove unwanted time spans, including the noisy time after large earthquakes.

The constructors are SpectralDensity.from_stream(), DataCleaner() and CleanRotator(). They share the following input parameters:

  • avoid_spans (TimeSpans)

  • remove_eqs (str or bool)

and provide the following properties:

  • avoided_spans: time spans NOT used in processing

Default behavior

By default remove_eqs=True for each constructors, so they will run TimeSpans.from_eqs() to generate time spans to avoid based on the USGS earthquake catalog (online or saved in a local file by a previous call). The z_threshold parameter of SpectralDensity.from_stream() sets a scipy.stats.zscore() threshold for eliminating outliers in the calculated spectra: this may add to the time spans that are “avoided”.

The object property avoid_spans indicates all of the time spans avoided: earthquake spans, spans added using avoid_spans and any time spans rejected using the z_threshold (SpectralDensity only)

Adding/modifying time spans to avoid

If the user sets remove_eqs to a string, this must correspond to the name of a local file in QuakeML format.

The user can specify avoid_spans for other time spans to avoid.

The user can also specify another earthquake catalog to avoid (using the default input paramters for TimeSpans.from_eqs()) by setting remove_eqs=<filename>, where <filename> is the name of a QuakeML file in the current working directory.

If the user wants to calculate time spans to avoid based on earthquakes, but using different parameters than the default values, they should run TimeSpans.from_eqs() themselves and enter the output to the avoid_spans parameter.

If the user wants to calculate time spans to avoid themselves, they need to convert these spans to TimeSpans format and enter using avoid_spans

Using the same time spans on different objects

If you want to avoid exactly the same time spans for each class, you should: 1) Retrieve the avoided_spans parameter from one of them (preferably SpectralDensity.from_stream() since it uses the z-score to add time spans to avoid) 2) Set avoid_spans=avoided_spans, remove_eqs=False and 3) On DataCleaner or SpectralDensity, set z_threshold=None