rubem.configuration.model_configuration_file_v1.ModelConfigurationFileV1

class ModelConfigurationFileV1(**data)[source]

Bases: _Strict

The configuration file, format 1.0.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Methods

from_json

Read a 1.0 file.

from_legacy

Build a 1.0 configuration equivalent to a legacy one.

resolve_date

Resolve a from/to value, following the period references.

resolve_paths

Return a copy whose relative paths are anchored on base_dir.

to_dict

The JSON document (ISO dates, $ref objects kept).

to_legacy

Build the legacy equivalent, when every series is a directory series.

Attributes

version

metadata

simulation_period

raster_series

rasters

lookup_tables

raster_info

classmethod from_json(path)[source]

Read a 1.0 file. Duplicated keys are an error in this format.

Raises:

ValueError – On duplicated keys.

Return type:

Self

classmethod from_legacy(legacy, metadata=None)[source]

Build a 1.0 configuration equivalent to a legacy one.

Directory series become dir_path/files_prefix entries, the period keeps its dates, the legacy time-series flag becomes the time_series_samples selection (CSV only, as the legacy run writes), and the raster formats follow RASTER_FILE_FORMAT.

Return type:

Self

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

resolve_date(value)[source]

Resolve a from/to value, following the period references.

Return type:

date

resolve_paths(base_dir)[source]

Return a copy whose relative paths are anchored on base_dir.

Return type:

Self

to_dict()[source]

The JSON document (ISO dates, $ref objects kept).

Return type:

dict

to_legacy()[source]

Build the legacy equivalent, when every series is a directory series.

Raises:

ValueError – If a series is not given as a directory with a prefix, or the outputs use a combination the legacy file cannot express (time series without their raster series, formats other than CSV for the tables).

Return type:

ModelConfigurationFile