hydromt_wflow.components.WflowTablesComponent#

Summary of Methods and Attributes#

class WflowTablesComponent(model: Model, filename: str = '{name}.csv')[source]#

Bases: TablesComponent

Wflow specific tables component.

read(filename: str | None = None, **kwargs) None[source]#

Read tables at provided or default file path if none is provided.

write(filename: str | None = None, **kwargs) None[source]#

Write tables at provided or default file path if none is provided.

close() None#

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

property data: Dict[str, DataFrame | Series]#

Model tables.

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.

get_tables_merged() DataFrame#

Return all tables of a model merged into one dataframe.

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.

set(tables: DataFrame | Series | Dict[str, DataFrame | Series], name: str | None = None) None#

Add (a) table(s) <pandas.DataFrame> to model.

Parameters:
  • tables (pandas.DataFrame, pandas.Series or dict) – Table(s) to add to model. Multiple tables can be added at once by passing a dict of tables.

  • name (str, optional) – Name of table, by default None. Required when tables is not a dict.

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

Test if two 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]]