hydromt.data_catalog.drivers.XarrayDriverOptions#
- pydantic model hydromt.data_catalog.drivers.XarrayDriverOptions[source]#
Options for configuring xarray-based drivers.
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.
- field preprocess: str | None = None#
Name of preprocessor to apply before merging datasets. Available preprocessors include: round_latlon, to_datetimeindex, remove_duplicates, harmonise_dims. See their docstrings for details.
- field ext_override: str | None = None#
Override the file extension check and try to read all files as the given extension. Useful when reading zarr files without the .zarr extension.
- get_preprocessor() Callable[[Dataset], Dataset][source]#
Get the preprocessor instance based on the configured preprocess string.
- get_reading_ext(uri: str) str[source]#
Determine the file extension to use for reading, either from the override or from the URI.
- get_io_format(uri: str) XarrayIOFormat | None[source]#
Determine the xarray reading format based on the file extension or override.
- Parameters:
uri (
str) – The URI of the file to read, used to infer the format from the extension if no override is set.- Returns:
format – The xarray reading format, either ‘zarr’ or ‘netcdf4’. Returns None if the extension is unsupported.
- Return type:
XarrayIOFormat | None
- filter_uris_by_format(uris: list[str]) tuple[list[str], XarrayIOFormat][source]#
Filter the list of URIs to only include those matching the specified format.
- Parameters:
uris (
list[str]) – List of URIs to filter.- Returns:
filtered_uris (
list[str]) – List of URIs that match the specified format.io_format (
XarrayIOFormat) – The xarray reading format to filter by, either ‘zarr’ or ‘netcdf4’.