hydromt.model.components.TablesComponent#

class hydromt.model.components.TablesComponent(model: Model, filename: str = 'tables/{name}.csv')[source]#

TablesComponent contains data as a dictionary of pandas.DataFrame.

It is well suited to represent non-geospatial tabular model data.

Initialize a TablesComponent.

Parameters:
  • model (Model) – HydroMT model instance

  • filename (str) – The default place that should be used for reading and writing unless the user overrides it. If a relative path is given it will be used as being relative to the model root. By default tables/{name}.csv for this component, and can be either relative or absolute.

__init__(model: Model, filename: str = 'tables/{name}.csv')[source]#

Initialize a TablesComponent.

Parameters:
  • model (Model) – HydroMT model instance

  • filename (str) – The default place that should be used for reading and writing unless the user overrides it. If a relative path is given it will be used as being relative to the model root. By default tables/{name}.csv for this component, and can be either relative or absolute.

Methods

__init__(model[, filename])

Initialize a TablesComponent.

get_tables_merged()

Return all tables of a model merged into one dataframe.

read([filename])

Read tables at provided or default filepath if none is provided.

set(tables[, name])

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

test_equal(other)

Test if two components are equal.

write([filename])

Write tables at provided or default filepath if none is provided.

Attributes

data

Model tables.

data_catalog

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

model

Return the model object this component is associated with.

root

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