Skip to content

Improve lake and other stuff#383

Merged
rubencalje merged 20 commits intodevfrom
improve_lake_and_other_stuff
Nov 13, 2024
Merged

Improve lake and other stuff#383
rubencalje merged 20 commits intodevfrom
improve_lake_and_other_stuff

Conversation

@rubencalje
Copy link
Collaborator

@rubencalje rubencalje commented Nov 5, 2024

This PR changes and improves the lake_from_gdf method. The boolean recharge parameter is removed, and replaced by a rainfalll and evaporation parameter. A new method is introduced, called cut_meteorological_data_from_ds, that takes the values of rainfall and evraporation from the model dataset, and returns a pandas DataFrame, with values in time for each of the lakes. This method sets the recharge and evaporation variables in ds at the location of the lakes to 0. By doing this in a separate method, the user has more control in when this is done (before writing the RCH and EVT packages), and he can optionally change the rainfall and evaporation values before passing them to `lake_from_gdf'.

Another improvement is that the lakeno variable does not have to be supplied anymore. lake_from_gdf will calculate the lakeno variable based on the boundname-column in the geodataframe. In outlets, the user can now pass a boundary name, to what other lake the outlet is supplying water to. This makes the code more readable. So instead of:

lakes.loc[lakes['name'] == "grotegracht", "lakeno"] = 0
lakes.loc[lakes['name'] == "oudehaven", "lakeno"] = 1
lakes.loc[lakes['name'] == "oudehaven", "lakeout"] = 0

The user now just uses the names specified in the boundname-column ("name") for lakeout:
lakes.loc[lakes['name'] == "oudehaven", "lakeout"] = "grotegracht"

Also, support is added for a lake transport model (lkt) when a groundwater transport model (gwt) is supplied.

Some of the other changes are:

  • Added the get_icell2d_from_xy mhod, which calculates the icell2d number from a x and y coordinate.
  • Added some optional arguments for reading the budget-files, so we can read lake-budget files as well.
  • Replaced tight_layout by layout="constrained" in get_map.
  • numpy is also set to version 1.26.4 for readthedocs
  • fixed the download of AHN (also for rioxarray version 0.18.0)

Copy link
Collaborator

@dbrakenhoff dbrakenhoff left a comment

Choose a reason for hiding this comment

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

Looks good, some comments about the lake package from Ruben and my conversation:

  • Currently the lake package has to be created before the RCH pkg because the creation of the lake package modifies the recharge/rainfall/evaporation at locations with lakes. This is somewhat sneaky and perhaps not so obvious?
  • Would it make sense to pass "recharge", in which case positive recharge is rainfall and negative recharge is evaporation, OR pass both "rainfall" and "evaporation" separately? Currently recharge has something of a double meaning in the lake_from_gdf function.
  • ...

@rubencalje
Copy link
Collaborator Author

Looks good, some comments about the lake package from Ruben and my conversation:

  • Currently the lake package has to be created before the RCH pkg because the creation of the lake package modifies the recharge/rainfall/evaporation at locations with lakes. This is somewhat sneaky and perhaps not so obvious?
  • Would it make sense to pass "recharge", in which case positive recharge is rainfall and negative recharge is evaporation, OR pass both "rainfall" and "evaporation" separately? Currently recharge has something of a double meaning in the lake_from_gdf function.
  • ...

I make some breaking (!) changes, so the user needs to get the values of rainfall and evaporation from the model dataset before running lake_from_gdf . See my comment at the top of this PR for more information.

"name": ["lake_0", "lake_0", "lake_1"],
"strt": [1.0, 1.0, 2.0],
"clake": [10.0, 10.0, 10.0],
"INFLOW": ["inflow", "inflow", None],
Copy link
Collaborator

Choose a reason for hiding this comment

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

all caps?

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, right now these options (like INFLOW) need to be all caps in nlmod. This is probably because in the manual of MODFLOW 6 these settings are also displayed in caps (I do not think MODFLOW 6 cares if it is in caps or not):

image

@rubencalje rubencalje merged commit 0d5b6e5 into dev Nov 13, 2024
@rubencalje rubencalje deleted the improve_lake_and_other_stuff branch January 16, 2025 09:45
@OnnoEbbens OnnoEbbens mentioned this pull request Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants