hydromt_delwaq.components.DelwaqPointerComponent#

Summary of Methods and Attributes#

class hydromt_delwaq.components.DelwaqPointerComponent(model: Model, *, filename: str = 'config/B4_pointer.inc')[source]#

Bases: ModelComponent

Delwaq pointer component.

Inherits from the HydroMT-core ModelComponent. Used to create the Delwaq pointer file and access some of its properties.

Keys of the dictionary and their content are:

  • pointer: pointer data as np.ndarray with 4 columns (ID, x, y, z)

  • nrofseg: number of segments as int

  • nrofexch: number of exchanges as int

  • surface_water: name of the surface water compartment as str

  • boundaries: list of the boundaries names as list of str

  • fluxes: list of the flux names as list of str

Initialize a DelwaqPointerComponent.

Parameters:
  • model (Model) – HydroMT model instance

  • filename (str) – The path to use for reading and writing of component data by default. By default “config/B4_pointer.inc”.

property data: dict[str, Any]#

Return the pointer data dictionary.

set(name: str, value: Any)[source]#

Add model attribute property to pointer.

Parameters:
  • name (str) – Name of the pointer attribute to set.

  • value (Any) – Value of the pointer attribute to set.

read()[source]#

Read pointer file in ASCII format at <root/config/B4_pointer.inc>.

write()[source]#

Write pointer at <root/dynamicdata> in ASCII and binary format.

test_equal(other: ModelComponent) tuple[bool, dict[str, str]][source]#

Test if two pointer components are equal.

Parameters:

other (ModelComponent) – The component to compare against.

Returns:

True if the components are equal, and a dict with the associated errors per property checked.

Return type:

tuple[bool, dict[str, str]]

close() None#

Clean up all open datasets. Method to be called before finish_write.

property data_catalog: DataCatalog#

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

finish_write()#

Finish the write functionality after cleanup was called for all components in the model.

All DeferredFileClose objects can overwrite any lazy loaded files now.

property model: Model#

Return the model object this component is associated with.

property name_in_model: str#

Find the name of the component in the parent model components.

property root: ModelRoot#

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