Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
78748e8
Update version.py
rubencalje Feb 12, 2026
33561dd
fix TypeError (#548)
OnnoEbbens Feb 18, 2026
fe90caa
Add `download_kadaster_percelen`
rubencalje Feb 20, 2026
b8c4624
add hatch_layers function to cross sections
ArtesiaWater Feb 24, 2026
b778fdb
add hatch_layers to tests
dbrakenhoff Mar 4, 2026
033fc60
Update pyproject.toml
rubencalje Mar 11, 2026
ee3d729
Merge pull request #552 from gwmod/remove_ecmwflibs
rubencalje Mar 17, 2026
324e7c9
fix #549 (#550)
dbrakenhoff Mar 17, 2026
344b5ba
Merge pull request #551 from gwmod/hatch_layers
dbrakenhoff Mar 18, 2026
81b0783
Improve tests and notebooks (#553)
rubencalje Mar 18, 2026
f059036
add new methods for geulen (#556)
OnnoEbbens May 11, 2026
e02fba9
fix error for rotated grids (#559)
OnnoEbbens May 11, 2026
3e9e31c
Update waterboard.py
rubencalje May 13, 2026
e0494e6
Improve checking of ds type (structured or vertex)
dbrakenhoff Jun 30, 2026
c15d4f7
Merge pull request #561 from gwmod/fix-ds-type-checks
dbrakenhoff Jun 30, 2026
37c3770
added 'na_filter=False' to read_csv in read_gleg in nlmod.read.regis.py
vincentpost Jul 5, 2026
f5e62b3
Merge pull request #563 from vincentpost/dev
rubencalje Jul 6, 2026
136d901
Remove the call to `pd.Timedelta` in the arguments of `calculate_gxg`
rubencalje Jul 6, 2026
48669f6
Add HFB package builder from dataframes (#565)
bdestombe Jul 9, 2026
b73eb5f
Enhance aggregate_by_weighted_mean_to_ds to accept custom top and bot…
dbrakenhoff Jul 9, 2026
4a52736
add support for getting budget data for a specific package using e.g…
dbrakenhoff Jul 9, 2026
6fa9c5c
Add new and improved facet_plot
dbrakenhoff Jul 9, 2026
25b3ef8
Add method to build mf6 observation file from dataframe with x, y, z …
dbrakenhoff Jul 9, 2026
bc56b5c
improve surface water
dbrakenhoff Jul 9, 2026
c6ec1eb
allow passing in custom idomain in kwargs for dis packages
dbrakenhoff Jul 9, 2026
026d368
improve plotting hfb
dbrakenhoff Jul 9, 2026
95f534b
allow passing fixed_cell to evt and rch packages
dbrakenhoff Jul 9, 2026
731de3b
set transport to 1
dbrakenhoff Jul 9, 2026
36f893a
convert pathlib objects to str prior to writing dataset
dbrakenhoff Jul 9, 2026
1c07cbb
rname modlfow repo
dbrakenhoff Jul 9, 2026
c84df72
add extra info to the error message
dbrakenhoff Jul 9, 2026
06afbfa
ruff
dbrakenhoff Jul 9, 2026
7db6dc2
more ruff
dbrakenhoff Jul 9, 2026
7a97cce
ruff notebooks
dbrakenhoff Jul 9, 2026
dc4e2ac
update ruff
dbrakenhoff Jul 9, 2026
698e911
ruff again
dbrakenhoff Jul 9, 2026
0230330
Merge pull request #566 from gwmod/ruff-and-small-fixes
dbrakenhoff Jul 21, 2026
77a6ed2
add docstring
dbrakenhoff Jul 21, 2026
d24cc77
Merge pull request #568 from gwmod/build-mf6-obs-file-from-df
dbrakenhoff Jul 21, 2026
b1af0ab
Merge pull request #569 from gwmod/new-facet-plot
dbrakenhoff Jul 21, 2026
db5c1fc
Merge pull request #570 from gwmod/get-budget-for-specific-package
dbrakenhoff Jul 21, 2026
12c66a1
Merge pull request #572 from gwmod/improve-aggregte-y-weighted-mean
dbrakenhoff Jul 21, 2026
bea73db
disable nhi gwo test
dbrakenhoff Jul 21, 2026
54a7fff
avoid floating point adjustments, try to make them in project code
dbrakenhoff Jul 21, 2026
d82974f
Merge pull request #567 from gwmod/small-fixes-surface-water
dbrakenhoff Jul 21, 2026
3380ef6
add gwfgwf exchange func
dbrakenhoff Jul 21, 2026
ad02671
add example notebook
dbrakenhoff Jul 21, 2026
4d3fb6b
update example
dbrakenhoff Jul 22, 2026
cb82094
Add read LGN
dbrakenhoff Jul 22, 2026
7df7b93
fix isosurface bug for numpy method when data array has time dimension
dbrakenhoff Jul 22, 2026
c3a1afb
add optional dependencies for lgn gridding
dbrakenhoff Jul 22, 2026
8319327
fix for check_da_dims_coords
dbrakenhoff Jul 22, 2026
90f1bfc
speed up area computation using numba
dbrakenhoff Jul 22, 2026
1231d48
some facet plot improvements
dbrakenhoff Jul 22, 2026
b2cfd29
allow missing layer definitions in combine_layers:
dbrakenhoff Jul 22, 2026
1b8d2ff
Merge pull request #584 from gwmod/fix-isosurface-numpy
dbrakenhoff Jul 22, 2026
73cdd08
small error msg fix, column len_estimate is not guaranteed to be in c…
dbrakenhoff Jul 22, 2026
25a731a
comments onno
dbrakenhoff Aug 27, 2026
1efdb06
fix heading in example nb
dbrakenhoff Aug 27, 2026
0ab3a62
Improve lake gwt (#562)
rubencalje Aug 27, 2026
f5b2642
Fix polygons_from_ds when a vertex grid is rotated (#590)
rubencalje Aug 27, 2026
5137946
some improvements (mostly docstrings)
dbrakenhoff Aug 27, 2026
666cd00
Merge pull request #581 from gwmod/gwfgwf-exchange-and-nested-example
dbrakenhoff Aug 27, 2026
d217f06
Merge pull request #586 from gwmod/speed-up-area-computation-for-vert…
dbrakenhoff Aug 27, 2026
a6329f7
Merge pull request #587 from gwmod/speed-up-facet-plot
dbrakenhoff Aug 27, 2026
f486cea
implement suggestion Onno:
dbrakenhoff Aug 27, 2026
01a1fd8
Merge pull request #588 from gwmod/improve-combine-layers
dbrakenhoff Aug 27, 2026
dd0330c
address codacy
dbrakenhoff Aug 27, 2026
a7e220d
address codacy
dbrakenhoff Aug 27, 2026
6ae5839
Merge pull request #585 from gwmod/lgn
dbrakenhoff Aug 27, 2026
70cc083
add ruff lint step
dbrakenhoff Aug 27, 2026
54ec301
up req python
dbrakenhoff Aug 27, 2026
c374d9c
ruff all the things
dbrakenhoff Aug 27, 2026
5fa5cfe
ruff tests
dbrakenhoff Aug 27, 2026
2e29da1
fix tests
dbrakenhoff Aug 28, 2026
b052541
ruff
dbrakenhoff Aug 28, 2026
9ab0962
ruff format
dbrakenhoff Aug 28, 2026
20ea023
Merge pull request #592 from gwmod/update-ci
dbrakenhoff Aug 28, 2026
069ab97
Improve obs package
dbrakenhoff Sep 11, 2026
fbb6196
add cdist to exchange
dbrakenhoff Sep 11, 2026
a38bd95
rename epsg to crs (#596)
OnnoEbbens Sep 14, 2026
f589667
Epsg to crs (#597)
OnnoEbbens Sep 14, 2026
53263c1
Fix crs of buidrain data (#598)
rubencalje Sep 21, 2026
4ab7778
Raises minimal version of affine-package
rubencalje Sep 29, 2026
514be12
Fix inverted HYDCHR scaling for partially penetrated HFB layers (#576)
bdestombe Oct 22, 2026
5925652
Aggregate lake pieces per cell in lake_from_gdf, like RIV/DRN celldat…
bdestombe Oct 22, 2026
8c51459
Fix length column in gdf_to_grid for line features (#603)
rmz-oz Nov 6, 2026
31037f2
Fix nlmod.gwf.rch where recharge is a variable with only dimension ti…
rubencalje Nov 6, 2026
15501e1
second attempt: allow users to customize output control options (#606)
vincentpost Nov 9, 2026
3630e2a
Merge pull request #593 from gwmod/obs-improvements
dbrakenhoff Nov 9, 2026
7e2a692
Merge pull request #594 from gwmod/add-cdist-to-gwfgwf-exch
dbrakenhoff Nov 9, 2026
efef5b2
ruff
dbrakenhoff Nov 9, 2026
40ff0b7
version to 0.12.0
dbrakenhoff Nov 9, 2026
9bade5a
fix flopy dependency
dbrakenhoff Nov 9, 2026
931f401
typo
dbrakenhoff Nov 9, 2026
8b28f4c
fix test
dbrakenhoff Nov 9, 2026
1a4d579
Remove use of inplace in pandas dataframes
rubencalje Nov 9, 2026
2ae5085
fix examples
dbrakenhoff Nov 9, 2026
586d601
set logger default name to nlmod to only color nlmod output.
dbrakenhoff Nov 10, 2026
cfe2840
some minor improvements to notebooks
dbrakenhoff Nov 10, 2026
f00ba85
ruff
dbrakenhoff Nov 10, 2026
451ab20
Fix bofek (#602)
TomHottentot Nov 10, 2026
dc6bd56
Make save_flows optional in gwf.py
rubencalje Nov 10, 2026
2e36d06
Add method `set_model_ws`
rubencalje Nov 10, 2026
bb5235d
Update waterboard-data
rubencalje Nov 10, 2026
f23a2c0
Add hourly_precision=True to docs
rubencalje Nov 11, 2026
2b705d1
Add hourly_precision=True to tests
rubencalje Nov 11, 2026
afe57a6
Ruff tests\test_005_external_data.py
rubencalje Nov 11, 2026
d19263e
Add hourly_precision=True to nlmod.read.knmi.discretize_knmi
rubencalje Nov 11, 2026
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
16 changes: 5 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
python-version: [3.11, 3.12]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -39,13 +39,7 @@ jobs:

- name: Run tests only
env:
NHI_GWO_USERNAME: ${{ secrets.NHI_GWO_USERNAME}}
NHI_GWO_PASSWORD: ${{ secrets.NHI_GWO_PASSWORD}}
NHI_GWO_USERNAME: ${{ secrets.NHI_GWO_USERNAME}}
NHI_GWO_PASSWORD: ${{ secrets.NHI_GWO_PASSWORD}}
run: |
py.test ./tests -m "not notebooks"

- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
38 changes: 38 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Lint

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Install uv with Python
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d
with:
enable-cache: true
python-version: 3.13

- name: Install the project
run: uv sync --extra lint

- name: ruff-lint
run: uv run ruff check

- name: ruff-format
run: uv run ruff format --check
34 changes: 17 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build setuptools wheel

- name: build binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
- name: build binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
18 changes: 11 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,18 @@ nlmod/bin/*
!nlmod/bin/mp7_2_002_provisional
nlmod/data/bofek/*

tests/data/*
!tests/data/**/
tests/data/mfoutput/*
!tests/data/mfoutput/vertex/*
!tests/data/mfoutput/structured/*

docs/examples/*/
!docs/examples/data/
!docs/examples/data/chloride_hbossche.nc

docs/data_sources/*
docs/data_sources/*

docs/advanced_stress_packages/01_lake/
docs/advanced_stress_packages/model17/

# Notebook-generated model directories (named like notebook stems, e.g. 01_lake)
docs/advanced_stress_packages/[0-9][0-9]_*/
docs/data_sources/[0-9][0-9]_*/
docs/examples/[0-9][0-9]_*/
docs/utilities/[0-9][0-9]_*/
docs/workflows/[0-9][0-9]_*/
3 changes: 1 addition & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-lts-latest
tools:
python: "3.11"
python: "3.12"

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand All @@ -26,4 +26,3 @@ python:
extra_requirements:
- nbtest
- rtd

102 changes: 90 additions & 12 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,91 @@
/* --- Make pandas DataFrames scrollable --- */
.dataframe {
max-width: 100%; /* Prevent table from exceeding container width */
display: block; /* Enables scrolling */
overflow-x: auto; /* Horizontal scroll for wide tables */
}

/* make text smaller so more fits */
.dataframe td,
.dataframe th {
font-size: 0.7em;
padding: 0.3em 0.5em;
/* ---------------------------------------------
Documentation-style pandas dataframe tables
Compatible with Sphinx RTD theme + MyST-NB
--------------------------------------------- */

table.dataframe {
border-collapse: collapse;
border: none;
display: block;
overflow-x: auto;
max-width: 100%;
font-size: 0.7em;
margin-top: 0.4em;
margin-bottom: 0.6em;
}

/* Column headers */
table.dataframe thead th {
text-align: right;
padding: 4px 8px;
font-weight: bold;
border: none;
border-bottom: 2px solid #888; /* single horizontal line */
background: transparent;
white-space: nowrap;
vertical-align: bottom;
line-height: 1.2;
}

/* Remove empty header cells from multi-index (top-left corner) */
table.dataframe thead th:empty {
padding: 0;
border: none;
}

/* Index columns */
table.dataframe tbody th {
text-align: right;
padding: 4px 8px;
font-weight: bold;
border: none; /* remove all vertical borders */
white-space: nowrap;
line-height: 1.2;
}

/* Only the rightmost index column gets the vertical line */
table.dataframe tbody th:last-of-type {
border-right: 1px solid #bbb;
}

/* Data cells */
table.dataframe td {
text-align: right;
padding: 4px 8px;
border: none;
line-height: 1.2;
}

/* Zebra striping */
table.dataframe tbody tr:nth-child(odd) {
background-color: #f5f5f5;
}

table.dataframe tbody tr:nth-child(even) {
background-color: transparent;
}

/* Hover highlight */
table.dataframe tbody tr:hover {
background-color: #dcdcdc;
}

/* Multi-index column headers: only bottom row gets horizontal line */
table.dataframe thead tr:not(:last-child) th {
border-bottom: none;
}
table.dataframe thead tr:last-child th {
border-bottom: 2px solid #888;
}

/* Notebook-like output container */
div.output_area table.dataframe {
display: block;
overflow-x: auto;
max-width: 100%;
}

/* Space around notebook outputs */
div.output_area {
padding: 0.35em 0;
}
43 changes: 22 additions & 21 deletions docs/advanced_stress_packages/01_lake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
"outputs": [],
"source": [
"import os\n",
"\n",
"import flopy\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import xarray as xr\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib\n",
"import flopy\n",
"\n",
"import nlmod"
]
},
Expand Down Expand Up @@ -120,9 +122,9 @@
")\n",
"\n",
"bgt = nlmod.gwf.surface_water.add_min_ahn_to_gdf(bgt, ahn, buffer=5.0)\n",
"bgt[\"summer_stage\"] = bgt[[\"summer_stage\", \"ahn_min\"]].max(1)\n",
"bgt[\"winter_stage\"] = bgt[[\"winter_stage\", \"ahn_min\"]].max(1)\n",
"bgt[\"stage\"] = bgt[[\"summer_stage\", \"winter_stage\"]].mean(1)\n",
"bgt[\"summer_stage\"] = bgt[[\"summer_stage\", \"ahn_min\"]].max(axis=1)\n",
"bgt[\"winter_stage\"] = bgt[[\"winter_stage\", \"ahn_min\"]].max(axis=1)\n",
"bgt[\"stage\"] = bgt[[\"summer_stage\", \"winter_stage\"]].mean(axis=1)\n",
"\n",
"bgt[\"lake\"] = None\n",
"henschotermeer = bgt.area.idxmax() # 'W0662.ce4627405cb242ee8533946265644bb3'\n",
Expand Down Expand Up @@ -282,9 +284,9 @@
"ims = nlmod.sim.ims(\n",
" sim,\n",
" complexity=\"COMPLEX\",\n",
" inner_dvclose=0.01, # needed so lake balance is correct\n",
" outer_dvclose=0.01, # needed so lake balance is correct\n",
" #rcloserecord=[0.01, \"STRICT\"],\n",
" inner_dvclose=0.01, # needed so lake balance is correct\n",
" outer_dvclose=0.01, # needed so lake balance is correct\n",
" # rcloserecord=[0.01, \"STRICT\"],\n",
") # ims solver\n",
"gwf = nlmod.gwf.gwf(ds, sim, under_relaxation=True) # groundwater flow model\n",
"dis = nlmod.gwf.dis(ds, gwf) # spatial discretization\n",
Expand Down Expand Up @@ -328,7 +330,7 @@
"metadata": {},
"outputs": [],
"source": [
"# %% \n",
"# %%\n",
"lak_resistance = 10.0 # days\n",
"lak_grid[\"clake\"] = lak_resistance\n",
"lak_grid[\"strt\"] = 6.0\n",
Expand All @@ -341,8 +343,8 @@
" rainfall=ds[\"recharge\"].to_pandas().iloc[:, 0],\n",
" evaporation=ds[\"evaporation\"].to_pandas().iloc[:, 0] * 1.25,\n",
" boundname_column=\"lake\",\n",
" #maximum_stage_change=0.000001,\n",
" #maximum_iterations=200,\n",
" # maximum_stage_change=0.000001,\n",
" # maximum_iterations=200,\n",
");"
]
},
Expand Down Expand Up @@ -404,7 +406,7 @@
"source": [
"head = nlmod.gwf.get_heads_da(ds)\n",
"ax = nlmod.plot.map_array(head.sel(layer=\"BXz2\").mean(\"time\"), ds=ds)\n",
"bgt.plot(edgecolor='k', facecolor='none', ax=ax);"
"bgt.plot(edgecolor=\"k\", facecolor=\"none\", ax=ax);"
]
},
{
Expand All @@ -424,10 +426,10 @@
"outputs": [],
"source": [
"lak_stage = pd.read_csv(os.path.join(ds.model_ws, \"lak_STAGE.csv\"), index_col=0)\n",
"lak_stage.index = pd.to_datetime(ds.time.start) + pd.to_timedelta(lak_stage.index, \"d\")\n",
"lak_stage.index = pd.to_datetime(ds.time.start) + pd.to_timedelta(lak_stage.index, \"D\")\n",
"lak_stage.columns = [x.capitalize() for x in lak_stage.columns]\n",
"\n",
"f, ax = plt.subplots(figsize=(10, 6), layout=\"constrained\")\n",
"f, ax = plt.subplots(figsize=(10, 3), layout=\"constrained\")\n",
"lak_stage.plot(ax=ax)\n",
"ax.set_xlabel(\"\")\n",
"ax.set_ylabel(\"lake stage (m MSL)\")\n",
Expand Down Expand Up @@ -463,11 +465,10 @@
"def plot_lake_in_cs(linestring, dcs, height, ax, color=\"C0\", zorder=0):\n",
" xy = (dcs.line.project(linestring.boundary.geoms[0]), dcs.zmin)\n",
" width = dcs.line.project(linestring.boundary.geoms[1]) - xy[0]\n",
" rect = matplotlib.patches.Rectangle(\n",
" xy, width, height, color=color, zorder=zorder\n",
" )\n",
" rect = matplotlib.patches.Rectangle(xy, width, height, color=color, zorder=zorder)\n",
" ax.add_patch(rect)\n",
"\n",
"\n",
"# plot the lake\n",
"for lake in bgt.loc[~bgt.lake.isna(), \"lake\"].unique():\n",
" mean_lake_stage = lak_stage[lake].mean()\n",
Expand Down Expand Up @@ -532,7 +533,7 @@
" for key in lake_bgt.keys():\n",
" data[key] = [x[x[\"node\"] == lakeno + 1][\"q\"].sum() for x in lake_bgt[key]]\n",
"\n",
" index = pd.to_datetime(ds.time.start) + pd.to_timedelta(cbf_lak.get_times(), \"d\")\n",
" index = pd.to_datetime(ds.time.start) + pd.to_timedelta(cbf_lak.get_times(), \"D\")\n",
" df = pd.DataFrame(data, index=index)\n",
"\n",
" f, ax = plt.subplots(figsize=(10, 6), layout=\"constrained\")\n",
Expand All @@ -547,7 +548,7 @@
" outflow = df_block.where(df_block < 0, 0.0)\n",
" outflow = outflow.loc[:, ~(outflow == 0).all()]\n",
"\n",
" ymax = max(inflow.sum(1).max(), outflow.sum(1).max())\n",
" ymax = max(inflow.sum(axis=1).max(), outflow.sum(axis=1).max())\n",
"\n",
" inflow.plot.area(color=colors, ax=ax, linewidth=0)\n",
" handles_in, labels_in = ax.get_legend_handles_labels()\n",
Expand All @@ -569,7 +570,7 @@
" index = labels.index(\"STORAGE\")\n",
" handles.append(handles.pop(index))\n",
" labels.append(labels.pop(index))\n",
" for handle, label in zip(handles_all, labels_all):\n",
" for handle, label in zip(handles_all, labels_all, strict=False):\n",
" if label not in labels:\n",
" handles.append(handle)\n",
" labels.append(label)\n",
Expand Down
Loading
Loading