metobs_toolkit.Dataset.get_modeldata#
- Dataset.get_modeldata(modelname='ERA5_hourly', modeldata=None, obstype='temp', stations=None, startdt=None, enddt=None)[source]#
Make Modeldata for the Dataset.
Make a metobs_toolkit.Modeldata object with modeldata at the locations of the stations present in the dataset. This Modeldata stores timeseries of model data for each station.
- Parameters:
modelname (str, optional) – Which dataset to download timeseries from. This is only used when no modeldata is provided. The default is ‘ERA5_hourly’.
modeldata (metobs_toolkit.Modeldata, optional) – Use the modelname attribute and the gee information stored in the modeldata instance to extract timeseries.
obstype (String, optional) – Name of the observationtype you want to apply gap filling on. The modeldata must contain this observation type as well. The default is ‘temp’.
stations (string or list of strings, optional) – Stationnames to subset the modeldata to. If None, all stations will be used. The default is None.
startdt (datetime.datetime, optional) – Start datetime of the model timeseries. If None, the start datetime of the dataset is used. The default is None.
enddt (datetime.datetime, optional) – End datetime of the model timeseries. If None, the last datetime of the dataset is used. The default is None.
- Returns:
Modl – The extracted modeldata for period and a set of stations.
- Return type:
Note
If a timezone unaware datetime is given as an argument, it is interpreted as if it has the same timezone as the observations.
Note
When extracting large amounts of data, the timeseries data will be written to a file and saved on your google drive. In this case, you need to provide the Modeldata with the data using the .set_model_from_csv() method.
Examples
import metobs_toolkit # Import data into a Dataset dataset = metobs_toolkit.Dataset() dataset.update_settings( input_data_file=metobs_toolkit.demo_datafile, input_metadata_file=metobs_toolkit.demo_metadatafile, template_file=metobs_toolkit.demo_template, ) dataset.import_data_from_file() # To limit data transfer, we define a short period import datetime tstart = datetime.datetime(2022, 9, 5) tend = datetime.datetime(2022, 9, 6) # Collect ERA5 2mT timeseries at your stations ERA5_data = dataset.get_modeldata( modelname="ERA5_hourly", modeldata=None, obstype="temp", stations=None, startdt=tstart, enddt=tend)