pycif.plugins.datastreams.meteos.dummy_csv — API reference#
Configuration reference: dummy_csv plugin
- pycif.plugins.datastreams.meteos.dummy_csv.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, **kwargs)[source]#
Locate dummy meteo CSV files, generating them if missing, and link them.
Iterates over period-start dates covering
input_intervalattracer.file_freq, and for each period computes the hourly (ortracer.resolution) sub-periods it should cover. If the corresponding source file (ref_dir/ref_fileformatted for that period) exists, it is symlinked intotarget_dir; otherwise it is generated on the fly viamake.make().- Parameters:
ref_dir – directory holding (or expected to hold) the dummy meteo CSV files.
ref_file – strftime-style file name pattern (relative to
ref_dir), formatted once per period.input_interval – 2-element sequence
(datei, datef)giving the requested date range.target_dir – directory where files are symlinked or generated.
tracer – the meteo datastream Plugin, used for
tracer.file_freqandtracer.resolution, and passed through tomakewhen a file needs to be generated.
- Returns:
(list_files, list_dates), dicts keyed by each period’s start date.list_filesmaps each key to the (repeated) target file path, one entry per sub-period;list_datesmaps each key to the corresponding list of[start, start + resolution]date pairs.- Return type:
tuple
- pycif.plugins.datastreams.meteos.dummy_csv.make.make(meteo, meteo_file, file_hours, **kwargs)[source]#
Creates random meteo time series for toy Gaussian model
Generates a uniform random wind speed (0-5), wind direction (0-360) and a random Pasquill stability class (A-F) for each requested time step, then writes the result as a CSV file. If
meteo.seedis set, the NumPy random seed is derived deterministically frommeteo.seed_idand the elapsed time betweenfile_hoursandmeteo.datei, so runs are reproducible.- Parameters:
meteo (pycif.utils.classes.Meteo) – object defining the meteo
meteo_file (str) – path where to dump
file_hours (pd.DatetimeIndex) – list of dates to include
- Returns:
None. The generated time series is written to
meteo_fileas a CSV (indexed by date, withwindspeed,winddirandstabclasscolumns).
- pycif.plugins.datastreams.meteos.dummy_csv.read.read(meteo, name, varnames, dates, files, **kwargs)[source]#
Read a variable from the dummy meteo CSV files.
For each requested date, reloads the CSV file when it differs from the previously read one, then selects the row matching that date.
- Parameters:
meteo – the meteo datastream Plugin (unused here beyond interface consistency).
name (str) – name of the CSV column to extract (
windspeed,winddirorstabclass).varnames – unused (kept for interface consistency with other datastream
readfunctions).dates – list of
[start, end]date pairs, aligned withfiles; onlystartis used to select rows.files – list of dummy meteo CSV files to read from, aligned with
dates. Consecutive duplicate entries are only reloaded once.
- Returns:
the requested column’s values for each date in
dates, with dims(time, lev, lat, lon)(single-pointlev/lat/lon).- Return type:
xarray.DataArray