pycif.plugins.datastreams.fluxes.CarbonMonitor — API reference#
Configuration reference: CarbonMonitor plugin
- pycif.plugins.datastreams.fluxes.CarbonMonitor.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None, **kwargs)[source]#
Fetch Carbon Monitor files and build the corresponding hourly dates.
Builds a date range at
tracer.file_freqstarting from the first day ofinput_interval’s start month; for each period, links the corresponding file intotarget_dir(if it exists) and expands the period into hourly[start, end]sub-intervals up to the end of the period (or up toinput_interval[1]for the last period).- Parameters:
ref_dir (str) – directory where the original files are found.
ref_file (str) – (template) name of the original files.
input_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
file_freq.component – the component Plugin; unused, kept for interface compatibility.
**kwargs – unused, kept for interface compatibility.
- Returns:
list_filesandlist_dates.- list_files: for each date that begins a period, a list containing
the names of the files that are available for the dates within this period.
- list_dates: for each date that begins a period, a list containing
the date intervals matching the files listed in
list_files.
- Return type:
(dict, dict)
- pycif.plugins.datastreams.fluxes.CarbonMonitor.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#
Build a synthetic global regular lat/lon domain.
Unlike most other flux plugins, this does not read a reference file: the grid is built purely from
tracer.nlon/tracer.nlat, spanning a fixed -90/90 latitude and -180/180 longitude extent, with a single dummy vertical (surface) level.- Parameters:
ref_dir (str) – unused, kept for interface compatibility.
ref_file (str) – unused, kept for interface compatibility.
input_interval (list) – unused, kept for interface compatibility.
target_dir (str) – unused, kept for interface compatibility.
tracer – the tracer Plugin, giving access to
nlon/nlat.
- Returns:
- a domain class object, with the definition of the center grid
cells coordinates, as well as corners.
- Return type:
- pycif.plugins.datastreams.fluxes.CarbonMonitor.read.read(self, name, varnames, dates, files, interpol_flx=False, tracer=None, model=None, ddi=None, **kwargs)[source]#
Get Carbon Monitor fluxes, apply hourly GNFR profiles, load into pyCIF.
Reads the hour-in-day GNFR time-profile CSV from
tracer.dir_profils, maps each of the Carbon Monitor sectors selected intracer.cat_select(indices 0-7) to its corresponding TNO GNFR category via the hardcodedTNO_catmapping, applies the matching hourly coefficient to the raw per-sector emission field, and sums the selected sectors together.- Parameters:
name (str) – name of the component.
varnames (list[str] or 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) – unused, kept for interface compatibility.
tracer – the tracer Plugin, giving access to
domain,dir_profilsandcat_select.model – unused, kept for interface compatibility.
ddi – unused, kept for interface compatibility.
**kwargs – unused, kept for interface compatibility.
- Returns:
- the actual data with dimension:
time, levels, latitudes, longitudes
- Return type:
xr.DataArray