metobs_toolkit.sensordata.SensorData#

class SensorData(stationname: str, datarecords: ~numpy.ndarray, timestamps: ~numpy.ndarray, obstype: ~metobs_toolkit.obstypes.Obstype, datadtype: type = <class 'numpy.float32'>, timezone: str | ~pandas._libs.tslibs.timedeltas.Timedelta = 'UTC', **setupkwargs)[source]#

Holds data for one station for one sensor.

Parameters:
  • stationname (str) – Name of the station.

  • datarecords (np.ndarray) – Array of data records.

  • timestamps (np.ndarray) – Array of timestamps.

  • obstype (Obstype) – Observation type.

  • datadtype (type, optional) – Data type of the records, by default np.float32.

  • timezone (str or pd.Timedelta, optional) – Timezone of the timestamps, by default ‘UTC’.

  • freq_estimation_method ({'highest', 'median'}, optional) – Method to estimate frequency, by default ‘median’.

  • freq_estimation_simplify_tolerance (pd.Timedelta or str, optional) – Tolerance for frequency estimation simplification, by default pd.Timedelta(‘1min’).

  • origin_simplify_tolerance (pd.Timedelta or str, optional) – Tolerance for origin simplification, by default pd.Timedelta(‘1min’).

  • timestamp_tolerance (pd.Timedelta or str, optional) – Tolerance for timestamp matching, by default pd.Timedelta(‘4min’).

__init__(stationname: str, datarecords: ~numpy.ndarray, timestamps: ~numpy.ndarray, obstype: ~metobs_toolkit.obstypes.Obstype, datadtype: type = <class 'numpy.float32'>, timezone: str | ~pandas._libs.tslibs.timedeltas.Timedelta = 'UTC', **setupkwargs)[source]#

Methods

__init__(stationname, datarecords, ...[, ...])

convert_outliers_to_gaps()

Convert all outliers to gaps.

convert_to_standard_units()

Convert the data records to the standard units defined in the observation type.

copy([deep])

Return a copy of the sensordata.

duplicated_timestamp_check()

Check for duplicated timestamps in the series.

fill_gap_with_modeldata(modeltimeseries[, ...])

Fill gaps using model data.

get_info([printout])

Retrieve and optionally print basic information about the sensor data.

get_qc_freq_statistics()

Generate quality control (QC) frequency statistics.

gross_value_check(**qckwargs)

Perform a gross value check on the series.

interpolate_gaps([method, max_consec_fill, ...])

Interpolate gaps in the data.

invalid_value_check(skip_records)

Check for invalid values in the series.

persistence_check(**qckwargs)

Perform a persistence check on the series.

repetitions_check(**qckwargs)

Perform a repetitions check on the series.

resample(target_freq[, shift_tolerance, ...])

Resample to a new time resolution.

step_check(**qckwargs)

Perform a step check on the series.

to_xr()

Convert sensor observations (including labels) to an xarray Dataset.

window_variation_check(**qckwargs)

Perform a window variation check on the series.

Attributes

df

SensorData DataFrame constructor.

end_datetime

Return the end datetime of the series.

freq

Return the frequency of the series.

gapsdf

Return a DataFrame of the gap records.

outliersdf

Return a DataFrame of the outlier records.

start_datetime

Return the start datetime of the series.

stationname

Return the name of the station this SensorData belongs to.

tz

Return the timezone of the stored timestamps.