pycif.plugins.datastreams.fluxes.flexpart — API reference#
Configuration reference: flexpart plugin
- pycif.plugins.datastreams.fluxes.flexpart.fetch.fetch(ref_dir, ref_file, date_interval, target_dir, tracer=None, **kwargs)[source]#
Fetch yearly FLEXPART flux files and prepare a single-level domain.
Builds a yearly file list covering
date_interval; for each existing file, expands it into monthly date sub-intervals, links the file (and, iftracer.file_globis set, the accompanying “global” background file for that year) intotarget_dir. Finally,tracer.domainis rebuilt with a single forced vertical level (nlev=1), copying all other horizontal/nesting attributes from the existing domain unchanged.- Parameters:
ref_dir (str) – directory where the original files are found.
ref_file (str) – (template) name of the original files.
date_interval (list) – simulation interval, as a list of the two bounding dates.
target_dir (str) – directory where links to the original files are created.
tracer – the tracer Plugin, giving access to
domainand, optionally,file_glob.**kwargs – unused, kept for interface compatibility.
- Returns:
list_filesandlist_dates.- list_files: for each date that begins a period (a year), a list
containing the name of the file repeated once per covered monthly sub-interval.
- list_dates: for each date that begins a period, a list of
[start, end]monthly date intervals covered by the file.
- Return type:
(dict, dict)
- pycif.plugins.datastreams.fluxes.flexpart.read.read(self, name, varnames, dates, files, interpol_flx=False, tracer=None, **kwargs)[source]#
Get FLEXPART fluxes, optionally cropped to a nested regional domain.
For each requested date/file pair, reads the requested variable via
readnc(); iftracer.crop_regionis set, crops the field to the nest region using a nearest-index lookup againsttracer.domain.lon_in/lat_in. If the domain is nested andtracer.file_globis set, also reads the corresponding “global” background file for the matching time index and appends it (flattened) to the regional data; otherwise the outside-nest part is padded with NaN. Iftracer.convert_to_fluxis set, values are converted to ng/m2/s usingtracer.numscale(default1e12) divided by 3600.- Parameters:
self – the fluxes Plugin.
name – the name of the component; unused directly, kept for interface compatibility.
varnames (str) – variable name to read from the file.
dates (list) – list of the date intervals to extract.
files (list) – list of files matching
dates.interpol_flx (bool) – accepted but not used to alter behavior; kept for interface compatibility.
tracer – the tracer Plugin, giving access to
domain,latname_flx,lonname_flx,timename_flx,crop_region,convert_to_flux,numscaleand, optionally,file_glob.**kwargs – unused, kept for interface compatibility.
- Returns:
the flux data with dimensions
(time, lev, lat, lon), wherelonis the flattened (region + background) horizontal index.- Return type:
xr.DataArray
- pycif.plugins.datastreams.fluxes.flexpart.read_glob.read_glob(self, name, tracdir, tracfic, dates, interpol_flx=False, **kwargs)[source]#
Get global fluxes from pre-computed fluxes and load them into a pycif variables
- Parameters:
self – the model Plugin
name – the name of the component
tracdir – flux directory and file format
tracfic – flux directory and file format
dates – list of dates to extract
interpol_flx (bool) – if True, interpolates fluxes at time t from
files (values of surrounding available)
Note
This was originally copied from ../flexpart/read.py. May eventually be moved to a different plugin