hydromt.data_catalog.drivers.GeoDatasetVectorDriver#
- pydantic model hydromt.data_catalog.drivers.GeoDatasetVectorDriver[source]#
Driver for GeoDataset using hydromt vector:
geodataframe_vector.Supports reading geodataset from a combination of a geometry file and optionally an external data file. The geometry file can be any file supported by geopandas.read_file, such as shapefile, geojson, geopackage, or a tabular file like csv or parquet for points (containing latitude and longitude columns). The external data file can be a netcdf file or any tabular file like csv or parquet. The geometry file and the external data file can be linked using a common column (e.g. an ID column).
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.
- SUPPORTED_EXTENSIONS: ClassVar[set[str]] = {'.csv', '.fgb', '.geojson', '.gpkg', '.parquet', '.shp', '.xls', '.xlsx', '.xy'}#
“Set of supported file extensions for this driver.
- field options: GeoDatasetOptions [Optional]#
Driver options that can be used to configure the behavior of the driver. DriverOptions allows for setting arbitrary kwargs. Any options not explicitly declared in the DriverOptions class are passed as kwargs to the underlying open functions.
- read(uris: list[str], *, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, mask: GeoDataFrame | GeoSeries | None = None, predicate: Literal['intersects', 'within', 'contains', 'overlaps', 'crosses', 'touches'] = 'intersects', metadata: SourceMetadata | None = None) Dataset[source]#
Read tabular or vector dataset files (e.g., CSV, Parquet) into an xarray Dataset.
- Parameters:
uris (
list[str]) – List of URIs to read data from.handle_nodata (
NoDataStrategy, optional) – Strategy to handle missing data. Default is NoDataStrategy.RAISE.mask (
Geom | None, optional) – Optional spatial mask to clip the dataset.predicate (
Predicate, optional) – Spatial predicate for filtering geometries. Default is “intersects”.metadata (
SourceMetadata | None, optional) – Optional metadata object to attach to the loaded dataset.
- Returns:
The dataset read from the source.
- Return type:
xr.Dataset
- write(path: Path | str, data: Dataset, *, write_kwargs: dict[str, Any] | None = None) Path[source]#
Write a GeoDataset to disk.
Writing is not supported for this driver, as vector and tabular sources such as CSV or Parquet are read-only in this context. This method exists for interface consistency with GeoDatasetDriver.
- Parameters:
path (
Path | str) – Destination path where the dataset would be written.data (
xr.Dataset) – The dataset to write.write_kwargs (
dict[str,Any] | None, optional) – Additional keyword arguments that would be passed to the underlying write function. Default is None.
- Raises:
NotImplementedError – Always raised, as writing is not supported for this driver.