hydromt.data_catalog.DataCatalog#
- class hydromt.data_catalog.DataCatalog(data_libs: List | str | None = None, fallback_lib: str | None = 'artifact_data', cache: bool | None = False, cache_dir: str | None = None)[source]#
Base class for the data catalog object.
Catalog of sources.
Helps to easily read from different files and keep track of files which have been accessed.
- Parameters:
data_libs (
(list of) str
,Path
, optional) – One or more paths to data catalog configuration files or names of predefined data catalogs. By default the data catalog is initiated without data entries. Seefrom_yml()
for accepted yaml format.fallback_lib – Name of pre-defined data catalog to read if no data_libs are provided, by default ‘artifact_data’. If None, no default data catalog is used.
cache (
bool
, optional) – Set to true to cache data locally before reading. Currently only implemented for tiled rasterdatasets, by default False.cache_dir (
str
,Path
, optional) – Folder root path to cach data to, by default ~/.hydromt_datalogger (
logger object
, optional) – The logger object used for logging messages. If not provided, the default logger will be used.
- __init__(data_libs: List | str | None = None, fallback_lib: str | None = 'artifact_data', cache: bool | None = False, cache_dir: str | None = None) None [source]#
Catalog of sources.
Helps to easily read from different files and keep track of files which have been accessed.
- Parameters:
data_libs (
(list of) str
,Path
, optional) – One or more paths to data catalog configuration files or names of predefined data catalogs. By default the data catalog is initiated without data entries. Seefrom_yml()
for accepted yaml format.fallback_lib – Name of pre-defined data catalog to read if no data_libs are provided, by default ‘artifact_data’. If None, no default data catalog is used.
cache (
bool
, optional) – Set to true to cache data locally before reading. Currently only implemented for tiled rasterdatasets, by default False.cache_dir (
str
,Path
, optional) – Folder root path to cach data to, by default ~/.hydromt_datalogger (
logger object
, optional) – The logger object used for logging messages. If not provided, the default logger will be used.
Methods
__init__
([data_libs, fallback_lib, cache, ...])Catalog of sources.
add_source
(name, source)Add a new data source to the data catalog.
contains_source
(source[, provider, version, ...])Check if source is in catalog.
export_data
(new_root[, bbox, time_range, ...])Export a data slice of each dataset and a data_catalog.yml file to disk.
from_dict
(data_dict[, catalog_name, ...])Add data sources based on dictionary.
from_predefined_catalogs
(name[, version])Add data sources from a predefined data catalog.
from_stac_catalog
(stac_like[, handle_nodata])Write data catalog to STAC format.
from_yml
(urlpath[, root, catalog_name, ...])Add data sources based on yaml file.
get_dataframe
(data_like[, variables, ...])Return a clipped, sliced and unified DataFrame.
get_dataset
(data_like[, variables, ...])Return a clipped, sliced and unified Dataset.
get_geodataframe
(data_like[, bbox, geom, ...])Return a clipped and unified GeoDataFrame (vector).
get_geodataset
(data_like[, bbox, geom, ...])Return a clipped, sliced and unified GeoDataset.
get_rasterdataset
(data_like[, bbox, geom, ...])Return a clipped, sliced and unified RasterDataset.
get_source
(source[, provider, version])Return a data source.
get_source_bbox
(source[, provider, version, ...])Retrieve the bounding box and crs of the source.
get_source_names
()Return a list of all available data source names.
get_source_time_range
(source[, provider, ...])Detect the temporal range of the dataset.
list_sources
([used_only])Return a flat list of all available data sources.
to_dict
([source_names, root, meta, used_only])Export the data catalog to a dictionary.
to_stac_catalog
(root[, source_names, meta, ...])Write data catalog to STAC format.
to_yml
(path[, root, source_names, ...])Write data catalog to yaml format.
update
(**kwargs)Add data sources to library or update them.
update_sources
(**kwargs)Add data sources to library or update them.
Attributes
Return all predefined catalogs.
Returns dictionary of DataSources.