hydromt_wflow.WflowSedimentModel#

class hydromt_wflow.WflowSedimentModel(root: str | None = None, config_filename: str | None = None, mode: str | None = 'w', data_libs: List | str = [], **catalog_keys)[source]#

The wflow sediment model class, a subclass of WflowModel.

Initialize a model.

Parameters:
  • root (str, optional) – Model root, by default None

  • components (Dict[str, Any], optional) –

    Dictionary of components to add to the model, by default None Every entry in this dictionary contains the name of the component as key, and the component object as value, or a dictionary with options passed to the component initializers. If a component is a dictionary, the key ‘type’ should be provided with the name of the component type.

    {
        "grid": {
            "type": "GridComponent",
            "filename": "path/to/grid.nc"
        }
    }
    

  • mode ({'r','r+','w'}, optional) – read/append/write mode, by default “w”

  • data_libs (List[str], optional) – List of data catalog configuration files, by default None

  • region_component (str, optional) – The name of the region component in the components dictionary. If None, the model will can automatically determine the region component if there is only one SpatialModelComponent. Otherwise it will raise an error. If there are no SpatialModelComponent it will raise a warning that region functionality will not work.

  • logger – The logger to be used.

  • **catalog_keys – Additional keyword arguments to be passed down to the DataCatalog.

__init__(root: str | None = None, config_filename: str | None = None, mode: str | None = 'w', data_libs: List | str = [], **catalog_keys)[source]#

Initialize a model.

Parameters:
  • root (str, optional) – Model root, by default None

  • components (Dict[str, Any], optional) –

    Dictionary of components to add to the model, by default None Every entry in this dictionary contains the name of the component as key, and the component object as value, or a dictionary with options passed to the component initializers. If a component is a dictionary, the key ‘type’ should be provided with the name of the component type.

    {
        "grid": {
            "type": "GridComponent",
            "filename": "path/to/grid.nc"
        }
    }
    

  • mode ({'r','r+','w'}, optional) – read/append/write mode, by default “w”

  • data_libs (List[str], optional) – List of data catalog configuration files, by default None

  • region_component (str, optional) – The name of the region component in the components dictionary. If None, the model will can automatically determine the region component if there is only one SpatialModelComponent. Otherwise it will raise an error. If there are no SpatialModelComponent it will raise a warning that region functionality will not work.

  • logger – The logger to be used.

  • **catalog_keys – Additional keyword arguments to be passed down to the DataCatalog.

Methods

__init__([root, config_filename, mode, ...])

Initialize a model.

add_component(name, component)

Add a component to the model.

build(*[, write])

Single method to build a model from scratch based on settings in steps.

clip_forcing()

Return clippped forcing for subbasin.

clip_states()

Return clippped states for subbasin.

clip_staticmaps(region[, buffer, align, ...])

Clip staticmaps to subbasin.

from_dict(model_dict)

Construct a model with the components and other init arguments in the yaml file located at path.

from_yml(path)

Construct a model with the components and other init arguments in the yaml file located at path.

get_component(name)

Get a component from the model.

get_config(*args[, fallback, abs_path])

Get a config value at key.

read([config_filename, staticmaps_filename, ...])

Read components from disk.

read_config([config_filename])

Read config from <root/config_filename>.

read_forcing()

Read forcing.

read_geoms([geoms_filename])

Read static geometries and adds to geoms.

read_results()

Read results at <root/?/> and parse to dict of xr.DataArray/xr.Dataset.

read_states()

Read states at <root/dir_input/state.path_input>.

read_staticmaps([filename])

Read staticmaps model data.

read_tables(**kwargs)

Read table files at <root> and parse to dict of dataframes.

set_config(*args)

Update the config toml at key(s) with values.

set_flwdir([ftype])

Parse pyflwdir.FlwdirRaster object parsed from the wflow ldd.

set_geoms(geometry, name)

Set geometries to the model.

set_grid(data[, name])

Set the grid data with a DataArray or Dataset.

set_states(data[, name])

Add data to states.

set_staticmaps(data[, name])

Add data to grid.

set_tables(df, name)

Add table <pandas.DataFrame> to model.

setup_1dmodel_connection(river1d_fn[, ...])

Connect wflow to a 1D model by deriving linked subcatch (and tributaries).

setup_allocation_areas(waterareas_fn[, ...])

Create water demand allocation areas.

setup_allocation_surfacewaterfrac(gwfrac_fn)

Create the fraction of water allocated from surface water.

setup_areamap(area_fn, col2raster[, nodata, ...])

Set area map from vector data to save wflow outputs for specific area.

setup_basemaps(region, hydrography_fn[, ...])

Build the DEM and flow direction for a Wflow model.

setup_canopymaps(canopy_fn[, output_name])

Generate sediments based canopy height maps.

setup_cold_states([timestamp])

Prepare cold states for Wflow.

setup_config(data)

Set the config dictionary at key(s) with values.

setup_config_output_timeseries(mapname[, ...])

