metobs_toolkit.sensordata.SensorData#
- class SensorData(stationname: str, datarecords: np.ndarray, timestamps: np.ndarray, obstype: Obstype, datadtype: type = <class 'numpy.float32'>, timestamps_tz: Union[tzfile | tzinfo | str] = '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 tzinfo, optional) – Timezone identifier for the timestamps (e.g., ‘UTC’, ‘Europe/Amsterdam’), by default ‘UTC’.
freq_estimation_method ({'highest', 'median'}, optional) – Method to estimate frequency, by default ‘median’.
freq_estimation_simplify_tolerance (pandas.Timedelta or str, optional) – Tolerance for frequency estimation simplification, by default pandas.Timedelta(‘1min’).
origin_simplify_tolerance (pandas.Timedelta or str, optional) – Tolerance for origin simplification, by default pandas.Timedelta(‘1min’).
timestamp_tolerance (pandas.Timedelta or str, optional) – Tolerance for timestamp matching, by default pandas.Timedelta(‘4min’).
- __init__(stationname: str, datarecords: np.ndarray, timestamps: np.ndarray, obstype: Obstype, datadtype: type = <class 'numpy.float32'>, timestamps_tz: Union[tzfile | tzinfo | str] = 'UTC', **setupkwargs)[source]#
Initialize SensorData for a single station and observation type.
- Parameters:
stationname (str) – Name of the station this sensor belongs to.
datarecords (numpy.ndarray) – Raw observation values. Will be stored after unit conversion during setup.
timestamps (numpy.ndarray) – Timestamps corresponding to datarecords.
obstype (Obstype) – Observation type describing the measured variable and its units.
datadtype (type, optional) – Numeric dtype for the stored series. Default is
numpy.float32.timestamps_tz (str or tzinfo, optional) – Timezone of the provided timestamps. Default is
'UTC'.**setupkwargs – Additional keyword arguments forwarded to
_setup(e.g.freq_estimation_method,timestamp_tolerance).
Methods
__init__(stationname, datarecords, ...[, ...])Initialize SensorData for a single station and observation type.
Convert all outliers to gaps.
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.
Create gap status overview DataFrame with one row per gap period.
get_info([printout])Retrieve and optionally print basic information about the sensor data.
Generate quality control (QC) frequency statistics.
gross_value_check(**qckwargs)Perform a gross value check on the series.
interpolate_gaps([method, ...])Interpolate gaps in the data.
pd_plot([show_labels])A wrapper on the pandas.series.plot function for SensorData.
persistence_check(**qckwargs)Perform a persistence check on the series.
qc_overview_df()Build a QC overview DataFrame for a single SensorData object.
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 Sensordata (observations, including labels) to an xarray.Dataset.
window_variation_check(**qckwargs)Perform a window variation check on the series.
Attributes
SensorData DataFrame constructor.
Return the end datetime of the series.
Return the frequency of the series.
Return a DataFrame of the gap records.
Return a DataFrame of the outlier records.
Return the start datetime of the series.
Return the name of the station this SensorData belongs to.
Return the timezone of the stored timestamps.