hydromt_wflow.components.WflowGeomsComponent#
- class hydromt_wflow.components.WflowGeomsComponent(model: Model, *, filename: str = 'staticgeoms/{name}.geojson', region_component: str | None = None, region_filename: str = 'staticgeoms/geoms_region.geojson')[source]#
Wflow Geoms Component to manage spatial geometries.
It extends the base GeomsComponent from hydromt and consists of a dictionary of geopandas GeoDataFrames.
Initialize a WflowGeomsComponent.
- Parameters:
model (Model) – HydroMT model instance
filename (str) – The path to use for reading and writing of component data by default. by default “staticgeoms/{name}.geojson”, i.e. one file per geodataframe in the data dictionary.
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 union of all geometries in the data dictionary.
region_filename (str) – The path to use for writing the region data to a file. By default “staticgeoms/geoms_region.geojson”.
- __init__(model: Model, *, filename: str = 'staticgeoms/{name}.geojson', region_component: str | None = None, region_filename: str = 'staticgeoms/geoms_region.geojson')[source]#
Initialize a WflowGeomsComponent.
- Parameters:
model (Model) – HydroMT model instance
filename (str) – The path to use for reading and writing of component data by default. by default “staticgeoms/{name}.geojson”, i.e. one file per geodataframe in the data dictionary.
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 union of all geometries in the data dictionary.
region_filename (str) – The path to use for writing the region data to a file. By default “staticgeoms/geoms_region.geojson”.
Methods
__init__
(model, *[, filename, ...])Initialize a WflowGeomsComponent.
clear
()Clear all geometries.
get
(name)Get geometry by name.
pop
(name)Remove and return geometry by name.
read
([filename])Read model geometries files at <root>/<filename>.
set
(geom, name)Add data to the geom component.
test_equal
(other)Test if two GeomsComponents are equal.
write
(dir_out[, to_wgs84, precision])Write model geometries to a vector file (by default GeoJSON) at <dir_out>/*.geojson.
write_region
(*[, filename, to_wgs84])Write the model region to file.
Attributes
bounds
Return the total bounds of the model region.
crs
Provide access to the CRS of the model region.
Model geometries.
data_catalog
Return the data catalog of the model this component is associated with.
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.