pycif.plugins.transforms.basic.time_interpolation — API reference

pycif.plugins.transforms.basic.time_interpolation — API reference#

Configuration reference: time_interpolation plugin

pycif.plugins.transforms.basic.time_interpolation.adjoint.adjoint(transf, inout_datastore, controlvect, obsvect, mapper, di, df, mode, runsubdir, workdir, onlyinit=False, **kwargs)[source]#

Adjoint temporal interpolation: transpose time weights to input grid.

Dispatches to the sparse or array adjoint implementation based on the sampled_out / sparse_out flags.

Parameters:
  • transf (Plugin) – time_interpolation instance.

  • inout_datastore (dict) – mutable datastore.

  • controlvect – unused.

  • obsvect – unused.

  • mapper (dict) – transform mapper.

  • di (datetime) – sub-simulation start date.

  • df (datetime) – sub-simulation end date.

  • mode (str) – 'adj'.

  • runsubdir (str) – unused.

  • workdir (str) – unused.

  • onlyinit (bool) – passed to the sparse/array implementations.

  • **kwargs – forwarded to the sparse/array implementations.

pycif.plugins.transforms.basic.time_interpolation.forward.forward(transf, inout_datastore, controlvect, obsvect, mapper, di, df, mode, runsubdir, workdir, onlyinit=False, save_debug=True, **kwargs)[source]#

Temporally interpolate or re-index data to the output time grid.

Dispatches to either the sparse (observation-indexed DataFrame) or array (gridded xarray) implementation based on the sampled_out and sparse_out flags in the mapper:

  • Sparse/sampled outputforward(): resamples or re-indexes observation DataFrames to the output dates.

  • Array outputforward(): applies linear temporal interpolation to gridded xarray fields.

Parameters:
  • transf (Plugin) – time_interpolation instance (carries method, nthreads, and interpolation index metadata).

  • inout_datastore (dict) – mutable datastore.

  • controlvect – unused.

  • obsvect – unused.

  • mapper (dict) – transform mapper (carries sparse_data, sampled, and date index metadata per tracer).

  • di (datetime) – sub-simulation start date.

  • df (datetime) – sub-simulation end date.

  • mode (str) – 'fwd' or 'tl'.

  • runsubdir (str) – unused.

  • workdir (str) – unused.

  • onlyinit (bool) – passed to the sparse/array implementations.

  • save_debug (bool) – if True, save intermediate results for debugging.

  • **kwargs – forwarded to the sparse/array implementations.

pycif.plugins.transforms.basic.time_interpolation.utils.indexes.calc_indexes(mapper, trid_out, all_transforms, general_mapper)[source]#

Calculate indexes correspondance between input dates and output dates. The calculation relies on averages between inputs and outputs, weighted by the relative duration of targets compared to available inputs.

Parameters:
  • mapper (dict[str]) – the mapper for the present transform

  • trid_out (tuple[str])

  • all_transforms (Transform) – the object storing information on all transforms

  • general_mapper (dict[str]) – the overall mapper for all transforms

pycif.plugins.transforms.basic.time_interpolation.utils.array.adjoint.adjoint(ddi, mapper, inout_datastore, outputs, onlyinit, nthreads=1)[source]#
pycif.plugins.transforms.basic.time_interpolation.utils.array.forward.forward(ddi, mapper, inout_datastore, inputs, nthreads=1)[source]#
pycif.plugins.transforms.basic.time_interpolation.utils.sparse.adjoint.adjoint(transf, ddi, mapper, outputs, inout_datastore, onlyinit, nthreads=1)[source]#
pycif.plugins.transforms.basic.time_interpolation.utils.sparse.forward.forward(transf, ddi, inputs, inout_datastore, onlyinit, mapper, sampled_out, sparse_out, save_debug, nthreads=1)[source]#