pycif.plugins.datastreams.fluxes.GridFED — API reference#
Configuration reference: GridFED plugin
- pycif.plugins.datastreams.fluxes.GridFED.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None, **kwargs)[source]#
Fetch files and dates for GridFED.
- Parameters:
ref_dir (str) – the path to the input files
ref_file (str) – format of the input files
input_interval (list) – simulation interval (start and end dates)
target_dir (str) – where to copy
tracer – the tracer Plugin, corresponding to the paragraph
datavect/components/fluxes/parameters/my_speciesin the configuration yaml; can be needed to fetch extra information given by the usercomponent – the component Plugin, same as tracer; corresponds to the paragraph
datavect/components/fluxesin the configuration yaml
- Returns:
- 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 matching the files listed in list_files
- Return type:
list_files
- pycif.plugins.datastreams.fluxes.GridFED.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#
Read information from the reference file to define the data horizontal and, if relevant, vertical domain.
- Parameters:
ref_dir (str) – the path to the input files
ref_file (str) – format of the input files
input_interval (list) – simulation interval (start and end dates)
target_dir (str) – where to copy
tracer – the tracer Plugin, corresponding to the paragraph
datavect/components/fluxes/parameters/my_speciesin the configuration yaml; can be needed to fetch extra information given by the user
- Returns:
- a domain class object, with the definition of the center grid
cells coordinates, as well as corners
- Return type:
domain (Domain)
- pycif.plugins.datastreams.fluxes.GridFED.read.read(self, name, varnames, dates, files, interpol_flx=False, tracer=None, model=None, ddi=None, **kwargs)[source]#
Get fluxes from raw GridFED files and load them into a pyCIF variable.
For each requested date/file pair, locates the matching time index, sums the values of tracer.sectors for the tracer.group_name species group, converts the result from kgCO2/month to kgCO2/h, and finally divides by the domain cell areas (computed on the fly if not already available) to obtain kgCO2/m2/h.
- Parameters:
name (str) – name of the component
varnames (list[str]) – original names of variables to read; use name if varnames is empty
dates (list) – list of the date intervals to extract
files (list) – list of the files matching dates
interpol_flx (bool) – Unused, kept for interface consistency with other flux plugins.
tracer – The flux tracer plugin, providing
group_name,sectorsanddomain.model – Unused, kept for interface consistency.
ddi – Unused, kept for interface consistency.
- Returns:
- the actual data with dimension:
time, levels, latitudes, longitudes
- Return type:
xr.DataArray
- Raises:
CifError – If a required sector in tracer.sectors is missing from a file.