hydroflows.methods.climate.change_factor#

Method for calculating future change factors.

class hydroflows.methods.climate.change_factor.ClimateChangeFactors(hist_climatology: ~pathlib.Path, future_climatology: ~pathlib.Path, model: str, scenario: str, horizon: ~typing.Annotated[list[list[int]], ~pydantic.functional_validators.BeforeValidator(func=~hydroflows._typing.<lambda>, json_schema_input_type=PydanticUndefined)], output_dir: ~pathlib.Path = PosixPath('data/climatology'), **params)[source]#

Create gridded climate change factors from monthly climatology.

Parameters:
  • hist_climatology (Path) – Path to the file with historical climate climatology.

  • future_climatology (Path) – Path to the file with future climate climatology.

  • model (str) – Model name of the climate model (e.g. ‘NOAA-GFDL_GFDL-ESM4’, ‘INM_INM-CM5-0’). Depends on the climate source.

  • scenario (str) – Scenario name of the climate model (e.g. historical, ssp245, ssp585). Depends on the climate source.

  • horizon (ListOfListOfInt) – The horizon of the future scenario (e.g. [[2090, 2100]]).

  • output_dir (Path) – The output directory of the change factor dataset.

  • **params – Additional parameters to pass to the ClimateChangeFactors instance. See change_factor Params.

Create a new expand method instance.

pydantic model hydroflows.methods.climate.change_factor.Input[source]#

Input parameters.

This class represents the input data required for the ClimateChangeFactors method.

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.

Fields:
field future_climatology: Path [Required]#

Path to the dataset with future climate statistics.

field hist_climatology: Path [Required]#

Path to the dataset with historical climate statistics.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

pydantic model hydroflows.methods.climate.change_factor.Output[source]#

output parameters.

this class represents the output data generated by the ClimateChangeFactors method.

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.

Fields:
field change_factors: Path [Required]#

Path to the file containing the gridded climate change factors.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

pydantic model hydroflows.methods.climate.change_factor.Params[source]#

Parameters for the ClimateChangeFactors.

Instances of this class are used in the ClimateChangeFactors method to define the required settings.

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.

Fields:
field convert_to_fraction: bool = True#

Whether or not to convert the change factors from percentages to fractions.

field horizon: <lambda>, json_schema_input_type=PydanticUndefined)] [Required]#

The horizon of the future scenario (e.g. [[2090, 2100]]).

field model: str [Required]#

The specific climate model to be merged (e.g. ‘NOAA-GFDL_GFDL-ESM4’, ‘INM_INM-CM5-0’).

field output_dir: Annotated[Path, AfterValidator(func=outputdirpath_validator)] [Required]#

The output directory of the dataset.

field scenario: str [Required]#

The specific climate scenario to be merged (e.g. historical, ssp245, ssp585).

field wildcard: str = 'horizons'#

Name of the wildcard.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.