hydromt.model.components.SpatialModelComponent#

class hydromt.model.components.SpatialModelComponent(model: Model, *, region_component: str | None = None, region_filename: str = 'region.geojson')[source]#

Base spatial model component for GIS components.

Initialize a SpatialModelComponent.

This component serves as a base class for components that are geospatial and require a region.

To re-use in your won component, make sure you implement the _region_data property.

Parameters:
  • model (Model) – HydroMT model instance

  • region_component (str, optional) – The name of the region component to use as reference for this component’s region in case the region of this new component depends on the region of a different component. If None, the region will be set based on the _region_data property of the component itself.

  • region_filename (str) – The path to use for writing the region data to a file. By default “region.geojson”.

__init__(model: Model, *, region_component: str | None = None, region_filename: str = 'region.geojson') None[source]#

Initialize a SpatialModelComponent.

This component serves as a base class for components that are geospatial and require a region.

To re-use in your won component, make sure you implement the _region_data property.

Parameters:
  • model (Model) – HydroMT model instance

  • region_component (str, optional) – The name of the region component to use as reference for this component’s region in case the region of this new component depends on the region of a different component. If None, the region will be set based on the _region_data property of the component itself.

  • region_filename (str) – The path to use for writing the region data to a file. By default “region.geojson”.

Methods

__init__(model, *[, region_component, ...])

Initialize a SpatialModelComponent.

read()

Read the file(s) into the component.

test_equal(other)

Test if two components are equal.

write()

Write the component to file(s).

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.

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.