Deltares / hydromt_wflow

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

Is it correct that the soilthickness scaling factor is hardcoded? #274

Closed iacopoff closed 6 months ago

iacopoff commented 6 months ago

HydroMT-Wflow version checks

Reproducible Example

In this line the soilthickness is converted from cm to mm, but I would expect this to be set in the data_catalog.yaml or am I missing some fundametal design choice?

https://github.com/Deltares/hydromt_wflow/blob/7ee62a113bcd5d9e73e33f2d18ee5d1ad09723f1/hydromt_wflow/workflows/soilgrids.py#L577

Current behaviour

hardcoded scaling of soilthickness

Desired behaviour

set scaling of soilthickness in the data_catalog.yaml

Additional context

No response

hboisgon commented 6 months ago

It is a design choice that the input should be soilthickness in cm. See the documentation of the function: https://deltares.github.io/hydromt_wflow/latest/_generated/hydromt_wflow.WflowModel.setup_soilmaps.html#hydromt_wflow.WflowModel.setup_soilmaps

The idea with HydroMT is that many models other than wflow may want to re-use the same data and convetions for their data catalog so we harmonise names and units at the HydroMT catalog level. This can mean that the HydroMT unit is different than a model specific unit. See also: https://deltares.github.io/hydromt/latest/user_guide/data_conventions.html

hboisgon commented 6 months ago

If you are happy with this anwer I will close this issue for now. Else feel free to re-open!

iacopoff commented 6 months ago

The soilgrid's soilthickness is in cm, but wflow requires mm, that's why you have that line where you multiply by 10, correct?. Similarly the soilgrid's bulk density is in cg/cm3, bu wflow requires g/cm3, that's why I am applying a scaling factor from the data_catalog.yaml:

soilgrids:
   data_type: RasterDataset
   path: /soilgrids/{variable}.tif
   driver: raster
   filesystem: local
   crs: 4326
   unit_mult: 
     bd_sl1: 0.01 # cg/cm3 ->  g/cm3
....

I was just curious about this difference, thanks @hboisgon for your explanation.

BTW I am talking about soilgrids 2020 or 2.0, https://www.isric.org/explore/soilgrids/faq-soilgrids