rubem.configuration.model_configuration_file.ModelConfigurationFile

class ModelConfigurationFile(**data)[source]

Bases: _Section

The legacy configuration file, section by section.

Field names are the lower-case section names; the JSON keys are the upper-case aliases (SIM_TIME, DIRECTORIES, …). Both spellings are accepted on input and the upper-case one is written on output.

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 legacy JSON file, warning about duplicated keys (the last value wins).

resolve_paths

Return a copy whose relative paths are anchored on base_dir.

to_dict

The canonical legacy dictionary (upper-case sections, canonical keys).

Attributes

sim_time

directories

filename_prefixes

rasters

tables

grid

calibration

initial_soil_conditions

constants

generate_file

raster_file_format

classmethod from_json(path)[source]

Read a legacy JSON file, warning about duplicated keys (the last value wins).

Return type:

Self

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'frozen': True, 'serialize_by_alias': True, 'validate_by_alias': True, 'validate_by_name': True}

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

resolve_paths(base_dir)[source]

Return a copy whose relative paths are anchored on base_dir.

Absolute paths are kept; with base_dir=None the file is returned unchanged.

Return type:

Self

to_dict()[source]

The canonical legacy dictionary (upper-case sections, canonical keys).

Return type:

dict