metobs_toolkit.modeltimeseries.ModelTimeSeries#
- class ModelTimeSeries(site, datarecords: ~numpy.ndarray, timestamps: ~numpy.ndarray, modelobstype: ~metobs_toolkit.obstypes.ModelObstype, datadtype: type = <class 'numpy.float32'>, timezone: str = 'UTC', modelname: str | None = None, modelvariable: str | None = None, _convert_to_standard_units: bool = True)[source]#
Class for model-based timeseries at one location.
This class stores model data at a specific location and automatically converts the data from the model’s native units to standard units as defined by the observation type. The unit conversion is performed during initialization.
- Parameters:
site (object) – The site object representing the location.
datarecords (np.ndarray) – Array of data records in the model’s native units. These will be automatically converted to standard units during initialization.
timestamps (np.ndarray) – Array of timestamps corresponding to the data records.
modelobstype (ModelObstype) – The observation type containing unit information. Must have a model_unit attribute set for unit conversion to work properly.
datadtype (type, optional) – Data type for the records, by default np.float32.
timezone (str, optional) – Timezone for the timestamps, by default “UTC”.
modelname (str, optional) – Name of the model, by default None.
modelvariable (str, optional) – Name of the model variable, by default None.
Notes
The stored data in the series attribute will be in standard units as defined by modelobstype.std_unit, not in the original model units. The conversion is performed automatically.
- Raises:
MetObsUnitUnknown – If the modelobstype does not have a model_unit set, which is required for unit conversion.
- __init__(site, datarecords: ~numpy.ndarray, timestamps: ~numpy.ndarray, modelobstype: ~metobs_toolkit.obstypes.ModelObstype, datadtype: type = <class 'numpy.float32'>, timezone: str = 'UTC', modelname: str | None = None, modelvariable: str | None = None, _convert_to_standard_units: bool = True)[source]#
Methods
__init__(site, datarecords, timestamps, ...)get_info([printout])Print or return information about the ModelTimeSeries.
make_plot([linecolor, ax, figkwargs, title])Create a plot of the model time series.
pd_plot(**pdplotkwargs)A wrapper on the pandas.series.plot function for ModelTimeSeries.
to_xr()Convert a Modelimeseries object to an xarray.Dataset.
Attributes
ModelTimeSeries DataFrame constructor.
Return the end datetime of the series.
Return the frequency of the series.
Return the start datetime of the series.
Return the name of the station this SensorData belongs to.
Return the timezone of the stored timestamps.