Command line tool

Command line interface to dataqc package. Dataqc computes average amplitudes and power spectral densities of seismic data. Results are stored in HDF5 files to allow quick plotting.

usage: dataqc [-h]
              {process,plot_spectrogram,plot_amplitudes,plot-amplitudes,available,avail,windfilter,wind,smooth}
              ...

Sub-commands:

process

Compute mean amplitude and spectra of seismic data and store results as HDF5. Requires internet access.

dataqc process [-h] [--loglevel {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
               [--logfile LOGFILE] [--append_logfile] [-o OUTDIR]
               [--fileunit {year,month,day,hour}] [--overlap OVERLAP]
               [--proclen PROCLEN] [--winlen-in-s WINLEN_IN_S]
               [--nperseg NPERSEG]
               [--amplitude-frequencies AMPLITUDE_FREQUENCIES AMPLITUDE_FREQUENCIES]
               [--sampling_rate SAMPLING_RATE]
               nslc_code {eida-routing,iris-federator} sds_root starttime
               endtime

Positional Arguments

nslc_code

station code {network}.{station}.{location}.{channel},may contain glob-style wildcards

inventory_or_routing_type

Possible choices: eida-routing, iris-federator

routing client for inventory

sds_root

root-directory of sds-filesystem

starttime

beginning of time range you want to analyzeGive as YYYY-MM-DDThh:mm:ss

endtime

end of time range you want to analyze

Named Arguments

--loglevel

Possible choices: DEBUG, INFO, WARNING, ERROR, CRITICAL

set logging level

Default: “INFO”

--logfile

Give name for logfile

Default: dataqc_process.log

--append_logfile

Default: True

-o, --outdir

where to put the processed data

Default: .

--fileunit

Possible choices: year, month, day, hour

Time span per HDF5-file.

Default: “year”

--overlap

seconds by which the data is extended beyond time range to accomodate filter effects etc.

Default: 60

--proclen

seconds to process at once, ideally duration of the data file

Default: 86400

--winlen-in-s

time over which amplitude and spectra are computed, in seconds

Default: 3600

--nperseg

length of segment for spectral estimation (scipy.signal.welch), in samples

Default: 2048

--amplitude-frequencies, --amplitude_frequencies

min and max frequency of bandpass before amplitude analysis.

Default: (4, 14)

--sampling_rate, --sr, --sampling-rate

Sampling rate at which data are processed. Data are resampled if original SR is different.

Default: 20

plot_spectrogram

Plot PSDs as classic spectrogram, saved as png and optionally shown as interactive matplotlib figure.

dataqc plot_spectrogram [-h] [--loglevel {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                        [--logfile LOGFILE] [--append_logfile]
                        [--fileunit {year,month,day,hour}] [-o FIGDIR] [-s]
                        [-w {3d,3D,2D,2d,both}] [--fmin FMIN] [--fmax FMAX]
                        [--log-freq-ax] [--vmin VMIN] [--vmax VMAX]
                        [-l [TIMELIST] | -r TIMERANGE TIMERANGE]
                        nslc_code datadir

Positional Arguments

nslc_code

station code {network}.{station}.{location}.{channel},May not contain wildcards here!

datadir

where to look for processed data

Default: .

Named Arguments

--loglevel

Possible choices: DEBUG, INFO, WARNING, ERROR, CRITICAL

set logging level

Default: “INFO”

--logfile

Give name for logfile

Default: dataqc_process.log

--append_logfile

Default: True

--fileunit

Possible choices: year, month, day, hour

Time span per HDF5-file.

Default: “year”

-o, --figdir

Where to store figures.

Default: .

-s, --show

If given plot is opened as matplotlib figure.

Default: False

-w, --which

Possible choices: 3d, 3D, 2D, 2d, both

If ‘2D’ only a classic spectrogram is plotted using matplotlib. Will create a png. If ‘3D’ only an interactive html-plot is created using plotly. The file can be opened in a browser. Careful! Can result in enormous file size and might slow down or even crash your browserIf ‘both’ both type of plots are created. Default is ‘2D’

Default: “2d”

--fmin

Minimum frequency

--fmax

Maximum frequency

--log-freq-ax

Make frequency axis logarithmic.

Default: False

--vmin

Minimum value of color scale

--vmax

Maximum value of color scale

-l, --timelist

Plot spectrograms using only times from timelist.Can be used as flag to read times from stdin orgiven a file with datetimes.

-r, --timerange

Start and end of time range you want to plot. Give as YYYY-MM-DDThh:mm:ss, endtime can be None to use current time. If not set, whole available time range is used.

plot_amplitudes (plot-amplitudes)

Plot amplitudes in matrix as time of day vs date. as 2D or interactive 3D figure.

dataqc plot_amplitudes [-h] [--loglevel {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                       [--logfile LOGFILE] [--append_logfile]
                       [--fileunit {year,month,day,hour}] [-o FIGDIR] [-s]
                       [-w {3d,3D,2D,2d,both}] [-r TIMERANGE TIMERANGE]
                       nslc_code datadir

Positional Arguments

nslc_code

station code {network}.{station}.{location}.{channel},May not contain wildcards here!

datadir

where to look for processed data

Default: .

Named Arguments

--loglevel

Possible choices: DEBUG, INFO, WARNING, ERROR, CRITICAL

set logging level

Default: “INFO”

--logfile

Give name for logfile

Default: dataqc_process.log

--append_logfile

Default: True

--fileunit

Possible choices: year, month, day, hour

Time span per HDF5-file.

Default: “year”

-o, --figdir

Where to store figures.

Default: .

-s, --show

If given plot is opened. Opens matplotlib figure and/or plotly graph in browser

Default: False

-w, --which

Possible choices: 3d, 3D, 2D, 2d, both

If ‘2D’ a matrix view is created using matplotlib. Will create a png. If ‘3D’ only an interactive html-plot is created using plotly. The file can be opened in a browser. Careful! Can result in enormous file size and might slow down or even crash your browserIf ‘both’ both type of plots are created. Default is ‘2D’

Default: “2d”

-r, --timerange

Start and end of time range you want to plot. Give as YYYY-MM-DDThh:mm:ss, endtime can be None to use current time. If not set, whole available time range is used.

available (avail)

Print available HDF5 files and covered time range for given code in datadir.

dataqc available [-h] [--loglevel {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
                 [--logfile LOGFILE] [--append_logfile] [--fileunit FILEUNIT]
                 nslc_code datadir

Positional Arguments

nslc_code

station code {network}.{station}.{location}.{channel},may contain glob-style wildcards

datadir

where to look for processed data

Default: .

Named Arguments

--loglevel

Possible choices: DEBUG, INFO, WARNING, ERROR, CRITICAL

set logging level

Default: “INFO”

--logfile

Give name for logfile

Default: dataqc_process.log

--append_logfile

Default: True

--fileunit

Time span per HDF5-file.

Default: “year”

windfilter (wind)

Interpolate and extract list of datetimes based on observation value provided by file. Values are first interpolated to indicated time spacing (delta) which should correspond to the window length used for processing of the seimic data. The resulting list is then filtered for times for which minspeed <= value <= maxspeed. Designed usecase is a list of wind speed measurements.

dataqc windfilter [-h] fname stime etime delta minspeed [maxspeed] [out]

Positional Arguments

fname

Name of wind data file.File must contain 3 columns: date, time and speed.

stime

Start of time range as YYYY-MM-DDThh:mm:ss

etime

End of time range as YYYY-MM-DDThh:mm:ss

delta

increment of time axis to which wind data willbe interpolated. In seconds.Should be same as window length over which amplitudes and psds were computed.

minspeed

Minimum windspeed to select.

maxspeed

Maximum windspeed to select.

out

Default: <_io.TextIOWrapper name=’<stdout>’ mode=’w’ encoding=’utf-8’>

smooth

Smooth / Downsample processed data.Use e.g. before plotting very long time ranges to reduce the amount of data.

dataqc smooth [-h] [--loglevel {DEBUG,INFO,WARNING,ERROR,CRITICAL}]
              [--logfile LOGFILE] [--append_logfile]
              [--fileunit {year,month,day,hour}] [-f]
              nslc_code datadir outdir kernel_size kernel_shift

Positional Arguments

nslc_code

station code {network}.{station}.{location}.{channel},May not contain wildcards here!

datadir

Data source. Where to look for the data which you want to smooth

Default: .

outdir

Where to store the smoothed results.

Default: .

kernel_size

Number of samples over which median is computed.1 sample covers proclen seconds in the original seismic data. Default = 3

Default: 3

kernel_shift

Number of samples by which the kernel is shifted. Values > 1 lead to downsampling. Default = 1

Default: 1

Named Arguments

--loglevel

Possible choices: DEBUG, INFO, WARNING, ERROR, CRITICAL

set logging level

Default: “INFO”

--logfile

Give name for logfile

Default: dataqc_process.log

--append_logfile

Default: True

--fileunit

Possible choices: year, month, day, hour

Time span per HDF5-file.

Default: “year”

-f, --force_new_file

Overwrite existing output files.

Default: False

Use dataqc subcommand -h for details and options on each command.