Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
a240440
Add PRT support
dbrakenhoff Dec 24, 2024
fb37bf1
modify _dis(v) pkgs to support Prtdis(v) packages
dbrakenhoff Dec 24, 2024
2d00838
improve docstring
dbrakenhoff Dec 24, 2024
56c2789
allow package_to_nodes to be used without Modpath model
dbrakenhoff Dec 24, 2024
24abb67
import sim submodule
dbrakenhoff Dec 24, 2024
b8d898d
improve solvers
dbrakenhoff Dec 24, 2024
8ca7728
import prt
dbrakenhoff Dec 24, 2024
20cd7ff
add test notebook
dbrakenhoff Dec 24, 2024
f784fa9
save all flows for prt example
dbrakenhoff Dec 24, 2024
73c7c4e
fix gwtdis fname, should be str not tuple
dbrakenhoff Dec 26, 2024
9f4f3eb
Merge branch 'dev' into prt_support
dbrakenhoff Dec 26, 2024
249c4d1
use hashlib instead of dask.base.tokenize
dbrakenhoff Feb 28, 2025
dfbe298
sort data vars
dbrakenhoff Mar 13, 2025
2a438a0
sort coords
dbrakenhoff Mar 14, 2025
af9c62f
codacy
dbrakenhoff Mar 14, 2025
82ffc0e
version bump
rubencalje Mar 18, 2025
a3e41c7
Fix for issue #436
rubencalje Mar 26, 2025
08e70a3
Update regis.get_layer_names() to return pre 2.2.3 names (#433)
bdestombe Mar 26, 2025
60d4438
add option to maken cross section animation with variable heads (#434)
OnnoEbbens Mar 27, 2025
5a7c49e
Change inconsistency_threshold in combine_layers_ds (issue #435)
rubencalje Mar 27, 2025
ee8ef24
Merge branch 'dev' of https://github.com/gwmod/nlmod into dev
rubencalje Mar 27, 2025
b9b8902
pick period with no data in test
dbrakenhoff Mar 27, 2025
af42898
improve get_recharge docstring
dbrakenhoff Mar 27, 2025
5bd22bc
partially available period
dbrakenhoff Mar 27, 2025
e1c632c
test if cache is causing issues?
dbrakenhoff Mar 28, 2025
a14433d
put the cache back
dbrakenhoff Mar 28, 2025
ebcb55f
raise status if request is not ok
dbrakenhoff Mar 28, 2025
6e62235
xfail nhi gwo test
dbrakenhoff Mar 28, 2025
8fdc42a
Calculate grid edges differently in DatasetCrossSection
rubencalje Apr 15, 2025
2f0a923
make sure get_delr and get_delc also work without extent in attributes
rubencalje Apr 15, 2025
354f562
Merge pull request #443 from gwmod/fix_issue_442
dbrakenhoff Apr 15, 2025
12a09e3
remove xfail
dbrakenhoff Apr 15, 2025
95f6b0d
add option to get modellayer from a well screen
OnnoEbbens Apr 17, 2025
b099605
improve plot.data_array for structured grids (#445)
rubencalje Apr 17, 2025
a79c83c
codacy
OnnoEbbens Apr 17, 2025
f437c06
trailing whitespace
OnnoEbbens Apr 17, 2025
d0dc952
comments Davíd
OnnoEbbens Apr 17, 2025
9a5164b
Error is now KeyError with latests hydropandas
dbrakenhoff Apr 17, 2025
4381205
add separation between download and gridding
OnnoEbbens Apr 23, 2025
3d21376
Merge branch 'modellayers_screens' into separate_download
OnnoEbbens Apr 23, 2025
d0f1546
use flopy attribute modelgrid.map_polygons instead of get_vertices fu…
OnnoEbbens Apr 23, 2025
a206dd3
Add extra tests and fix de Lange formulation (#448)
rubencalje Apr 24, 2025
ffc1c6e
Merge pull request #438 from gwmod/fix_slow_test
dbrakenhoff Apr 24, 2025
84c002b
Add tests for layer methods (#450)
rubencalje Apr 28, 2025
7556ed7
fix "bug" in _get_vertex_grid_ds()
dbrakenhoff Apr 28, 2025
ade822f
add `get_node_structured` and `get_node_vertex`
dbrakenhoff Apr 28, 2025
10c4630
Add get_modellayer_indexer
dbrakenhoff Apr 28, 2025
7b80497
add is_rotated as a shared check function
dbrakenhoff Apr 28, 2025
d9d190d
move get_node functions to grid.py and use those in modpath
dbrakenhoff Apr 28, 2025
71a5c51
ruff
dbrakenhoff Apr 28, 2025
6e4b87d
fix bug in map_array
dbrakenhoff Apr 28, 2025
e092804
ruff
dbrakenhoff Apr 28, 2025
0a26a28
more ruff
dbrakenhoff Apr 28, 2025
0e821ca
add observations.py
dbrakenhoff Apr 28, 2025
18f5373
add tests
dbrakenhoff Apr 28, 2025
5ae0fdd
add example notebook for observations
dbrakenhoff Apr 28, 2025
165eae3
add a pickled ObsCollection for the example
dbrakenhoff Apr 28, 2025
ec340b2
update test data for vertex grid (for some reason grid definition was…
dbrakenhoff Apr 28, 2025
bd44ca2
more ruff
dbrakenhoff Apr 28, 2025
de30319
update pickle
dbrakenhoff Apr 29, 2025
1ede4d2
address comments @OnnoEbbens
dbrakenhoff May 1, 2025
0e09709
delete pickle
dbrakenhoff May 1, 2025
e688283
Add option to (not) merge ahn tiles (#431)
rubencalje May 1, 2025
3e5aa7e
fix knmi data platform tests (#453)
martinvonk May 1, 2025
f8c28db
remove output
dbrakenhoff May 1, 2025
449eb6c
add buffer to line in add_xsec_line_and_labels (#454)
martinvonk May 1, 2025
dde06b4
further improvements:
dbrakenhoff May 1, 2025
f24319b
fix error when pts on model boundary
dbrakenhoff May 5, 2025
8390725
Merge pull request #447 from gwmod/modellayers_screens
OnnoEbbens May 6, 2025
3b5ce4a
add caching to waterboard
OnnoEbbens May 6, 2025
45d12b8
allow to call get_recharge without downloading knmi
OnnoEbbens May 6, 2025
6dadbb3
Merge branch 'dev' into separate_download
OnnoEbbens May 6, 2025
5f5e498
fix merge mistake
OnnoEbbens May 6, 2025
83ffa53
fix errors in tests
OnnoEbbens May 6, 2025
bec5938
pleasing codacy
OnnoEbbens May 6, 2025
ee418ec
the endless tail of trailing whitespaces
OnnoEbbens May 6, 2025
9b73f38
Merge pull request #449 from gwmod/separate_download
OnnoEbbens May 6, 2025
81348f1
create, download_, discretize_ and get_ functions in read modules for…
OnnoEbbens May 7, 2025
e1a0666
refactor bofek
OnnoEbbens May 7, 2025
2a5987e
refactor bofek, bro, brp and brt
OnnoEbbens May 7, 2025
335e55c
refactor geotop
OnnoEbbens May 7, 2025
cc815e0
refactor jarkus
OnnoEbbens May 7, 2025
23b474a
some fixes
OnnoEbbens May 8, 2025
27c869c
attributes are kept :)
OnnoEbbens May 8, 2025
c41dfc4
remove valueerror
OnnoEbbens May 8, 2025
86ac966
deprecate line2hfb in favor of line_to_hfb
dbrakenhoff May 14, 2025
d084460
refactor line_to_hfb
dbrakenhoff May 14, 2025
a66bdec
improve get_hfb_spd
dbrakenhoff May 14, 2025
36d8b36
rename to hfb.py
dbrakenhoff May 14, 2025
1705289
remove default value hydchr in polygon_to_hfb
dbrakenhoff May 14, 2025
e7cdb5f
update hfb tests
dbrakenhoff May 14, 2025
6a1f2d4
ruff
dbrakenhoff May 14, 2025
fcb7c6d
add map_points_to_grid
dbrakenhoff May 14, 2025
73b7348
fix syntaxerror
dbrakenhoff May 14, 2025
ae4d725
another silly typo
dbrakenhoff May 14, 2025
93aa508
update tests
dbrakenhoff May 14, 2025
edc26a6
do not use gwf.disv, take everything from modelgrid object
dbrakenhoff May 15, 2025
2e0348d
renamed func
dbrakenhoff May 15, 2025
105cf16
Fix ahn5 (#457)
rubencalje May 15, 2025
bba5304
fixes for dealing with both structured grids/vertex grids
dbrakenhoff May 15, 2025
255fa10
add hfb tests for structured grids
dbrakenhoff May 15, 2025
6781582
Merge pull request #460 from gwmod/improve_hfb
dbrakenhoff May 15, 2025
b52b121
address comments
dbrakenhoff May 15, 2025
09afc5d
add line_to_hfb_buffer method
dbrakenhoff May 15, 2025
57a6348
Merge pull request #462 from gwmod/improve_hfb_more
dbrakenhoff May 15, 2025
e71b8fe
Merge pull request #461 from gwmod/add_map_points_to_grid
dbrakenhoff May 15, 2025
ccebf24
fix: update URL check in _get_ahn_ellipsis to handle None values (#464)
bdestombe May 27, 2025
b4f9884
Merge pull request #413 from gwmod/caching_use_hashlib
dbrakenhoff May 28, 2025
07db241
fix bug in read_bro
OnnoEbbens Jun 2, 2025
38092b4
Merge branch 'dev' of github.com:ArtesiaWater/nlmod into dev
OnnoEbbens Jun 2, 2025
a413ed3
check if 'layer' dimension is in cached dataset
OnnoEbbens Jun 5, 2025
c32a25e
Merge pull request #468 from gwmod/467-error-reading-cache-if-cached-…
OnnoEbbens Jun 6, 2025
50e9820
Merge branch 'dev' into refactor_read_modules
OnnoEbbens Jun 7, 2025
528005c
fix error in get_bathymetry
OnnoEbbens Jun 7, 2025
e3452f0
Merge branch 'dev' into prt_support
dbrakenhoff Jun 10, 2025
385426e
give model output sensible names
ArtesiaWater May 27, 2025
1b07783
support layer in top for get_layer_of_z
ArtesiaWater May 27, 2025
0f77d0b
deal with mpf and ibound as None
dbrakenhoff May 29, 2025
c4b57da
add mini support for unstructured grid
dbrakenhoff May 29, 2025
6648f5f
add support for unstructured grid output
ArtesiaWater Jun 10, 2025
df34bb8
improve DSP and IC pkgs
dbrakenhoff May 29, 2025
898976f
add get_perlen method
dbrakenhoff May 29, 2025
db514c1
docstrings
ArtesiaWater Jun 10, 2025
31f42e5
deal with floating point issues
dbrakenhoff May 29, 2025
78e8e30
ruff/codacy
dbrakenhoff Jun 11, 2025
4962f77
Merge pull request #472 from gwmod/get_perlen
dbrakenhoff Jun 11, 2025
1de44a7
Merge pull request #475 from gwmod/floating_point_issues
dbrakenhoff Jun 11, 2025
40f02f9
improve reading disu, move unstructured check to _get_heads_da
dbrakenhoff Jun 11, 2025
79dd820
add disu tests
dbrakenhoff Jun 11, 2025
b0b6270
Merge pull request #474 from gwmod/disu
dbrakenhoff Jun 11, 2025
2548a67
turn off warning for diffc
dbrakenhoff Jun 11, 2025
831f525
Merge pull request #473 from gwmod/gwt_improvements
dbrakenhoff Jun 11, 2025
9146a97
Merge branch 'dev' into model_output_names
dbrakenhoff Jun 11, 2025
6346a56
update init
OnnoEbbens Jun 12, 2025
02a63ac
refactor knmi and nhi
OnnoEbbens Jun 12, 2025
862e89b
Update all get functions
OnnoEbbens Jun 12, 2025
81f8530
download regis does not exist yet
OnnoEbbens Jun 12, 2025
852844b
update nb to work without flopy prt branch
dbrakenhoff Jun 12, 2025
8173cd4
extend tracking by default
dbrakenhoff Jun 12, 2025
4d58974
add prt to init
dbrakenhoff Jun 12, 2025
b9200de
update prt nb
dbrakenhoff Jun 12, 2025
7fff894
add voronoi example
dbrakenhoff Jun 13, 2025
58e8a67
Merge pull request #471 from gwmod/model_output_names
dbrakenhoff Jun 16, 2025
e21a8e2
comments Davíd and lots of refactoring
OnnoEbbens Jun 16, 2025
dbd9efa
Merge branch 'dev' into refactor_read_modules
OnnoEbbens Jun 16, 2025
c05b42b
fix error get_ahn
OnnoEbbens Jun 16, 2025
172cd5a
ruff
OnnoEbbens Jun 16, 2025
31783d6
Fix HHNK url
dbrakenhoff Jun 16, 2025
6d7a150
fix renaming mistake
OnnoEbbens Jun 16, 2025
d63233f
Modify basic notebook to first download all data
OnnoEbbens Jun 16, 2025
d8069b5
Add intermediate certificate download if config[waterboard][verify] i…
dbrakenhoff Jun 16, 2025
d4140e3
Fix lgr notebook
OnnoEbbens Jun 16, 2025
7283b18
update schoonhoven notebook
OnnoEbbens Jun 16, 2025
47df6c7
Merge pull request #481 from gwmod/fix_hhnk
dbrakenhoff Jun 16, 2025
da6bc84
fix bug in knmi
OnnoEbbens Jun 16, 2025
0abbae2
Refactor read modules (#459)
OnnoEbbens Jun 16, 2025
f5fc021
fix error
OnnoEbbens Jun 17, 2025
9052d6e
Merge branch 'dev' of github.com:ArtesiaWater/nlmod into dev
OnnoEbbens Jun 17, 2025
71024fa
Add weirs of Aa en Maas
rubencalje Jun 17, 2025
4fc672d
Merge branch 'dev' of https://github.com/gwmod/nlmod into dev
rubencalje Jun 17, 2025
27ce837
'return_tiles'-> 'merge_tiles'
OnnoEbbens Jun 17, 2025
361ca5c
Merge branch 'dev' of github.com:ArtesiaWater/nlmod into dev
OnnoEbbens Jun 17, 2025
69219c0
Return a new Dataset from `discretize_buisdrainage()`
rubencalje Jun 18, 2025
66acb3a
Remove bounds from merge_arrays, and use a slice before
rubencalje Jun 18, 2025
41b19f3
Improve error-message
rubencalje Jun 18, 2025
fc2a18f
fix bathymetry 20m
dbrakenhoff Jun 19, 2025
7c70c7f
Merge pull request #484 from gwmod/remove_bounds_to_merge_arrays
dbrakenhoff Jun 19, 2025
b3b26cb
Merge pull request #486 from gwmod/fix_bathymetry_20m
dbrakenhoff Jun 19, 2025
d6846eb
Merge pull request #483 from gwmod/improve_buisdrainage
dbrakenhoff Jun 19, 2025
ba38f89
make get_modellayers_indexer more robust to real-world data
dbrakenhoff Jun 23, 2025
7cf4ec2
add aux to rivdata_from_xy_list
dbrakenhoff Jun 23, 2025
dd08698
Merge pull request #488 from gwmod/make_get_modellayers_indexer_more_…
dbrakenhoff Jun 24, 2025
06fa51d
Merge pull request #487 from gwmod/add_aux_to_rivdata_from_xylist
dbrakenhoff Jun 24, 2025
3748940
fix for disv
martinvonk Jun 24, 2025
a14388f
Merge pull request #398 from gwmod/prt_support
dbrakenhoff Jun 25, 2025
2fc5ea6
mini adjustment to ensure we get the right int in our modpath input
dbrakenhoff Jun 25, 2025
f038401
fix for edge mask with an arbitrary voronoi grid
dbrakenhoff Jun 25, 2025
a4c667e
quick fix for prt mip porosity
martinvonk Jun 25, 2025
49b72fb
Merge pull request #479 from gwmod/voronoi2
ArtesiaWater Jun 26, 2025
a58ec56
Merge pull request #492 from gwmod/modpath_int_reftime
ArtesiaWater Jun 26, 2025
7c6dc27
Mutiple changes (#489)
rubencalje Jul 4, 2025
fe575ac
Solve some issues regarding the documentation
rubencalje Jul 4, 2025
30d9893
Fix small spelling error in warning
rubencalje Jul 4, 2025
f0c6350
Add Path type support to cache function argument checking
bdestombe Jul 7, 2025
690b435
Version bump
rubencalje Jul 14, 2025
42f0e0e
Fix codacy stuff
rubencalje Jul 17, 2025
d83dea8
Make sure `input_dims` is always defined in observations.interpolate_…
rubencalje Jul 17, 2025
12aea00
Remove some deprecated and unneeded lines from docs\examples\08_gis.i…
rubencalje Jul 17, 2025
f55822c
Update README.md
rubencalje Jul 19, 2025
307f84f
Handle comments from @martinvonk
rubencalje Jul 19, 2025
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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# nlmod

<img src="docs/_static/logo_10000_2.png" width="256"/>

[![nlmod](https://github.com/gwmod/nlmod/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/gwmod/nlmod/actions/workflows/ci.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f1797b66e98b42b294bc1c5fc233dbf3)](https://app.codacy.com/gh/gwmod/nlmod/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/f1797b66e98b42b294bc1c5fc233dbf3)](https://app.codacy.com/gh/gwmod/nlmod/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
Expand Down Expand Up @@ -30,6 +28,10 @@ The functions in `nlmod` have four main objectives:
More information can be found on the documentation-website:
https://nlmod.readthedocs.io/.

<p align="center">
<img src="docs/_static/logo_10000_2.png" width="256"/>
</p>

## Installation

Install the module with pip:
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/00_model_from_scratch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@
"ims = nlmod.sim.ims(sim, complexity=\"SIMPLE\")\n",
"gwf = nlmod.gwf.gwf(ds, sim)\n",
"dis = nlmod.gwf.dis(ds, gwf)\n",
"npf = nlmod.gwf.npf(ds, gwf)\n",
"npf = nlmod.gwf.npf(\n",
" ds, gwf, save_flows=True, save_specific_discharge=True, save_saturation=True\n",
")\n",
"ic = nlmod.gwf.ic(ds, gwf, starting_head=1.0)\n",
"oc = nlmod.gwf.oc(ds, gwf, save_head=True)"
]
Expand Down
170 changes: 130 additions & 40 deletions docs/examples/01_basic_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create model\n",
"\n",
"With the code below we create a modflow model with the name 'IJmuiden'. This model has the following properties:\n",
"## Model settings\n",
"\n",
"We create a modflow model with the name 'IJmuiden'. This model has the following properties:\n",
"- an extent that covers part of the Northsea, Noordzeekanaal and the small port city IJmuiden.\n",
"- a structured grid based on the subsurface models [Regis](https://www.dinoloket.nl/regis-ii-het-hydrogeologische-model) and [Geotop](https://www.dinoloket.nl/detaillering-van-de-bovenste-lagen-met-geotop). The Regis layers that are not present within the extent are removed. In this case we use 'MSz1' as the bottom layer of the model. Use `nlmod.read.regis.get_layer_names()` to get all the layer names of Regis. All Regis layers below this layer are not used in the model. Geotop is used to replace the Holocene layer in Regis because there is no kh or kv defined for the Holocene in Regis. Part of the model is in the North sea. Regis and Geotop have no data there. Therefore the Regis and Geotop layers are extrapolated from the shore and the seabed is added using bathymetry data from [Jarkus](https://www.openearth.nl/rws-bathymetry/2018.html).\n",
"- starting heads of 1 in every cell.\n",
"- a structured grid with cells of 100 x 100 m2\n",
"- the model is a steady state model with a single time step.\n",
"- big surface water bodies (Northsea, IJsselmeer, Markermeer, Noordzeekanaal) within the extent are added as a general head boundary. The surface water bodies are obtained from a [shapefile](..\\data\\shapes\\opp_water.shp).\n",
"- surface drainage is added using the Dutch DEM ([ahn](https://www.ahn.nl)) and a default conductance of $1000 m^2/d$\n",
"- recharge is added using data from [knmi](https://www.knmi.nl/nederland-nu/klimatologie/daggegevens) using the following steps:\n",
" 1. Check for each cell which KNMI weather and/or rainfall station is closest.\n",
" 2. Download the data for the stations found in 1. for the model period. For a steady state stress period the average precipitation and evaporation of 8 years before the stress period time is used.\n",
" 3. Combine precipitation and evaporation data from step 2 to create a recharge time series for each cell,\n",
" 4. Add the timeseries to the model dataset and create the recharge package.\n",
"- constant head boundaries are added to the model edges in every layer. The starting head is used as the specified head."
"- starting heads of 1 m NAP in every cell."
]
},
{
Expand All @@ -68,33 +59,116 @@
"delc = 100.0\n",
"steady_state = True\n",
"start_time = \"2015-1-1\"\n",
"add_northsea = True\n",
"starting_head = 1.0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Download data\n",
"\n",
"First, download the data needed for the model from online sources. It is recommended to store a copy somewhere in case the online dataset changes. For this model we download data from these sources:\n",
"- regis (layer model)\n",
"- geotop (layer model)\n",
"- rijkswaterstaat (surface water)\n",
"- jarkus (bathymetry)\n",
"- ahn (digital elevation model)\n",
"- knmi (precipitation and evaporation)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# layer models\n",
"regis_ds = nlmod.read.regis.download_regis(extent, botm_layer=\"MSz1\",\n",
" cachedir=cachedir,\n",
" cachename=\"regis.nc\")\n",
"\n",
"geotop_ds = nlmod.read.geotop.download_geotop(extent,\n",
" cachedir=cachedir,\n",
" cachename=\"geotop.nc\")\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"layer_model = nlmod.read.regis.get_combined_layer_models(\n",
" extent,\n",
" use_regis=True,\n",
" regis_botm_layer=\"MSz1\",\n",
" use_geotop=True,\n",
" cachedir=cachedir,\n",
" cachename=\"combined_layer_ds.nc\",\n",
"# read surface water data\n",
"gdf_surface_water = nlmod.read.rws.get_gdf_surface_water(\n",
" extent=extent, cachedir=cachedir, cachename=\"rws_surface_water.pklz\"\n",
")\n",
"\n",
"# create a model ds by changing grid of layer_model\n",
"# bathymetry\n",
"bathymetry_da = nlmod.read.jarkus.download_bathymetry(extent=extent,\n",
" cachedir=cachedir,\n",
" cachename=\"bathymetry.nc\")\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Digital elevation model\n",
"ahn_da = nlmod.read.ahn.download_ahn(extent, cachedir=cachedir, cachename=\"ahn\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# knmi data\n",
"oc_knmi = nlmod.read.knmi.download_knmi(extent=extent, delr=delr, delc=delc, start='2000-1-1', end='2020-1-1')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create model\n",
"\n",
"Now create the modflow model:\n",
"- Build a layer model using Regis and Geotop. Use MSz1 as the bottom layer; all deeper Regis layers are excluded. Use `nlmod.read.regis.get_layer_names()` to list available layers.\n",
"- Replace the Holocene layer in Regis with Geotop due to missing hydraulic properties.\n",
"- Extend Regis/Geotop layers into the North Sea using shoreline extrapolation and Jarkus bathymetry data.\n",
"- Add large water bodies (e.g. North Sea, IJsselmeer) as general head boundaries.\n",
"- Add surface drainage using the AHN with a conductance of 1000 m²/d.\n",
"- Calculate recharge from precipitation and evaporation time series\n",
"- Add constant head boundaries on all model edges using the starting head."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# create layer model\n",
"layer_model = nlmod.read.regis.add_geotop_to_regis_layers(regis_ds,\n",
" geotop_ds,\n",
" layers=\"HLc\")\n",
"\n",
"# create a dataset from they layer model\n",
"ds = nlmod.to_model_ds(layer_model, model_name, model_ws, delr=delr, delc=delc)\n",
"\n",
"# add time discretisation\n",
"ds = nlmod.time.set_ds_time(ds, start=start_time, steady=steady_state, perlen=365 * 5)\n",
"\n",
"if add_northsea:\n",
" ds = nlmod.read.rws.add_northsea(ds, cachedir=cachedir)"
"# add northsea and bathymetry to modelgrid\n",
"ds.update(nlmod.read.rws.discretize_northsea(ds, gdf=gdf_surface_water))\n",
"ds.update(nlmod.read.jarkus.discretize_bathymetry(ds, bathymetry_da, cachedir=cachedir, cachename=\"bathymetry.nc\"))\n",
"ds = nlmod.dims.add_bathymetry_to_layer_model(ds)"
]
},
{
Expand Down Expand Up @@ -134,16 +208,16 @@
"metadata": {},
"outputs": [],
"source": [
"# voeg grote oppervlaktewaterlichamen toe o.b.v. shapefile\n",
"da_name = \"rws_oppwater\"\n",
"rws_ds = nlmod.read.rws.get_surface_water(\n",
" ds, da_name, cachedir=ds.cachedir, cachename=da_name\n",
"# discretize surface water bodies from geodataframe\n",
"rws_ds = nlmod.read.rws.discretize_surface_water(\n",
" ds, gdf=gdf_surface_water, da_basename=\"rws_oppwater\"\n",
")\n",
"\n",
"# add data to model dataset\n",
"ds.update(rws_ds)\n",
"\n",
"# build ghb package\n",
"ghb = nlmod.gwf.ghb(ds, gwf, bhead=f\"{da_name}_stage\", cond=f\"{da_name}_cond\")"
"ghb = nlmod.gwf.ghb(ds, gwf, bhead=\"rws_oppwater_stage\", cond=\"rws_oppwater_cond\")"
]
},
{
Expand All @@ -152,8 +226,9 @@
"metadata": {},
"outputs": [],
"source": [
"# surface level drain\n",
"ahn_ds = nlmod.read.ahn.get_ahn(ds, cachedir=ds.cachedir, cachename=\"ahn\")\n",
"# discretize ahn\n",
"ahn_ds = nlmod.read.ahn.discretize_ahn(ds, ahn_da)\n",
"\n",
"# add data to model dataset\n",
"ds.update(ahn_ds)\n",
"\n",
Expand All @@ -178,8 +253,9 @@
"metadata": {},
"outputs": [],
"source": [
"# download knmi recharge data\n",
"knmi_ds = nlmod.read.knmi.get_recharge(ds, cachedir=ds.cachedir, cachename=\"recharge\")\n",
"# discretize knmi recharge data\n",
"knmi_ds = nlmod.read.knmi.discretize_knmi(ds, oc_knmi, cachedir=cachedir, cachename=\"recharge\")\n",
"\n",
"# update model dataset\n",
"ds.update(knmi_ds)\n",
"\n",
Expand All @@ -191,7 +267,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"A big part of the model data is stored in the variable `ds` which is an `xarray.Dataset`. The data is shown below."
"Model data is stored in the variable `ds` which is an `xarray.Dataset`."
]
},
{
Expand All @@ -208,10 +284,10 @@
"metadata": {},
"source": [
"## Write and Run\n",
"Now that we've created all the modflow packages we need to write them to modflow files. You always have to write the modflow data to the model workspace before you can run the model. You can write the model files and run the model using the function `nlmod.sim.write_and_run)` as shown below. This function has two additional options:\n",
"Write the model files and run the model using the function `nlmod.sim.write_and_run)` as shown below. This function has two additional options:\n",
"\n",
"1. Write the model dataset to the disk if `write_ds` is `True`. This makes it easier and faster to load model data if you ever need it. \n",
"2. Write a copy of this Jupyter Notebook to the same directory as the modflow files if `nb_path` is the name of this Jupyter Notebook. It can be useful to have a copy of the script that created the modflow files, together with the files. "
"1. Saving the model dataset (`write_ds=True`) for faster future loading.\n",
"2. Saving a copy of the current notebook (nb_path=\"<notebook_name>.ipynb\") alongside the model files."
]
},
{
Expand All @@ -228,7 +304,7 @@
"metadata": {},
"source": [
"## Visualise\n",
"Using the `ds` and `gwf` variables it is quite easy to visualise model data. Below the modelgrid together with the surface water is shown."
"Plot the modelgrid and surface water"
]
},
{
Expand All @@ -245,7 +321,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Data from a model with a structured grid can be easily visualised using the model dataset. Below are some examples:"
"Plot model input data."
]
},
{
Expand All @@ -269,8 +345,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "nlmod2025",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
}
},
"nbformat": 4,
Expand Down
14 changes: 10 additions & 4 deletions docs/examples/02_surface_water.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"source": [
"fname_ahn = os.path.join(cachedir, \"ahn.tif\")\n",
"if not os.path.isfile(fname_ahn):\n",
" ahn = nlmod.read.ahn.get_ahn4(extent)\n",
" ahn = nlmod.read.ahn.download_ahn4(extent)\n",
" ahn.rio.to_raster(fname_ahn)\n",
"ahn = rioxarray.open_rasterio(fname_ahn, mask_and_scale=True)[0]"
]
Expand All @@ -110,7 +110,7 @@
"metadata": {},
"outputs": [],
"source": [
"bgt = nlmod.read.bgt.get_bgt(extent)"
"bgt = nlmod.read.bgt.download_bgt(extent)"
]
},
{
Expand Down Expand Up @@ -337,7 +337,7 @@
"outputs": [],
"source": [
"# layer model\n",
"layer_model = nlmod.read.get_regis(\n",
"layer_model = nlmod.read.download_regis(\n",
" extent, cachedir=cachedir, cachename=\"layer_model.nc\"\n",
")\n",
"layer_model"
Expand Down Expand Up @@ -797,8 +797,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "nlmod2025",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"name": "python",
"version": "3.12.9"
}
},
"nbformat": 4,
Expand Down
Loading