reVeal.config.downscale.RegionalDownscaleConfig#

class RegionalDownscaleConfig(*, grid: Annotated[Path, PathType(path_type=file)], grid_ext: str | None = None, grid_flavor: str | None = None, grid_crs: str | None = None, grid_priority: str, grid_baseline_load: str, baseline_year: Annotated[int, Gt(gt=0)], grid_capacity: str, projection_resolution: RegionalResolutionEnum, load_projections: Annotated[Path, PathType(path_type=file)], load_value: str, load_year: str, max_site_addition_per_year: Annotated[float | None, Strict(strict=False), Gt(gt=0.0)] = None, site_saturation_limit: Annotated[float | None, Strict(strict=False), Gt(gt=0.0), Le(le=1.0)] = 1.0, priority_power: Annotated[float | None, Strict(strict=False), Gt(gt=0.0)] = 1.0, n_bootstraps: Annotated[int, Gt(gt=0)] | None = 10000, random_seed: int | None = 0, max_workers: Annotated[int, Gt(gt=0)] | None = None, reduce_output: bool | None = False, load_regions: str | None = None, region_weights: dict | None = None, regions: Annotated[Path, PathType(path_type=file)], region_names: str, regions_ext: str | None = None, regions_flavor: str | None = None, **extra_data: Any)[source]#

Bases: BaseDownscaleConfig

Model for regional downscaling configuration. Extends BaseDownscaleConfig with additional validations for regional downscaling.

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

check_load_regions_or_region_weights()

Check that either load_regions or region_weights is provided, and not both.

set_grid_crs()

Dynamically set the crs property.

set_grid_ext()

Dynamically set the grid_ext property.

set_grid_flavor()

Dynamically set the dset_flavor.

set_regions_ext()

Dynamically set the regions_ext property.

set_regions_flavor()

Dynamically set the regions_flavor.

validate_grid()

Validate the input grid dataset can be opened, has the expected attributes, and those attributes are numeric.

validate_load_projections()

Validate the input load_projections dataset can be opened, has the expected attributes, and those attributes are numeric.

validate_load_projections_duplicate_years()

If region_weights is specified, validate the input load_projections does not have duplicate entries over years.

validate_load_regions()

If load_regions is specified, check that the column exists in the load_projections dataset.

validate_region_consistency()

Check that the regions in the regions dataset match either the load_regions in the load_projections dataset or the keys of the region_weights.

validate_regions()

Validates the input regions dataset: 1.

validate_sum_region_weights()

Validate that the sum of all region weights is equal to 1.

Attributes

model_computed_fields

model_config

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

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

projection_resolution

load_regions

region_weights

regions

region_names

regions_ext

regions_flavor

grid_priority

grid_baseline_load

baseline_year

grid_capacity

load_projections

load_value

load_year

max_site_addition_per_year

site_saturation_limit

priority_power

n_bootstraps

random_seed

max_workers

reduce_output

grid

grid_ext

grid_flavor

grid_crs

check_load_regions_or_region_weights()[source]#

Check that either load_regions or region_weights is provided, and not both.

set_regions_ext()[source]#

Dynamically set the regions_ext property.

set_regions_flavor()[source]#

Dynamically set the regions_flavor.

Raises:

TypeError – A TypeError will be raised if the input dset is not either a geoparquet or compatible with reading with ogr.

validate_regions()[source]#

Validates the input regions dataset: 1. Has either Polygon or MultiPolygon geometries. 2. Has a column corresponding to the input region_names parameter 3. Has a CRS matching the input grid.

validate_load_projections_duplicate_years()[source]#

If region_weights is specified, validate the input load_projections does not have duplicate entries over years.

validate_load_regions()[source]#

If load_regions is specified, check that the column exists in the load_projections dataset.

Also check for duplicate entries over load_regions and years.

validate_region_consistency()[source]#

Check that the regions in the regions dataset match either the load_regions in the load_projections dataset or the keys of the region_weights.

validate_sum_region_weights()[source]#

Validate that the sum of all region weights is equal to 1.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}#

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

property model_extra: dict[str, Any] | None#

Get extra fields set during validation.

Returns:

A dictionary of extra fields, or None if config.extra is not set to “allow”.

property model_fields_set: set[str]#

Returns the set of fields that have been explicitly set on this model instance.

Returns:
A set of strings representing the fields that have been set,

i.e. that were not filled from defaults.

set_grid_crs()#

Dynamically set the crs property.

set_grid_ext()#

Dynamically set the grid_ext property.

set_grid_flavor()#

Dynamically set the dset_flavor.

Raises:

TypeError – A TypeError will be raised if the input dset is not either a geoparquet or compatible with reading with ogr.

validate_grid()#

Validate the input grid dataset can be opened, has the expected attributes, and those attributes are numeric.

validate_load_projections()#

Validate the input load_projections dataset can be opened, has the expected attributes, and those attributes are numeric. Also ensures that the projections are for years after the the specified baseline year.