Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Water demand #226

Merged
merged 100 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
8358da0
First static demand stuff
dalmijn Nov 28, 2023
a396d35
Scaling of domestic demand; add config stuff
dalmijn Dec 8, 2023
7e4bbcc
Allocation progress
dalmijn Dec 13, 2023
e7c536e
Working allocation
dalmijn Dec 14, 2023
74806a0
Fix in allocation burn
dalmijn Dec 14, 2023
d384e3d
Update docs; mute methods
dalmijn Dec 15, 2023
55e09f3
Make admin level more flexible
dalmijn Dec 20, 2023
aa5a113
Merge branch 'main' into demand
dalmijn Dec 21, 2023
549a28f
Added version for non irigation data
dalmijn Dec 21, 2023
2533bfb
Added extra logic for handling cyclic demand maps
dalmijn Jan 12, 2024
bdf17b6
Merge branch 'main' into demand
dalmijn Jan 15, 2024
a5fc679
first version irrigation maps
JoostBuitink Jan 17, 2024
37f13b4
precommit fix
JoostBuitink Jan 17, 2024
353bcf8
precommit fix; add logging message
JoostBuitink Jan 18, 2024
04d8ee4
add support for crop_factor maps
JoostBuitink Jan 18, 2024
e4c0305
Merge branch 'main' into demand
JoostBuitink Mar 21, 2024
03d89fb
Merge branch 'main' into demand
JoostBuitink Mar 21, 2024
b578d62
include `kvfrac`, updated `c`, and `irrigation_trigger`
JoostBuitink Mar 22, 2024
c908394
Merge branch 'main' into demand
JoostBuitink Mar 22, 2024
6ea8279
separate `irrigation_trigger` for paddy and nonpaddy
JoostBuitink Apr 9, 2024
82adf41
fix cyclic names; add irri_trigger to cyclic
JoostBuitink Apr 9, 2024
1e54efd
remove dependency on `dem_subgrid`
JoostBuitink Apr 15, 2024
695d378
add allocation_areas also to geoms
JoostBuitink Apr 16, 2024
249812b
fix allocation_map name
JoostBuitink Apr 17, 2024
6cd825e
Merge branch 'main' into demand
dalmijn Apr 18, 2024
829aaf2
add example notebook
JoostBuitink Apr 19, 2024
c253e06
remove example files (committed by accident)
JoostBuitink Apr 19, 2024
ec3380f
Comments update
dalmijn Apr 19, 2024
51556cb
Merge branch 'demand' of https://github.com/Deltares/hydromt_wflow in…
dalmijn Apr 19, 2024
bee017b
Updated notebook and yaml
dalmijn Apr 19, 2024
3644316
UTM crs usage
dalmijn Apr 19, 2024
1c97eaf
supercharge 'set_grid'
dalmijn Apr 19, 2024
77ed235
Docstrings
dalmijn Apr 19, 2024
575d333
Updated docs
dalmijn Apr 22, 2024
9472ab6
Added tests based on wflow artifact data
dalmijn Apr 22, 2024
3ead783
Merge branch 'main' into demand
dalmijn Apr 23, 2024
1d7059e
added config flags; add note in example
JoostBuitink Apr 23, 2024
a175dad
Updated notebook with artifact data
dalmijn Apr 23, 2024
98b1fd4
Merge branch 'demand' of https://github.com/Deltares/hydromt_wflow in…
dalmijn Apr 23, 2024
f55c5f6
small api (older) fix
dalmijn Apr 23, 2024
7d0b659
Updated old docstring
dalmijn Apr 23, 2024
0d70610
fix basin model in demand notebook
JoostBuitink Apr 23, 2024
96a1306
update docstrings
JoostBuitink Apr 24, 2024
524d9b3
precommit fixes
JoostBuitink Apr 24, 2024
c5c33cc
added tests for setup_irrigation
JoostBuitink Apr 30, 2024
69cf45b
Merge branch 'main' into demand
dalmijn May 16, 2024
800e997
Adjust int value due to new basins
dalmijn May 16, 2024
51da860
adding support for `alpha_h1` and GLCNMO data
JoostBuitink May 16, 2024
20072fa
add support for paddy related parameters
JoostBuitink May 16, 2024
be5d78a
fix typo
JoostBuitink May 16, 2024
5642d08
fix wflow_sediment tests
JoostBuitink May 16, 2024
7a8e76c
removed entries of some sediment parameters
JoostBuitink May 16, 2024
762f0fd
fix test
JoostBuitink May 16, 2024
89f65a7
revert alpha_h1 and glcnmo changes (move to a new PR)
JoostBuitink May 17, 2024
dcd8d31
Allocation solving based on raster operations; faster
dalmijn May 17, 2024
f895ae3
Merge branch 'demand' of https://github.com/Deltares/hydromt_wflow in…
dalmijn May 17, 2024
7590e3c
Remove redundant line
dalmijn May 17, 2024
49a175f
Update test
dalmijn May 17, 2024
f121e43
Direct vs diagonal check
dalmijn May 21, 2024
bf3b7c8
Adjust test alloc id's
dalmijn May 21, 2024
8602bea
Merge branch 'main' into demand
JoostBuitink May 28, 2024
5241ce6
update example with new landuse dataset
JoostBuitink May 28, 2024
c8edb34
add h_paddy state; docs format fixes
JoostBuitink May 28, 2024
f1598d0
doc format update
JoostBuitink May 28, 2024
a5c6901
add flags for paddy and nonpaddy; separated tests
JoostBuitink May 29, 2024
aa77c25
precommit fixes
JoostBuitink May 29, 2024
d667974
surfrac progress
dalmijn May 31, 2024
f371ed5
Merge branch 'demand' of https://github.com/Deltares/hydromt_wflow in…
dalmijn May 31, 2024
3cf4cc4
Working surfacewater frac method
dalmijn May 31, 2024
d0552a5
fix name to allocation for now
dalmijn May 31, 2024
9708f40
Adding some logging
dalmijn May 31, 2024
aa0509f
logging error fix
dalmijn May 31, 2024
0d36ce6
Surface water frac improvements
dalmijn Jun 3, 2024
e09953e
typo
dalmijn Jun 3, 2024
29222e0
Merge branch 'main' into demand
dalmijn Jun 6, 2024
9f624ca
Merge branch 'main' into demand
dalmijn Jun 7, 2024
57145a7
Merge branch 'main' into demand
dalmijn Jun 7, 2024
b607c98
Merge branch 'main' into demand
dalmijn Jun 7, 2024
04acdd0
Add transform function
dalmijn Jun 10, 2024
0d1cb97
Support local data better for non-irrigation
dalmijn Jun 12, 2024
4d4e737
Updated test with extra arguments
dalmijn Jun 12, 2024
221e20f
Updated with custom full function
dalmijn Jul 3, 2024
f06a89e
Small update docstring
dalmijn Jul 11, 2024
6be61e6
Update examples/update_model_water_demand.ipynb
JoostBuitink Jul 17, 2024
fc9d7df
Update examples/update_model_water_demand.ipynb
JoostBuitink Jul 17, 2024
40a723d
Update examples/update_model_water_demand.ipynb
JoostBuitink Jul 17, 2024
2c65702
update set_grid function
JoostBuitink Jul 18, 2024
7720625
Added extra comments
dalmijn Sep 23, 2024
021f0f5
review of setup_non_irrigation and setup_irrigation
hboisgon Oct 15, 2024
78a602e
Merge branch 'main' into demand
hboisgon Oct 15, 2024
a6182f8
update frac_sw_used
hboisgon Oct 16, 2024
527e2f1
allow to save the merged landuse and paddy map
hboisgon Oct 16, 2024
4f1ac6a
typo
laurenebouaziz Oct 16, 2024
94498e9
update setup_allocation_areas workflow
hboisgon Oct 18, 2024
a9c4283
update changelog
hboisgon Oct 18, 2024
809db48
bugfix tests
hboisgon Oct 18, 2024
59e6bed
Merge branch 'main' into demand
hboisgon Nov 5, 2024
02060ef
merge linux staticmaps
hboisgon Nov 5, 2024
cb9b74e
update api docs
hboisgon Nov 5, 2024
8c3c84d
update review comments
hboisgon Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Setup components
WflowModel.setup_glaciers
WflowModel.setup_lulcmaps
WflowModel.setup_laimaps
WflowModel.setup_allocation
WflowModel.setup_non_irigation
WflowModel.setup_rootzoneclim
WflowModel.setup_soilmaps
WflowModel.setup_outlets
Expand Down Expand Up @@ -238,6 +240,8 @@ Wflow workflows
.. autosummary::
:toctree: _generated

