metobs_toolkit.station.Station.to_xr#

Station.to_xr() xrDataset[source]#

Merge all sensor and model data of a station into a single Dataset.

Each variable (per observation type) preserves its internal ‘kind’ dimension, which may include:

  • ‘obs’ : sensor values

  • ‘label’ : sensor labels

  • ‘model’ : model time series (if present for that type)

Datetimes from all contributing sources (sensors and model series) are unioned to build a common ‘datetime’ coordinate; individual variables are reindexed onto this union (introducing NaNs where data are absent).

Station metadata (lat, lon, altitude, LCZ, and any extra data) are added as coordinates.

Parameters:
  • station (Station) – Station object with sensor and model data.

  • fmt_datetime_coordinate (bool, optional) – If True, format datetime for CF compliance. Default is True.

Returns:

Dataset with dimensions (‘kind’, ‘datetime’) and station metadata.

Return type:

xarray.Dataset