Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoostBuitink committed Jul 25, 2023
1 parent e0b1436 commit ff9e2c9
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 101 deletions.
39 changes: 20 additions & 19 deletions hydromt_wflow/wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,34 +262,34 @@ def setup_rivers(
This component sets the all river parameter maps.
The river mask is defined by all cells with a mimimum upstream area threshold
`river_upa` [km2].
``river_upa`` [km2].
The river length is defined as the distance from the subgrid outlet pixel to
the next upstream subgrid outlet pixel. The `min_rivlen_ratio` is the minimum
the next upstream subgrid outlet pixel. The ``min_rivlen_ratio`` is the minimum
global river length to avg. cell resolution ratio and is used as a threshold in
window based smoothing of river length.
The river slope is derived from the subgrid elevation difference between pixels at a
half distance `slope_len` [m] up- and downstream from the subgrid outlet pixel.
half distance ``slope_len`` [m] up- and downstream from the subgrid outlet pixel.
The river manning roughness coefficient is derived based on reclassification
of the streamorder map using a lookup table `rivman_mapping_fn`.
of the streamorder map using a lookup table ``rivman_mapping_fn``.
The river width is derived from the nearest river segment in `river_geom_fn`.
The river width is derived from the nearest river segment in ``river_geom_fn``.
Data gaps are filled by the nearest valid upstream value and averaged along
the flow directions over a length `smooth_len` [m]
the flow directions over a length ``smooth_len`` [m]
The river depth is calculated using the `rivdph_method`, by default powlaw:
The river depth is calculated using the ``rivdph_method``, by default powlaw:
h = hc*Qbf**hp, which is based on qbankfull discharge from the nearest river
segment in `river_geom_fn` and takes optional arguments for the hc
segment in ``river_geom_fn`` and takes optional arguments for the hc
(default = 0.27) and hp (default = 0.30) parameters. For other methods see
:py:meth:`hydromt.workflows.river_depth`.
If `river_routing` is set to "local-inertial", the bankfull elevantion map can be
If ``river_routing`` is set to "local-inertial", the bankfull elevantion map can be
conditioned based on the average cell elevation ("wflow_dem") or subgrid outlet pixel
elevation ("dem_subgrid"). The subgrid elevation might provide a better representation
of the river elevation profile, however in combination with local-inertial land routing
(see `hydromt.setup_floodplains`) the subgrid elevation will likely overestimate the
(see :py:meth:`setup_floodplains`) the subgrid elevation will likely overestimate the
floodplain storage capacity. Note that the same input elevation map should be used for
river bankfull elevation and land elevation when using local-inertial land routing.
Expand Down Expand Up @@ -343,7 +343,7 @@ def setup_rivers(
workflows.river_bathymetry
hydromt.workflows.river_depth
pyflwdir.FlwdirRaster.river_depth
hydromt.setup_floodplains
setup_floodplains
"""
self.logger.info(f"Preparing river maps.")

Expand Down Expand Up @@ -472,17 +472,17 @@ def setup_floodplains(
):
"""
This components adds floodplain information to the model schematistation. The user can
define what type of floodplains are required (1D or 2D), through the `floodplain_type`
define what type of floodplains are required (1D or 2D), through the ``floodplain_type``
argument.
If `floodplain_type` is set to "1d", a floodplain profile is derived for every river
If ``floodplain_type`` is set to "1d", a floodplain profile is derived for every river
cell. It adds a map with floodplain volume per flood depth, which is used in the wflow
1D floodplain schematisation.
Note, it is important to use the same river uparea value as used in the `setup_rivers`
Note, it is important to use the same river uparea value as used in the :py:meth:`setup_rivers`
method.
If `floodplain_type` is set to "2d", this component adds a hydrologically conditioned
If ``floodplain_type`` is set to "2d", this component adds a hydrologically conditioned
elevation (hydrodem) map for land routing (local-inertial). For this options, landcells
need to be conditioned to D4 flow directions otherwise pits may remain in the land
cells.
Expand All @@ -494,13 +494,14 @@ def setup_floodplains(
Additionally, note that the same input elevation map should be used for river bankfull
elevation and land elevation when using local-inertial land routing.
Requires `setup_rivers` to be executed beforehand (with `river_routing` set to
Requires :py:meth:`setup_rivers` to be executed beforehand (with ``river_routing`` set to
`local-inertial`).
Adds model layers:
* **floodplain_volume** map: map with floodplain volumes, has flood depth as third
dimension [m3] (for 1D floodplains)
* **hydrodem** map: hydrologically conditioned elevation [m+REF] (for 2D floodplains)
Parameters
Expand Down Expand Up @@ -1031,7 +1032,7 @@ def setup_gauges(
used to set the maximum distance to snap to the mask.
* snapping based on upstream area matching: : ``snap_uparea=True``. The gauge locations
are snapped to the closest matching upstream area value. Requires gauges_fn to have
an `uparea` [km2] column. The closest value will be looked for in a cell window of size ``wdw``
an ``uparea`` [km2] column. The closest value will be looked for in a cell window of size ``wdw``
and the difference between the gauge and the closest value should be smaller than ``rel_error``.
If ``derive_subcatch`` is set to True, an additional subcatch map is derived from
Expand Down Expand Up @@ -2540,9 +2541,9 @@ def write_forcing(
time_units="days since 1900-01-01T00:00:00",
**kwargs,
):
"""write forcing at `fn_out` in model ready format.
"""write forcing at ``fn_out`` in model ready format.
If no `fn_out` path is provided and path_forcing from the wflow toml exists,
If no ``fn_out`` path is provided and path_forcing from the wflow toml exists,
the following default filenames are used:
* Default name format (with downscaling): inmaps_sourcePd_sourceTd_methodPET_freq_startyear_endyear.nc
Expand Down
13 changes: 7 additions & 6 deletions hydromt_wflow/workflows/basemaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,14 @@ def topography(
method: str = "average",
logger=logger,
):
"""Returns topography maps (see list below) at model resolution based on gridded
elevation data input.
"""Returns topography maps (see list below) at model resolution based on gridded
elevation data input.
The following topography maps are calculated:
- elevtn : average elevation [m]
- lndslp : average land surface slope [m/m]
The following topography maps are calculated:\
- elevtn : average elevation [m]\
- lndslp : average land surface slope [m/m]\
Parameters
----------
ds : xarray.DataArray
Expand Down
11 changes: 6 additions & 5 deletions hydromt_wflow/workflows/glaciers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ def glaciermaps(
):
"""Returns glacier maps (see list below) at model resolution.
The following glacier maps are calculated:\
- wflow_glacierareas: glacier IDs [ID]\
- wflow_glacierfrac: area fraction of glacier per cell [-]\
- wflow_glacierstore: storage (volume) of glacier per cell [mm]\
The following glacier maps are calculated:
- wflow_glacierareas: glacier IDs [ID]
- wflow_glacierfrac: area fraction of glacier per cell [-]
- wflow_glacierstore: storage (volume) of glacier per cell [mm]
Parameters
----------
gdf : geopandas.GeoDataFrame
Expand Down
3 changes: 2 additions & 1 deletion hydromt_wflow/workflows/landuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def landuse(da, ds_like, df, logger=logger, params=None):
The parameter maps are prepared based on landuse map and
mapping table as provided in the generic data folder of hydromt.
The following topography maps are calculated:\
The following topography maps are calculated:
- TODO
Parameters
Expand Down
74 changes: 38 additions & 36 deletions hydromt_wflow/workflows/soilgrids.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,37 +283,38 @@ def constrain_M(M, popt_0, M_minmax):
def soilgrids(ds, ds_like, ptfKsatVer, soil_fn, logger=logger):
"""
Returns soil parameter maps at model resolution based on soil properties from SoilGrids datasets.
Both soilgrids 2017 and 2020 are supported. Soilgrids 2017 provides soil properties at 7 specific depths, while soilgrids_2020 provides soil properties averaged over 6 depth intervals.
Ref: Hengl, T., Mendes de Jesus, J., Heuvelink, G. B. M., Ruiperez Gonzalez, M., Kilibarda,
M., Blagotic, A., et al.: SoilGrids250m: Global gridded soil information based on machine learning,
Both soilgrids 2017 and 2020 are supported. Soilgrids 2017 provides soil properties at 7 specific depths, while soilgrids_2020 provides soil properties averaged over 6 depth intervals.
Ref: Hengl, T., Mendes de Jesus, J., Heuvelink, G. B. M., Ruiperez Gonzalez, M., Kilibarda,
M., Blagotic, A., et al.: SoilGrids250m: Global gridded soil information based on machine learning,
PLoS ONE, 12, https://doi.org/10.1371/journal.pone.0169748, 2017.
Ref: de Sousa, L.M., Poggio, L., Batjes, N.H., Heuvelink, G., Kempen, B., Riberio, E. and Rossiter, D., 2020.
Ref: de Sousa, L.M., Poggio, L., Batjes, N.H., Heuvelink, G., Kempen, B., Riberio, E. and Rossiter, D., 2020.
SoilGrids 2.0: producing quality-assessed soil information for the globe. SOIL Discussions, pp.1-37.
https://doi.org/10.5194/soil-2020-65
The following soil parameter maps are calculated:\
- `thetaS` : average saturated soil water content [m3/m3]\
- `thetaR` : average residual water content [m3/m3]\
- `KsatVer` : vertical saturated hydraulic conductivity at soil surface [mm/day]\
- `SoilThickness` : soil thickness [mm]\
- `SoilMinThickness` : minimum soil thickness [mm] (equal to SoilThickness)\
- `M` : model parameter [mm] that controls exponential decline of KsatVer with soil depth
(fitted with curve_fit (scipy.optimize)), bounds of M are checked\
- `M_` : model parameter [mm] that controls exponential decline of KsatVer with soil depth
(fitted with numpy linalg regression), bounds of `M_`are checked\
- `M_original` : `M` without checking bounds\
- `M_original_` : `M_`without checking bounds\
- `f` : scaling parameter controlling the decline of KsatVer [mm-1] (fitted with curve_fit (scipy.optimize)), bounds are checked\
- `f_` : scaling parameter controlling the decline of KsatVer [mm-1] (fitted with numpy linalg regression), bounds are checked\
https://doi.org/10.5194/soil-2020-65
The following soil parameter maps are calculated:
- `thetaS` : average saturated soil water content [m3/m3]
- `thetaR` : average residual water content [m3/m3]
- `KsatVer` : vertical saturated hydraulic conductivity at soil surface [mm/day]
- `SoilThickness` : soil thickness [mm]
- `SoilMinThickness` : minimum soil thickness [mm] (equal to SoilThickness)
- `M` : model parameter [mm] that controls exponential decline of KsatVer with soil depth
(fitted with curve_fit (scipy.optimize)), bounds of M are checked
- `M_` : model parameter [mm] that controls exponential decline of KsatVer with soil depth
(fitted with numpy linalg regression), bounds of `M_`are checked
- `M_original` : `M` without checking bounds
- `M_original_` : `M_`without checking bounds
- `f` : scaling parameter controlling the decline of KsatVer [mm-1] (fitted with curve_fit (scipy.optimize)), bounds are checked
- `f_` : scaling parameter controlling the decline of KsatVer [mm-1] (fitted with numpy linalg regression), bounds are checked
- `c_0` : Brooks Corey coefficient [-] based on pore size distribution index at depth
1st soil layer (100 mm) wflow_sbm\
- `c_1` : idem `c_0` at depth 2nd soil layer (400 mm) wflow_sbm\
- `c_2` : idem `c_0` at depth 3rd soil layer (1200 mm) wflow_sbm\
- `c_3` : idem `c_0` at depth 4th soil layer (> 1200 mm) wflow_sbm\
- `KsatVer_[z]cm` : KsatVer [mm/day] at soil depths [z] of SoilGrids data [0.0, 5.0, 15.0, 30.0, 60.0, 100.0, 200.0]\
- `wflow_soil` : USDA Soil texture based on percentage clay, silt, sand mapping: [1:Clay, 2:Silty Clay, 3:Silty Clay-Loam, 4:Sandy Clay, 5:Sandy Clay-Loam, 6:Clay-Loam, 7:Silt, 8:Silt-Loam, 9:Loam, 10:Sand, 11: Loamy Sand, 12:Sandy Loam]\
1st soil layer (100 mm) wflow_sbm
- `c_1` : idem `c_0` at depth 2nd soil layer (400 mm) wflow_sbm
- `c_2` : idem `c_0` at depth 3rd soil layer (1200 mm) wflow_sbm
- `c_3` : idem `c_0` at depth 4th soil layer (> 1200 mm) wflow_sbm
- `KsatVer_[z]cm` : KsatVer [mm/day] at soil depths [z] of SoilGrids data [0.0, 5.0, 15.0, 30.0, 60.0, 100.0, 200.0]
- `wflow_soil` : USDA Soil texture based on percentage clay, silt, sand mapping: [1:Clay, 2:Silty Clay, 3:Silty Clay-Loam, 4:Sandy Clay, 5:Sandy Clay-Loam, 6:Clay-Loam, 7:Silt, 8:Silt-Loam, 9:Loam, 10:Sand, 11: Loamy Sand, 12:Sandy Loam]
Parameters
----------
ds : xarray.Dataset
Expand Down Expand Up @@ -548,16 +549,17 @@ def soilgrids(ds, ds_like, ptfKsatVer, soil_fn, logger=logger):

def soilgrids_sediment(ds, ds_like, usleK_method, logger=logger):
"""
Returns soil parameter maps for sediment modelling at model resolution based on soil
Returns soil parameter maps for sediment modelling at model resolution based on soil
properties from SoilGrids dataset.
The following soil parameter maps are calculated:\
- PercentClay: clay content of the topsoil [%]\
- PercentSilt: silt content of the topsoil [%]\
- PercentOC: organic carbon in the topsoil [%]\
- ErosK: mean detachability of the soil (Morgan et al., 1998) [g/J]\
- USLE_K: soil erodibility factor from the USLE equation [-]\
The following soil parameter maps are calculated:
- PercentClay: clay content of the topsoil [%]
- PercentSilt: silt content of the topsoil [%]
- PercentOC: organic carbon in the topsoil [%]
- ErosK: mean detachability of the soil (Morgan et al., 1998) [g/J]
- USLE_K: soil erodibility factor from the USLE equation [-]
Parameters
----------
ds : xarray.Dataset
Expand Down
Loading

0 comments on commit ff9e2c9

Please sign in to comment.