pycif.plugins.datastreams.fluxes.gridded_NetCDF — API reference#

Configuration reference: gridded_NetCDF plugin

pycif.plugins.datastreams.fluxes.gridded_NetCDF.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None, **kwargs)[source]#

Fetch files and corresponding dates in Gridded NetCDF files

Parameters:
  • ref_dir (str) – Path to the data

  • ref_file (str) – File format of the data

  • input_interval (list[datetime.datetime]) – Date range

  • target_dir (str) – Where to link the data

  • tracer (_type_, optional) – _description_. Defaults to None.

Returns:

_description_

Return type:

_type_

pycif.plugins.datastreams.fluxes.gridded_NetCDF.get_domain.get_domain(ref_dir, ref_file, input_interval=None, target_dir=None, 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

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.gridded_NetCDF.read.read(self, name, varnames, dates, files, interpol_flx=False, tracer=None, model=None, ddi=None, debug_read=False, **kwargs)[source]#

Get fluxes from raw files and load them into a pyCIF variables.

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

Returns:

the actual data with dimension:

time, levels, latitudes, longitudes

Return type:

xr.DataArray

pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.find_time_coord(ds: Dataset, tracer, ref_date)[source]#
pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.get_calendar(ds: Dataset, time_varname: str)[source]#
pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.preprocess_time_coord(ds: Dataset, tracer, time_varname: str, ref_date, time_midpoint: bool = False, time_endpoint: bool = False, file_freq: str = '', is_climatology: bool = False) Dataset[source]#

Preprocesses the time coordinate

pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.decode_datetimes(ds: Dataset, tracer, var_name: str, ref_date, file_freq: str = '', is_climatology: bool = False) Dataset[source]#

Decode datetimes from variable ‘var_name’ in the dataset ‘ds’

pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.decode_datetimes_with_units(ds: Dataset, var_name: str, units: str) Dataset[source]#

Decode datetimes from variable ‘var_name’ in the dataset ‘ds’ using its ‘units’ attribute

pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.decode_datetimes_with_format(ds: Dataset, var_name: str, time_format: str) Dataset[source]#

Decode datetimes from variable ‘var_name’ in the dataset ‘ds’ using a time format string

pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.shift_years(ds: Dataset, var_name: str, year_offset: int) Dataset[source]#

Offset years in files if necessary then converts to standard calendar

pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.convert_calendar(ds: Dataset, tracer, var_name: str, calendar: str) Dataset[source]#

Converts to standard calendar

pycif.plugins.datastreams.fluxes.gridded_NetCDF.time_coord.expand_leap_years(ds: Dataset, tracer, var_name: str) Dataset[source]#
pycif.plugins.datastreams.fluxes.gridded_NetCDF.utils.get_time_intervals(ds, tracer, time_varname, date_i, date_f, calendar, time_midpoint=False, time_endpoint=False)[source]#
pycif.plugins.datastreams.fluxes.gridded_NetCDF.utils.get_year_offset(ds: Dataset, time_varname: str, ref_year: int, is_climatology: bool = False) int[source]#
pycif.plugins.datastreams.fluxes.gridded_NetCDF.write.write(self, name, flx_file, flx, mode='a', metadata=None, **kwargs)[source]#