hydromt.data_adapter.DataAdapter#

class hydromt.data_adapter.DataAdapter(path: str | Path, driver: str | None = None, filesystem: str | None = None, nodata: dict | float | int | None = None, rename: dict | None = None, unit_mult: dict | None = None, unit_add: dict | None = None, meta: dict | None = None, attrs: dict | None = None, driver_kwargs: dict | None = None, storage_options: dict | None = None, name: str = '', catalog_name: str = '', provider: str | None = None, version: str | None = None)[source]#

General Interface to data source for HydroMT.

General Interface to data source for HydroMT.

Parameters:
  • path (str, Path) – Path to data source. If the dataset consists of multiple files, the path may contain {variable}, {year}, {month} placeholders as well as path search pattern using a ‘*’ wildcard.

  • driver ({'vector', 'netcdf', 'zarr'}, optional) – Driver to read files with, for ‘vector’ open_geodataset(), for ‘netcdf’ xarray.open_mfdataset(). By default the driver is inferred from the file extension and falls back to ‘vector’ if unknown.

  • filesystem (str, optional) – Filesystem where the data is stored (local, cloud, http etc.). If None (default) the filesystem is inferred from the path. See fsspec.registry.known_implementations() for all options.

  • nodata (float, int, optional) – Missing value number. Only used if the data has no native missing value. Nodata values can be differentiated between variables using a dictionary.

  • rename (dict, optional) – Mapping of native data source variable to output source variable name as required by hydroMT.

  • unit_mult (dict, optional) – Scaling multiplication and addition to change to map from the native data unit to the output data unit as required by hydroMT.

  • unit_add (dict, optional) – Scaling multiplication and addition to change to map from the native data unit to the output data unit as required by hydroMT.

  • meta (dict, optional) – Metadata information of dataset, prefably containing the following keys: {‘source_version’, ‘source_url’, ‘source_license’, ‘paper_ref’, ‘paper_doi’, ‘category’}

  • placeholders (dict, optional) – Placeholders to expand yaml entry to multiple entries (name and path) based on placeholder values

  • attrs (dict, optional) – Additional attributes relating to data variables. For instance unit or long name of the variable.

  • driver_kwargs – Additional key-word arguments passed to the driver.

  • dict – Additional key-word arguments passed to the driver.

  • optional – Additional key-word arguments passed to the driver.

  • storage_options (dict, optional) – Additional key-word arguments passed to the fsspec FileSystem object.

  • name (str, optional) – Name of the dataset and catalog, optional for now.

  • catalog_name (str, optional) – Name of the dataset and catalog, optional for now.

__init__(path: str | Path, driver: str | None = None, filesystem: str | None = None, nodata: dict | float | int | None = None, rename: dict | None = None, unit_mult: dict | None = None, unit_add: dict | None = None, meta: dict | None = None, attrs: dict | None = None, driver_kwargs: dict | None = None, storage_options: dict | None = None, name: str = '', catalog_name: str = '', provider: str | None = None, version: str | None = None)[source]#

General Interface to data source for HydroMT.

Parameters:
  • path (str, Path) – Path to data source. If the dataset consists of multiple files, the path may contain {variable}, {year}, {month} placeholders as well as path search pattern using a ‘*’ wildcard.

  • driver ({'vector', 'netcdf', 'zarr'}, optional) – Driver to read files with, for ‘vector’ open_geodataset(), for ‘netcdf’ xarray.open_mfdataset(). By default the driver is inferred from the file extension and falls back to ‘vector’ if unknown.

  • filesystem (str, optional) – Filesystem where the data is stored (local, cloud, http etc.). If None (default) the filesystem is inferred from the path. See fsspec.registry.known_implementations() for all options.

  • nodata (float, int, optional) – Missing value number. Only used if the data has no native missing value. Nodata values can be differentiated between variables using a dictionary.

  • rename (dict, optional) – Mapping of native data source variable to output source variable name as required by hydroMT.

  • unit_mult (dict, optional) – Scaling multiplication and addition to change to map from the native data unit to the output data unit as required by hydroMT.

  • unit_add (dict, optional) – Scaling multiplication and addition to change to map from the native data unit to the output data unit as required by hydroMT.

  • meta (dict, optional) – Metadata information of dataset, prefably containing the following keys: {‘source_version’, ‘source_url’, ‘source_license’, ‘paper_ref’, ‘paper_doi’, ‘category’}

  • placeholders (dict, optional) – Placeholders to expand yaml entry to multiple entries (name and path) based on placeholder values

  • attrs (dict, optional) – Additional attributes relating to data variables. For instance unit or long name of the variable.

  • driver_kwargs – Additional key-word arguments passed to the driver.

  • dict – Additional key-word arguments passed to the driver.

  • optional – Additional key-word arguments passed to the driver.

  • storage_options (dict, optional) – Additional key-word arguments passed to the fsspec FileSystem object.

  • name (str, optional) – Name of the dataset and catalog, optional for now.

  • catalog_name (str, optional) – Name of the dataset and catalog, optional for now.

Methods

__init__(path[, driver, filesystem, nodata, ...])

General Interface to data source for HydroMT.

get_data(bbox, geom, buffer[, handle_nodata])

Return a view (lazy if possible) of the data with standardized field names.

mark_as_used()

Mark the data adapter as used.

summary()

Return a dictionary summary of the data adapter.

to_dict()

Return a dictionary view of the data source.

to_stac_catalog([on_error])

Create a stac item from the data adapter to be added to a stac catalog.

Attributes

data_type

Return the datatype of the addapter.

fs

Return the filesystem object .