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 instancefilename (
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 instancefilename (
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.
close
()Clean up all open datasets.
finish_write
()Finish the write functionality after cleanup was called for all components in the model.
get_tables_merged
()Return all tables of a model merged into one dataframe.
read
([filename])Read tables at provided or default file path 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 file path if none is provided.
Attributes
Model tables.
Return the data catalog of the model this component is associated with.
Return the model object this component is associated with.
name_in_model
Find the name of the component in the parent model components.
Return the root of the model this component is associated with.