Deltares / hydromt_wflow

Wflow plugin for HydroMT
https://deltares.github.io/hydromt_wflow/
GNU General Public License v3.0
15 stars 13 forks source link

HydroMT-Wflow (version 0.4.1) requires 7 layers of soilgrids for each soil parameter #244

Closed RomeijnN closed 6 months ago

RomeijnN commented 6 months ago

HydroMT-Wflow version checks

Reproducible Example

not applicable

Current behaviour

When building a wflow-model with HydroMT-Wflow (version 0.4.1), HydroMT-Wflow requires seven layers of soilgrids for each soil parameter, while only 6 layers can be downloaded from ISRIC Soilgrid data. As an example, I am providing the following layers for clay content: clay_0-5cm_mean.tif (clyppt_sl1), clay_5_15cm_mean.tif (clyppt_sl2), clay_15_30cm_mean.tif (clyppt_sl3), clay_30_60cm_mean.tif (clyppt_sl4), clay_60_100cm_mean.tif (clyppt_sl5) and clay_100_200cm.tif (clyppt_sl6). HydroMT-Wflow asks for a seventh layer (clyppt_sl7). However, only 6 layers can be downloaded from ISRIC Soilgrid data. The same holds for the other soil parameters, like sand content, silt content etc.

Desired behaviour

HydroMT-Wflow should be able to work with 6 layers of soilgrids

Additional context

No response

JoostBuitink commented 6 months ago

Thanks for reporting this issue. I guess it is related to the different versions of SoilGrids. There is a slight difference in how the data is provided in SoilGrids (2017) and SoilGrids 2.0 (2020), in terms of the number of layers. In order to use the data from SoilGrids 2.0, it is important that the soil_fn argument is set to soilgrids_2020. When using this name, the workflows no longer assume 7 layers but 6 layers. This is a bit hidden in the code unfortunately, and can probably be better documented.

You can see some brief descriptions here:

https://github.com/Deltares/hydromt_wflow/blob/c2074330ea28fae65bd4f184e4c9bf8405cbf117/hydromt_wflow/wflow.py#L1815-L1826

https://github.com/Deltares/hydromt_wflow/blob/c2074330ea28fae65bd4f184e4c9bf8405cbf117/hydromt_wflow/workflows/soilgrids.py#L290-L293

So in short, if you would rename your soil dataset to soilgrids_2020, and call that dataset in the setup_soilmaps function, it should work!

RomeijnN commented 6 months ago

Thanks for the reply! This solves the problem indeed.