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 model

  • region_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 model

  • region_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.

crs

Returns coordinate reference system embedded in the vector.

data

Model vector (polygon) data.

data_catalog

Return the data catalog of the model this component is associated with.

geometry

Returns the geometry of the model vector as gpd.GeoSeries.

index_dim

Returns the index dimension of the vector.

model

Return the model object this component is associated with.

region

Provide access to the underlying GeoDataFrame data of the model region.

root

Return the root of the model this component is associated with.