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.
close()Clean up all open datasets.
finish_write()Finish the write functionality after cleanup was called for all components in the model.
get(name)Get geometry by name.
pop(name)Remove and return geometry by name.
read([folder])Read static geometries and adds to
geoms.set(geom, name)Add data to the geom component.
test_equal(other)Test if two GeomsComponents are equal.
write([folder, to_wgs84, precision])Write model geometries to vector file(s) (by default GeoJSON) at <dir_out>/*.geojson.
write_region([filename, to_wgs84])Write the model region to file.
Attributes
boundsReturn the total bounds of the model region.
crsProvide access to the CRS of the model region.
Model geometries.
data_catalogReturn the data catalog of the model this component is associated with.
modelReturn the model object this component is associated with.
name_in_modelFind the name of the component in the parent model components.
regionProvide access to the underlying GeoDataFrame data of the model region.
rootReturn the root of the model this component is associated with.