metobs_toolkit.sensordata.SensorData.to_xr#

SensorData.to_xr() xarray.Dataset[source]#

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

The returned Dataset contains one variable named after the observation type (e.g. ‘temperature’). Its DataArray has:

  • kind dimension with two entries:

    ‘obs’ -> the measured (and possibly processed) numerical values ‘label’ -> the associated integer / categorical QC or gap labels

  • datetime dimension with the observation timestamps.

The ‘obs’ slice holds the physical observation values. The ‘label’ slice holds the label codes; QC and gap-fill method metadata are stored as attributes on that slice (accessible via the DataArray attributes).

Parameters:

sensordata (Sensordata) – Sensor data object containing a DataFrame with ‘value’ and ‘label’ plus metadata (QC, gap-fill info).

Returns:

Dataset with variable <obstype> and dimensions (‘kind’, ‘datetime’), where kind = [‘obs’, ‘label’].

Return type:

xarray.Dataset