workflows.allocate
workflows.non_irigation
workflows.hydrography
workflows.topography
workflows.river
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.rst
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes from this PR should move to the unreleased section

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Unreleased
Added
-----
- **setup_rivers**: Add river depth based on rivdph columns in river_geom_fn rather than only computed from qbankfull column.
- Added setup for water demand for wflow
- Added setup method **setup_allocation** to **WflowModel**
- Added setup method **setup_non_irigation** to **WflowModel**
- Added workflow functions **allocation** & **non_irigation** for water demand setup

Changed
-------
Expand Down
290 changes: 290 additions & 0 deletions hydromt_wflow/wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import glob
import logging
import os
from itertools import product
from os.path import basename, dirname, isdir, isfile, join
from pathlib import Path
from typing import List, Optional, Union
Expand Down Expand Up @@ -65,6 +66,9 @@ class WflowModel(GridModel):
"glacareas": "wflow_glacierareas",
"glacfracs": "wflow_glacierfrac",
"glacstore": "wflow_glacierstore",
"paddy_area": "paddy_irrigation_areas",
"nonpaddy_area": "nonpaddy_irrigation_areas",
"crop_factor": "crop_factor",
}
_FOLDERS = [
"staticgeoms",
Expand Down Expand Up @@ -2494,6 +2498,292 @@ def setup_rootzoneclim(
# update config
self.set_config("input.vertical.rootingdepth", update_toml_rootingdepth)

def setup_allocation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def setup_allocation(
def setup_allocation_areas(

To match better wflow names. Makes it also clearer for me that you are only preparing areas here not demand or actual allocation data.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

self,
min_area: float | int = 0,
admin_bounds_fn: str = "gadm",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are cleaning this up still for wflow but we do not want to assume a default dataset value anymore, they are just mandatory arguments :) the example from artifact_data can be mentioned in the examples. Which might be good to add here! (update water demands example to showcase the new methods)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!

admin_level: int = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too specific to gadm and people should be able to use their own geometry. I think in the data catalog, it's actually gadm_level1 that you can call so just use this in admin_bounds_fn (in testing / examples).
Possibly you can add **kwargs here to the get_geodataframe method so that a user is able to select a specific layer in their data via the driver_kwargs (if they did not do that in their own data catalog)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

):
"""_summary_.

_extended_summary_

Parameters
----------
min_area : float | int
_description_
admin_bounds_fn : str, optional
_description_, by default "gadm"
admin_level : int, optional
_description_, by default 0
"""
self.logger.info("Preparing water demand allocation map.")
# Will be fixes but for know this is done like this
# TODO fix in the future
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still needed or can be removed?

admin_bounds = None
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
if admin_bounds_fn is not None:
if admin_level is not None:
admin_bounds_fn += f"_level{admin_level}"
admin_bounds = self.data_catalog.get_geodataframe(
admin_bounds_fn,
geom=self.region,
)
# Add this identifier for usage in the workflow
admin_bounds["admin_id"] = range(len(admin_bounds))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be moved to the workflow function then to keep wflow.py clean

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed


# Create the allocation grid
alloc = workflows.demand.allocate(
ds_like=self.grid,
min_area=min_area,
admin_bounds=admin_bounds,
basins=self.geoms["basins"],
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
rivers=self.geoms["rivers"],
)
self.set_grid(alloc)

# Update the settings toml
self.set_config("input.vertical.waterallocation.areas", "Allocation_id")

def setup_non_irigation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def setup_non_irigation(
def setup_non_irrigation_demands(

Almost everywhere irrigation with two rr not irigation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything should have 'rr' now

self,
non_irigation_fn: str = "pcr_globwb",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either None if optional or required argument

Suggested change
non_irigation_fn: str = "pcr_globwb",
non_irigation_fn: Union[str, Path, xr.Dataset],

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

non_irigation_vars: list = ["dom", "ind", "lsk"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify arguments? They are already in the non_irrigation method

Suggested change
non_irigation_vars: list = ["dom", "ind", "lsk"],
variables: list = ["dom", "ind", "lsk"],

Same for below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

non_irigation_year: int = None,
non_irigation_method: str = "nearest",
population_fn: str = "worldpop_2020_constrained",
population_method: str = "sum",
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
):
"""_summary_.

_extended_summary_

hboisgon marked this conversation as resolved.
Show resolved Hide resolved
Parameters
----------
non_irigation_fn : str, optional
_description_, by default "pcr_globwb"
non_irigation_vars : list, optional
_description_, by default ["dom", "ind", "lsk"]
non_irigation_year : int, optional
_description_, by default None
non_irigation_method : str, optional
_description_, by default "nearest"
population_fn : str, optional
_description_, by default "worldpop_2020_constrained"
population_method : str, optional
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
_description_, by default "sum"

Raises
------
ValueError
_description_
"""
self.logger.info("Preparing non irigation demand maps.")
if not all([item in ["dom", "ind", "lsk"] for item in non_irigation_vars]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to keep this, maybe the user wants to use pcrglob for industry and a better dataset for domestic.
And if you do this, why allow the user to update non_irigation_vars?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is possible, this is just a check whether all supplied vars are either 'dom', 'ind', 'lsk' or a combination of them.

raise ValueError("")

# Set flag for cyclic data
_cyclic = False

# Selecting data
if non_irigation_year is None:
non_irigation_year = 2005
non_irigation_raw = self.data_catalog.get_rasterdataset(
non_irigation_fn,
geom=self.region,
buffer=2,
variables=[
f"{var}_{mode}"
for var, mode in product(non_irigation_vars, ["gross", "net"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess gross and net should come from the same dataset. Please document the required variables names in your docstrings that it's actually not dom like in non_irigation_vars but dom_net and dom_gross

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

],
version=non_irigation_year,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So 2005 is not the time_tuple but actually the version selection for the data catalog? Then this is too specific to pcrglobwb in deltares_data catalog. You can specify the version in the source name instead:

non_irigation_fn = {"source": "pcr_globwb", "version": 2005}

Which a user can specify in their yaml config file:

setup_non_irigation:
  non_irigation_fn:
    source: pcr_globwb
    version: 2005

If you do not specify the version, then the first is used as default so I would definitely leave it out from here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allright!

)
if "time" in non_irigation_raw.coords:
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
_cyclic = True
non_irigation_raw["time"] = non_irigation_raw.time.astype("int32")

if _cyclic and self.get_config("input.cyclic") is None:
self.set_config("input.cyclic", [])

# Get population data
pop_raw = self.data_catalog.get_rasterdataset(
population_fn,
geom=self.region,
buffer=2,
).raster.mask_nodata()

# Create static water demand rasters
non_irigation, popu = workflows.demand.non_irigation(
non_irigation_raw,
ds_like=self.grid,
ds_method=non_irigation_method,
popu=pop_raw,
popu_method=population_method,
)
self.set_grid(non_irigation)
self.set_grid(popu)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does wflow need population? It was not in the list of variables mentioned by Willem in the issue.

Copy link
Collaborator Author

@dalmijn dalmijn Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its an extra map, might be useful for some custom processing/ debugging by users


# Update the settings toml with non irigation stuff
for var in non_irigation.data_vars:
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
sname, suffix = var.split("_")
lname = workflows.demand.map_vars[sname]
self.set_config(
f"input.vertical.{lname}.demand_{suffix}",
var,
)

# Also for the fact that these parameters are cyclic
if _cyclic:
self.config["input"]["cyclic"].append(
f"input.vertical.{lname}.demand_{suffix}",
)

def setup_irrigation(
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
hboisgon marked this conversation as resolved.
Show resolved Hide resolved
self,
irrigated_area_fn: str,
landuse_fn: str,
paddy_class: int = 12,
area_threshold: float = 0.6,
crop_irrigated_fn: str = "mirca_irrigated_data",
crop_rainfed_fn: str = "mirca_rainfed_data",
crop_info_fn: str = "mirca_crop_info"
# crop_info_fn: str, TODO, required when adding the support for rootingdepth and
# cropfactor
):
"""
Add required information to simulate irrigation water demand.

The function requires data that contains information about the location of the
irrigated areas (`irrigated_area_fn`). This, combined with a landuse data that
contains a class for paddy (rice) land use (`landuse_fn`), determines which
locations are considered to be paddy irrigation (based on the `paddy_class`),
and which locations are considered to be non-paddy irrigation.

Next, these maps are reprojected to the model resolution, where a threshold
(`area_threshold`) determines when pixels are considered to be classified as
irrigation cells (both paddy and non-paddy). It adds the resulting maps to the
input data.


Adds model layers:

* **paddy_irrigation_areas**: Irrigated (paddy) mask [-]
* **nonpaddy_irrigation_areas**: Irrigated (non-paddy) mask [-]

Parameters
----------
irrigated_area_fn: str
Name of the (gridded) dataset that contains the location of irrigated areas
(as a mask), `irrigated_area` for example
landuse_fn: str
Name of the landuse dataset that contains a classification for paddy/rice,
use `glcnmo` for example
paddy_class: int
Class in the landuse data that is considered as paddy or rice, by default 12
(matching the glcmno landuse data)
area_threshold: float
Fractional area of a (wflow) pixel before it gets classified as an irrigated
pixel, by default 0.6
crop_irrigated_fn: str
Name of dataset that contains information about irrigated crops, by default
"mirca_irrigated_data",
crop_rainfed_fn: str
Name of dataset that contains information about rainfed crops, by default
"mirca_rainfed_data",
crop_info_fn: str
Name of dataframe that contains rootingdepth and cropfactor values for the
rice/paddy crop class"mirca_crop_info"


See Also
--------
workflows.demand.find_paddy
workflows.demand.classify_pixels
"""
self.logger.info("Preparing irrigation maps.")
# Extract irrigated area dataset
irrigated_area = self.data_catalog.get_rasterdataset(
irrigated_area_fn, bbox=self.grid.raster.bounds, buffer=3
)

# Extract landcover dataset (that includes a paddy/rice class)
landuse_da = self.data_catalog.get_rasterdataset(
landuse_fn, bbox=self.grid.raster.bounds, buffer=3
)

# Get paddy and nonpaddy masks
paddy, nonpaddy = workflows.demand.find_paddy(
landuse_da=landuse_da,
irrigated_area=irrigated_area,
paddy_class=paddy_class,
)

# Get paddy and non paddy pixels at model resolution
wflow_paddy = workflows.demand.classify_pixels(
da_crop=paddy,
da_model=self.grid[self._MAPS["basins"]].raster.mask_nodata(),
threshold=area_threshold,
)
wflow_nonpaddy = workflows.demand.classify_pixels(
da_crop=nonpaddy,
da_model=self.grid[self._MAPS["basins"]].raster.mask_nodata(),
threshold=area_threshold,
)

# Add maps to grid
self.set_grid(wflow_paddy, name=self._MAPS["paddy_area"])
self.set_grid(wflow_nonpaddy, name=self._MAPS["nonpaddy_area"])

# Update config
JoostBuitink marked this conversation as resolved.
Show resolved Hide resolved
self.set_config(
"input.vertical.paddy.irrigation_areas", self._MAPS["paddy_area"]
)
self.set_config(
"input.vertical.nonpaddy.irrigation_areas", self._MAPS["nonpaddy_area"]
)

# TODO: Include this support for adjusted crop_factor and rooting depth maps, or
# move to seperate function?
self.logger.info("Preparing crop factor maps.")
crop_rainfed_ds = self.data_catalog.get_rasterdataset(
crop_rainfed_fn,
bbox=self.grid.raster.bounds,
buffer=3,
)
crop_irrigated_ds = self.data_catalog.get_rasterdataset(
crop_irrigated_fn,
bbox=self.grid.raster.bounds,
buffer=3,
)

df = self.data_catalog.get_dataframe(crop_info_fn)
# TODO: Make more flexible
rice_value = df.loc["Rice", "kc_mid"]
hboisgon marked this conversation as resolved.
Show resolved Hide resolved

cropfactor = workflows.demand.add_crop_maps(
ds_rain=crop_rainfed_ds,
ds_irri=crop_irrigated_ds,
paddy_value=rice_value,
mod=self,
default_value=1.0,
map_type="crop_factor",
)

# Add maps to grid and update config
self.set_grid(cropfactor, name=self._MAPS["crop_factor"])
self.set_config("input.vertical.kc", self._MAPS["crop_factor"])

# # TODO: Make more flexible?
# rice_value = df.loc["Rice", "rootingdepth_irrigated"]

# rootingdepth = workflows.demand.add_crop_maps(
# ds_rain=mirca_rain_ds,
# ds_irri=mirca_irri_ds,
# paddy_value=rice_value,
# mod=self,
# default_value=self.grid["RootingDepth"],
# map_type="rootingdepth",
# )

# I/O
def read(self):
"""Read the complete model schematization and configuration from file."""
Expand Down
1 change: 1 addition & 0 deletions hydromt_wflow/workflows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""HydroMT wflow workflows."""

from .basemaps import *
from .demand import *
from .gauges import *
from .glaciers import *
from .landuse import *
Expand Down
Loading