hydromt.model.components.VectorComponent#
- class hydromt.model.components.VectorComponent(model: Model, *, region_component: str | None = None, region_filename: str = 'vector/vector_region.geojson')[source]#
ModelComponent class for vector components.
This class is used to manage vector data in a model (e.g. for polygons of a semi distributed model). The vector component data stored in the
data
property of this class if of the hydromt.gis.vector.GeoDataset type which is an extension of xarray.Dataset with a geometry coordinate.Initialize a vector component.
- Parameters:
model (
Model
) – Parent modelregion_component (
str
, optional) – The name of the region component to use as reference for this component’s region. If None, the region will be set to the bounds of the geometry of this vector component.region_filename (
str
) – The path to use for writing the region data to a file. By default “vector/vector_region.geojson”.
- __init__(model: Model, *, region_component: str | None = None, region_filename: str = 'vector/vector_region.geojson') None [source]#
Initialize a vector component.
- Parameters:
model (
Model
) – Parent modelregion_component (
str
, optional) – The name of the region component to use as reference for this component’s region. If None, the region will be set to the bounds of the geometry of this vector component.region_filename (
str
) – The path to use for writing the region data to a file. By default “vector/vector_region.geojson”.
Methods
__init__
(model, *[, region_component, ...])Initialize a vector component.
read
(*[, filename, geometry_filename])Read model vector from combined netcdf and geojson file.
set
([data, name, overwrite_geom])Add data to vector.
test_equal
(other)Test if two components are equal.
write
(*[, filename, geometry_filename, ...])Write model vector to combined netcdf and geojson files.
write_region
(*[, filename, to_wgs84])Write the model region to file.
Attributes
bounds
Return the total bounds of the model region.
Returns coordinate reference system embedded in the vector.
Model vector (polygon) data.
Return the data catalog of the model this component is associated with.
Returns the geometry of the model vector as gpd.GeoSeries.
Returns the index dimension of the vector.
Return the model object this component is associated with.
region
Provide access to the underlying GeoDataFrame data of the model region.
Return the root of the model this component is associated with.