message_ix_models.model.transport.files.ExogenousDataFile

class message_ix_models.model.transport.files.ExogenousDataFile(*, name: str, units: str, key: KeyLike | None = None, dims: Tuple[str, ...] | None = None, path: str | Tuple[str, ...] | None = None, description: str | None = None, required: bool = True)[source]

Bases: object

Exogenous/input data for MESSAGEix-Transport expected in a file.

Todo

  • Generate documentation (docstrings or snippets) in reStructuredText format.

  • Accept an argument that sets dfd directly; skip handling other arguments.

  • Annotate certain dimensions as optional; expand add_tasks() to automatically handle insertion of these dimensions.

  • Merge with, or make a subclass of, ExoData.

Parameters:
  • name (str) – Name of the data flow.

  • units (str) – Units for observations in the data flow.

  • key (KeyLike, optional) – Key at which the data from the file will be present in a Computer.

  • dims (tuple of str, optional) – Dimensions of the data.

  • path (str or tuple of str, optional) – Path at which the file is located. If not supplied, path is constructed from key, dims, and the tag “exo”.

  • description (str, optional) – Human-readable description of the data flow, including any notes about required properties or contents or methods used to handle the data.

  • required (bool, optional) – If True (the default), the file must be present for the build to succeed.

__init__(*, name: str, units: str, key: KeyLike | None = None, dims: Tuple[str, ...] | None = None, path: str | Tuple[str, ...] | None = None, description: str | None = None, required: bool = True)[source]

Methods

__init__(*, name, units[, key, dims, path, ...])

add_tasks(c, *args, context)

Prepare c to read data from a file like path.

generate_csv_template()

Generate a CSV template file.

Attributes

key

genno.Key, including preferred dimensions.

path

Path fragment for the location of a file containing the data.

required

True if the data must be present for transport.build.main().

units

Preferred units.

df

sdmx.Dataflow describing the input data flow.

add_tasks(c: genno.Computer, *args, context: Context) Tuple[KeyLike, ...][source]

Prepare c to read data from a file like path.

df: sdmx.model.common.BaseDataflowDefinition

sdmx.Dataflow describing the input data flow.

generate_csv_template() Path[source]

Generate a CSV template file.

property key: Key

genno.Key, including preferred dimensions.

property path: Path

Path fragment for the location of a file containing the data.

property required: bool

True if the data must be present for transport.build.main().

property units: pint.Unit

Preferred units.