pycif.plugins.datastreams.meteos.tm5_meteo — API reference#
Configuration reference: tm5_meteo plugin
- pycif.plugins.datastreams.meteos.tm5_meteo.fetch.fetch_AB(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None, **kwargs)[source]#
Link individual TM5 meteo files to the working directory (original implementation).
Superseded by
fetch()below, which copies the whole meteo directory tree instead. For each month spanned byinput_intervaland each of a fixed set of file categories/prefixes (albedo/sr/veg underan0tr1; blh/ci/cp underh06h18tr1; cld/convec/mfw underh06h18tr3), links the individual source file (named viacomponent.dir_<filedir>) intotarget_dir. A missing source file is silently skipped (only debug-logged).- Parameters:
ref_dir – directory holding the TM5 meteo subdirectories.
ref_file – unused (kept for interface consistency).
input_interval – mapping of period-start dates to the list of dates within each period; only its dates are used, expanded to the first of each covered month.
target_dir – directory where matching files are symlinked.
tracer – unused (kept for interface consistency).
component – object exposing
dir_an0tr1/dir_h06h18tr1/dir_h06h18tr3attributes giving the sub-path (underref_dir) of each file category.
- Returns:
(list_files, list_dates), both dicts keyed by the keys ofinput_intervaland mapping to empty lists — this implementation does not report the dates/files it actually linked.- Return type:
tuple
- pycif.plugins.datastreams.meteos.tm5_meteo.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None, **kwargs)[source]#
Link the whole TM5 meteo directory tree to the working directory.
Clears
target_dir, then bulk-copies theref_dirtree into it withcp -Rsn(directory names are recreated, files become symlinks;-navoids errors on already-existing targets).Note
Version history: 2.0 (17-05-2021, J.C.A. van Peet) replaced the original per-file linking implementation (
fetch_ABabove, 1.0, 28-04-2021, A. Berchet) with this bulk directory copy.- Parameters:
ref_dir – directory holding the TM5 meteo directory tree to copy.
ref_file – unused (kept for interface consistency).
input_interval – 2-element sequence
(ddi, ddf)giving the requested date range.target_dir – directory where the meteo tree is copied as symlinks; cleared before copying.
tracer – unused (kept for interface consistency).
component – unused (kept for interface consistency).
- Returns:
(list_files, list_dates).list_filesis a dict with a single key (ddi) mapping to an empty list.list_datesmaps that same key to an array of consecutive monthly[start, end]date pairs spanning(ddi, ddf).- Return type:
tuple
- Raises:
CifRuntimeError – if the
cp -Rsnsubprocess exits with a non-zero return code.
- pycif.plugins.datastreams.meteos.tm5_meteo.read.read_AB(self, name, tracdir, tracfile, varnames, dates, interpol_flx=False, tracer=None, model=None, filetypes=['defstoke', 'fluxstoke', 'fluxstokev', 'phystoke'], **kwargs)[source]#
Cache the LMDZ-style physics time step from a
defstokefile (original implementation).Superseded by
read()below, which is a non-functional placeholder. For each date and file type, builds the expected<filetype>.an<year>.m<month>.ncpath intracdir(falling back to<filetype>.ncif the dated file is missing) and, forfiletype == "defstoke", readsdtvr/istdynfrom it the first time to compute and cacheself.offtstep. This appears to be LMDZ mass-flux bookkeeping logic carried over and not actually applicable to reading TM5 meteo.- Parameters:
self – the meteo datastream Plugin (receives the cached
offtstepattribute).name – unused (kept for interface consistency).
tracdir – directory holding the meteo files.
tracfile – unused (kept for interface consistency).
varnames – unused (kept for interface consistency).
dates – list of dates to build file paths for.
interpol_flx (bool) – unused (kept for interface consistency).
tracer – unused (kept for interface consistency).
model – unused (kept for interface consistency).
filetypes ([str]) – file-type radicals to iterate over; only
"defstoke"triggers any actual processing.
- Returns:
None.
self.offtstepis set as a side effect, once.
- pycif.plugins.datastreams.meteos.tm5_meteo.read.read(self, name, tracdir, tracfile, varnames, dates, interpol_flx=False, tracer=None, model=None, filetypes=['defstoke', 'fluxstoke', 'fluxstokev', 'phystoke'], **kwargs)[source]#
Placeholder: reading TM5 meteo is not implemented.
Always logs a critical error and terminates the process via
sys.exit(); it never returns a value to the caller. Kept only to satisfy the meteo datastream plugin interface.Note
Version history: 2.0 (17-05-2021, J.C.A. van Peet) replaced the original
read_ABimplementation (above, 1.0, 28-04-2021, A. Berchet) with this placeholder.- Parameters:
self – the meteo datastream Plugin.
name – unused.
tracdir – unused.
tracfile – unused.
varnames – unused.
dates – unused.
interpol_flx (bool) – unused.
tracer – unused.
model – unused.
filetypes ([str]) – unused.
- Raises:
SystemExit – always; a
CifRuntimeErroris raised internally, caught, logged critically, and followed bysys.exit().