Set the default gauge map based on basin outlets.

setup_constant_pars(**kwargs)

Generate constant parameter maps for all active model cells.

setup_domestic_demand(domestic_fn[, ...])

Prepare domestic water demand maps from a raster dataset.

setup_domestic_demand_from_population(...[, ...])

Prepare domestic water demand maps from statistics per capita.

setup_floodplains(hydrography_fn, ...[, ...])

Add floodplain information to the model schematisation.

setup_gauges(gauges_fn[, index_col, ...])

Set a gauge map based on gauges_fn data.

setup_glaciers(glaciers_fn[, min_area, ...])

Generate maps of glacier areas, area fraction and volume fraction.

setup_grid_from_raster(raster_fn, ...[, ...])

Add data variable(s) from raster_fn to grid object.

setup_irrigation(irrigated_area_fn, ...[, ...])

Add required information to simulate irrigation water demand from grid.

setup_irrigation_from_vector(...[, ...])

Add required information to simulate irrigation water demand from vector.

setup_ksathorfrac(ksat_fn[, variable, ...])

Set KsatHorFrac parameter values from a predetermined map.

setup_ksatver_vegetation([soil_fn, alfa, ...])

Correct vertical saturated hydraulic conductivity with vegetation properties.

setup_laimaps(lai_fn[, lulc_fn, ...])

Set leaf area index (LAI) climatology maps per month [1,2,3,...,12].

setup_laimaps_from_lulc_mapping(lulc_fn, ...)

Derive cyclic LAI maps from a LULC data source and a LULC-LAI mapping table.

setup_lakes([lakes_fn, min_area, ...])

Generate maps of lake areas and outlets.

setup_lulcmaps(lulc_fn[, lulc_mapping_fn, ...])

Derive several wflow maps based on landuse-landcover (LULC) data.

setup_lulcmaps_from_vector(lulc_fn[, ...])

Derive several wflow maps based on vector landuse-landcover (LULC) data.

setup_lulcmaps_with_paddy(lulc_fn, paddy_class)

Set up landuse maps and parameters including for paddy fields.

setup_other_demand(demand_fn[, variables, ...])

Create water demand maps from other sources (e.g. industry, livestock).

setup_outlets([river_only, toml_output, ...])

Set the default gauge map based on basin outlets.

setup_pet_forcing(pet_fn[, chunksize])

Prepare PET forcing from existig PET data.

setup_precip_forcing(precip_fn[, ...])

Generate gridded precipitation forcing at model resolution.

setup_precip_from_point_timeseries(precip_fn)

Generate gridded precipitation from point timeseries (requires wradlib).

setup_reservoirs(reservoirs_fn[, min_area, ...])

Generate maps of reservoir areas and outlets.

setup_riverbedsed([bedsed_mapping_fn, ...])

Generate sediments based river bed characteristics maps.

setup_rivers(hydrography_fn[, ...])

Set all river parameter maps.

setup_riverwidth([predictor, fill, fit, ...])

Set the river width parameter based on power-law relationship with a predictor.

setup_rootzoneclim(run_fn, forcing_obs_fn[, ...])

Set the vegetation_root_depth.

setup_soilmaps([soil_fn, usle_k_method, ...])

Generate sediments based soil parameter maps.

setup_temp_pet_forcing(temp_pet_fn[, ...])

Generate gridded temperature and reference evapotranspiration forcing.

test_equal(other)

Test if two models are equal, based on their components.

update(*[, model_out, write, steps, ...])

Single method to update a model based the settings in steps.

upgrade_to_v1_wflow([soil_fn, ...])

Upgrade the model to wflow v1 format.

write([config_fn, grid_fn, geoms_fn, ...])

Write the complete model schematization and configuration to file.

write_config([config_filename, config_root])

Write config to <root/config_fn>.

write_data_catalog([root, data_lib_path, ...])

Write the data catalog to data_lib_path.

write_forcing([fn_out, freq_out, chunksize, ...])

Write forcing at fn_out in model ready format.

write_geoms([geoms_fn, precision, to_wgs84])

Write geoms in GeoJSON format.

write_results()

Write results at <root/?/> in model ready format.

write_states([filename])

Write states at <root/dir_input/state.path_input> in model ready format.

write_staticmaps([filename])

Write grid to wflow static data file.

write_tables()

Write tables at <root>.

Attributes

basins

Returns a basin(s) geometry as a geopandas.GeoDataFrame.

basins_highres

Returns a high resolution basin(s) geometry.

config

Return the config component.

crs

Returns coordinate reference system embedded in region.

flwdir

Return the pyflwdir.FlwdirRaster object parsed from wflow ldd.

geoms

Return the WflowGeomsComponent instance.

name

region

Return the model's region component.

rivers

Return a river geometry as a geopandas.GeoDataFrame.

states

Return the states component.

staticmaps

Return the staticmaps component.

tables

Return a dictionary of pandas.DataFrames representing wflow csv files.

data_catalog

DataCatalog for data access

root

Model root