hydroflows.methods.raster.merge#

Merge multiple (climate) datasets into one using quantile reduction.

class hydroflows.methods.raster.merge.MergeGriddedDatasets(datasets: ~typing.Annotated[~typing.List[~pathlib.Path], ~pydantic.functional_validators.BeforeValidator(func=~hydroflows._typing.<lambda>, json_schema_input_type=PydanticUndefined)] | ~pathlib.Annotated[~pathlib.Path, ~pydantic.functional_validators.AfterValidator(func=~hydroflows._typing._check_path_has_wildcard)], output_dir: ~pathlib.Path, output_name: str | None = None, reduce_dim: str = 'model', quantile: float = 0.5, **params)[source]#

Merge multiple (climate) datasets into one using quantile reduction.

Parameters:
  • datasets (ListOfPath, WildcardPath) – List of paths of the datasets for merging.

  • output_dir (Path) – The output directory of reduced dataset.

  • output_name (str, optional) – The name of the output file. Default is None.

  • quantile (float) – The quantile the merged data should be given the input datasets.

  • reduce_dim (str) – The dimension to reduce the datasets along. Default is “model” This dimension will be added if not present in the datasets.

  • **params – Additional parameters to pass to the MergeGriddedDatasets instance. See merge Params.

See also

merge Input merge Output merge Params

pydantic model hydroflows.methods.raster.merge.Input[source]#

Input parameters.

This class represents the input data required for the MergeGriddedDatasets 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 datasets: _check_path_has_wildcard)] [Required]#

The path(s) to the change factor datasets of the different climate models.

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.raster.merge.Output[source]#

output parameters.

this class represents the output data generated by the MergeGriddedDatasets 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 merged_dataset: Path [Required]#

Path to the single output merged dataset.

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.raster.merge.Params[source]#

Parameters for the MergeGriddedDatasets.

Instances of this class are used in the MergeGriddedDatasets 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 aligned: bool = False#

Whether the datasets are already aligned or not

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

The output directory of the dataset.

field output_name: str | None = None#

The name of the output file.

field quantile: float = 0.5#

The quantile to reduce the input datasets.

field reduce_dim: str = 'model'#

The dimension to reduce the datasets along. Default is “model”.

field res: float = 0.25#

Resolution (in degrees) of the resulting dataset. Default is 0.25 degrees.

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.