pycif.plugins.datastreams.fluxes.wrfchem — API reference#
Configuration reference: wrfchem plugin
- pycif.plugins.datastreams.fluxes.wrfchem.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, **kwargs)[source]#
Links flux files to target_dir, returns file list
Inputs:#
ref_dir: directory where the original files are found (yml: dir) ref_file: (template) name of the original files (yml: file) input_interval: list of the periods to simulate, each item is the list
of the dates of the period # FR: I think now it’s just start and end date to
simulate (2021-09-20)
target_dir: directory where the links to the orginal files are created
Ouputs:#
- list_files: for each date that begins a period, an array containing
the names of the files that are available for the dates within this period
- list_dates: for each date that begins a period, an array containing
the names of the dates mathcin the files listed in list_files
VERSION HISTORY (before incremental git commit messages) 2021-09-22 freum Reverted 2021-09-21 to one item per file 2021-09-21 freum Changed list_dates to one item per subsimu
start. Left the original lines in there but commented.
- 2021-09-20 freum After talking to Antoine, copied first part of
chimere’s fetch instead, then adapted ctdas’ observationoperator_wrfchem.py into it
- 2021-08-20 freum Original from flux_template_plugin, raising
NotImplementedError at beginning
- pycif.plugins.datastreams.fluxes.wrfchem.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#
Not used
VERSION HISTORY
2021-08-20 freum Original from flux_template_plugin, raising NotImplementedError at beginning
- pycif.plugins.datastreams.fluxes.wrfchem.read.read(self, trcr, varname, in_dates, in_files, comp_type, tracer, model, ddi, **kwargs)[source]#
Read fluxes from files and load them into a xarray.DataArray
Inputs:#
Arguments as in plugins/transforms/system/fromcontrol/forward.py. trcr: string
Name in the yaml
- varname: string
Variable name in file. In yaml it’s “varname”. If it’s not defined in the yaml it’s empty here.
- in_dates: list of datetime.datetime objects
All input dates
- in_files: list of strings
For each in_dates, the file where the flux is found
- comp_type: string
Name of component in yaml, i.e. level above parameter. Currently “flux” in my config_wrfchem_explanations.yml. Probably won’t use it.
- tracerPlugin flux
Full flux object, with everything in the yaml. Use this instead of the self in read.py because that self can be modified. Same with write.
- model: model plugin
So you can use e.g. its domain subplugin
- ddi: datetime.datetime?
Start of model period, probably won’t use it.
- **kwargs:
Ignore, will be removed.
Ouputs:#
- xmod: xarray.DataArray
Flux data. Dimensions: (time, vertical levels, latitude, longitude) Coordinates in increasing order.
VERSION HISTORY (before incremental git commit messages) 2021-09-20 freum Wrote it. 2021-09-17 freum Changed arguments to the ones in
pycif/plugins/transforms/system/fromcontrol/forward.py
- 2021-08-20 freum Original code from flux_plugin_template, put a
NotImplementedError at the beginning.
- pycif.plugins.datastreams.fluxes.wrfchem.times_in_wrf_file.times_in_wrf_file(filename)[source]#
Returns the times in netcdf file as datetime object
- pycif.plugins.datastreams.fluxes.wrfchem.utils.find_valid_file(ref_dir, file_format, dd)[source]#
Not used
VERSION HISTORY
2021-08-20 freum Original from flux_template_plugin, raising NotImplementedError at beginning
- pycif.plugins.datastreams.fluxes.wrfchem.write.write(self, name, flx_file, date, flx, domain, mode)[source]#
Write flux data for one timestep to WRF-Chem flux input file
- Parameters:
self (Fluxes) – the Fluxes plugin
name (str) – Name of variable in flx file
flx_file (str) – the file where to write fluxes
date (datetime.datetime) – Timestamp of the flux
flx (numpy.ndarray) – fluxes data to write
domain – domain plugin
mode (str) – ‘w’ to overwrite, ‘a’ to append (existing files)