hydromt_wflow.WflowModel#
- class hydromt_wflow.WflowModel(root: str | None = None, mode: str | None = 'w', config_fn: str | None = None, data_libs: ~typing.List | str = None, logger=<Logger hydromt_wflow.wflow (WARNING)>, **artifact_keys)[source]#
Wflow model class.
Initialize a GridModel for distributed models with a regular grid.
- __init__(root: str | None = None, mode: str | None = 'w', config_fn: str | None = None, data_libs: ~typing.List | str = None, logger=<Logger hydromt_wflow.wflow (WARNING)>, **artifact_keys)[source]#
Initialize a GridModel for distributed models with a regular grid.
Methods
__init__
([root, mode, config_fn, data_libs, ...])Initialize a GridModel for distributed models with a regular grid.
build
([region, write, opt])Single method to build a model from scratch based on settings in opt.
clip_forcing
([crs])Return clippped forcing for subbasin.
clip_grid
(region[, buffer, align, crs])Clip grid to subbasin.
clip_states
([crs])Return clippped states for subbasin.
get_config
(*args[, fallback, abs_path])Get a config value at key(s).
get_tables_merged
()Return all tables of a model merged into one dataframe.
read
()Read the complete model schematization and configuration from file.
read_config
([config_fn])Parse config from file.
Read forcing.
read_geoms
([geoms_fn])Read static geometries and adds to
geoms
.read_grid
(**kwargs)Read wflow static input and add to
grid
.read_intbl
(**kwargs)Read and intbl files at <root/intbl> and parse to xarray.
read_maps
([fn])Read model map at <root>/<fn> and add to maps component.
read_nc
(fn[, mask_and_scale, ...])Read netcdf files at <root>/<fn> and return as dict of xarray.Dataset.
Read results at <root/?/> and parse to dict of xr.DataArray/xr.Dataset.
Read states at <root/instate/> and parse to dict of xr.DataArray.
read_staticgeoms
()Read gemoetries from disk.
read_staticmaps
([fn])Read static model maps at <root>/<fn> and add to staticmaps property.
read_tables
(**kwargs)Read table files at <root> and parse to dict of dataframes.
set_config
(*args)Update the config dictionary at key(s) with values.
set_crs
(crs)Set coordinate reference system of the model grid.
set_flwdir
([ftype])Parse pyflwdir.FlwdirRaster object parsed from the wflow ldd.
set_forcing
(data[, name, split_dataset])Add data to forcing attribute.
set_geoms
(geom, name)Add data to the geoms attribute.
set_grid
(data[, name])Add data to grid.
set_intbl
(df, name)Add intbl <pandas.DataFrame> to model.
set_maps
(data[, name, split_dataset])Add raster data to the maps component.
set_results
(data[, name, split_dataset])Add data to results attribute.
set_root
(root[, mode])Initialize the model root.
set_states
(data[, name, split_dataset])Add data to states attribute.
set_staticgeoms
(geom, name)Set the geometries.
set_staticmaps
(data[, name])Add data to staticmaps.
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_cold_states
([timestamp])Prepare cold states for Wflow.
setup_config
(**cfdict)Update config with a dictionary.
setup_config_output_timeseries
(mapname[, ...])Set the default gauge map based on basin outlets.
setup_constant_pars
([dtype, nodata])Generate constant parameter maps for all active model cells.
setup_domestic_demand
(domestic_fn[, ...])Prepare domestic water demand maps from a raster dataset.
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
(region[, res, crs, rotated, ...])HYDROMT CORE METHOD: Create a 2D regular grid or reads an existing grid.
setup_grid_from_constant
(constant, name[, ...])HYDROMT CORE METHOD: Adds a grid based on a constant value.
setup_grid_from_geodataframe
(vector_fn[, ...])HYDROMT CORE METHOD: Add data variable(s) to grid object by rasterizing the data from
vector_fn
.setup_grid_from_raster
(raster_fn, ...[, ...])Add data variable(s) from
raster_fn
to grid object.setup_grid_from_raster_reclass
(raster_fn, ...)HYDROMT CORE METHOD: Add data variable(s) to grid object by reclassifying the data in
raster_fn
based onreclass_table_fn
.setup_grid_from_rasterdataset
(raster_fn[, ...])HYDROMT CORE METHOD: Add data variable(s) from
raster_fn
to grid object.setup_irrigation
(irrigated_area_fn, ...[, ...])Add required information to simulate irrigation water demand.
setup_ksathorfrac
(ksat_fn[, variable, ...])Set KsatHorFrac parameter values from a predetermined map.
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[, rating_curve_fns, ...])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_with_paddy
(lulc_fn, paddy_class)Set up landuse maps and parameters including for paddy fields.
setup_maps_from_raster_reclass
(raster_fn, ...)HYDROMT CORE METHOD: Add data variable(s) to maps object by reclassifying the data in
raster_fn
based onreclass_table_fn
.setup_maps_from_rasterdataset
(raster_fn[, ...])HYDROMT CORE METHOD: Add data variable(s) from
raster_fn
to maps object.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_region
(region[, hydrography_fn, ...])Set the region of interest of the model.
setup_reservoirs
(reservoirs_fn[, ...])Generate maps of reservoir areas and outlets.
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 RootingDepth.
setup_soilmaps
([soil_fn, ptf_ksatver, ...])Derive several (layered) soil parameters.
setup_temp_pet_forcing
(temp_pet_fn[, ...])Generate gridded temperature and reference evapotranspiration forcing.
test_model_api
()Test compliance with HydroMT Model API.
update
([model_out, write, opt, ...])Single method to update a model based the settings in opt.
write
([config_fn, grid_fn, geoms_fn, ...])Write the complete model schematization and configuration to file.
write_config
([config_name, config_root])Write config to <root/config_fn>.
write_data_catalog
([root, data_lib_fn, ...])Write the data catalog to data_lib_fn.
write_forcing
([fn_out, freq_out, chunksize, ...])Write forcing at
fn_out
in model ready format.write_geoms
([geoms_fn, precision])Write geoms in GeoJSON format.
write_grid
([fn_out])Write grid to wflow static data file.
write_intbl
()Write intbl at <root/intbl> in PCRaster table format.
write_maps
([fn])Write maps to netcdf file at <root>/<fn>.
write_nc
(nc_dict, fn[, gdal_compliant, ...])Write dictionnary of xarray.Dataset and/or xarray.DataArray to netcdf files.
write_results
()Write results at <root/?/> in model ready format.
write_states
([fn_out])Write states at <root/instate/> in model ready format.
write_staticgeoms
()Write the geometries to disk.
write_staticmaps
([fn])Write static model maps to netcdf file at <root>/<fn>.
Write tables at <root>.
Attributes
api
Returns a basin(s) geometry as a geopandas.GeoDataFrame.
basins_highres
Returns a high resolution basin(s) geometry.
bounds
Returns the bounding box of the model grid.
Model configuration.
coords
Returns the coordinates of model staticmaps.
Returns coordinate reference system embedded in the model grid.
dims
Returns spatial dimension names of staticmaps.
Return the pyflwdir.FlwdirRaster object parsed from wflow ldd.
Model forcing.
Model geometries.
Model static gridded data as xarray.Dataset.
height
Returns the height of the model staticmaps.
intbl
Return a dictionary of pandas.DataFrames representing wflow intbl files.
maps
Model maps.
Returns the geometry of the model area of interest.
Returns the resolution of the model grid.
Model results.
Return a river geometry as a geopandas.GeoDataFrame.
Path to model folder.
shape
Returns the shape of the model staticmaps.
Model states.
staticgeoms
Access the geometryes.
staticmaps
Model static maps.
Return a dictionary of pandas.DataFrames representing wflow intbl files.
transform
Returns spatial transform of the model grid.
width
Returns the width of the model staticmaps.