Skip to content

Commit

Permalink
Merge pull request #385 from gwmod/dev
Browse files Browse the repository at this point in the history
Release v0.9.0
  • Loading branch information
OnnoEbbens authored Nov 26, 2024
2 parents 383f420 + 4e84913 commit 8f50b55
Show file tree
Hide file tree
Showing 56 changed files with 4,434 additions and 556 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 O.N. Ebbens, D.A. Brakenhoff, R. Calje
Copyright (c) 2024 O.N. Ebbens, D.A. Brakenhoff, R. Calje

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ Install the module with pip:
* `bottleneck`

There are some optional dependecies, only needed (and imported) in a single method.
Examples of this are `geocube` (used in
add_min_ahn_to_gdf), `h5netcdf` (used for hdf5 files backend in xarray), `scikit-image`
(used in calculate_sea_coverage). To install `nlmod` with the optional dependencies use:
Examples of this are `geocube`, `rasterstats` (both used in nlmod.util.zonal_statistics),
`h5netcdf` (used for hdf5 files backend in xarray), `scikit-image`
(used in nlmod.read.rws.calculate_sea_coverage).
To install `nlmod` with the optional dependencies use:

`pip install nlmod[full]`

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# -- Project information -----------------------------------------------------

project = "nlmod"
copyright = "2021, O.N. Ebbens, D.A. Brakenhoff, R. Caljé"
copyright = "2024, O.N. Ebbens, D.A. Brakenhoff, R. Caljé"
author = "O.N. Ebbens, D.A. Brakenhoff, R. Caljé"

# The short X.Y version
Expand Down
2 changes: 1 addition & 1 deletion 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, identifier=\"AHN4_DTM_5m\")\n",
" ahn = nlmod.read.ahn.get_ahn4(extent)\n",
" ahn.rio.to_raster(fname_ahn)\n",
"ahn = rioxarray.open_rasterio(fname_ahn, mask_and_scale=True)[0]"
]
Expand Down
18 changes: 0 additions & 18 deletions docs/examples/04_modifying_layermodels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -263,24 +263,6 @@
"split_reindexer"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The new layers are named according to the REGIS codes, with an added number if the layer was split into multiple sub-layers. For plotting a cross-section we want to use the original color from the REGIS cross-section plot for the new sub-layers."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for j, i in split_reindexer.items():\n",
" if j not in colors:\n",
" colors[j] = colors[i]"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
43 changes: 22 additions & 21 deletions docs/examples/09_schoonhoven.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"norm = matplotlib.colors.Normalize(vmin=-3, vmax=1)\n",
"cmap = \"viridis\"\n",
"bgt.plot(\"summer_stage\", ax=ax, norm=norm, cmap=cmap)\n",
"nlmod.plot.colorbar_inside(norm=norm, cmap=cmap)"
"nlmod.plot.colorbar_inside(norm=norm, cmap=cmap);"
]
},
{
Expand All @@ -139,7 +139,7 @@
"source": [
"f, ax = nlmod.plot.get_map(extent)\n",
"bgt.plot(\"ahn_min\", ax=ax, norm=norm, cmap=cmap)\n",
"nlmod.plot.colorbar_inside(norm=norm, cmap=cmap)"
"nlmod.plot.colorbar_inside(norm=norm, cmap=cmap);"
]
},
{
Expand Down Expand Up @@ -308,9 +308,7 @@
"source": [
"bed_resistance = 1.0\n",
"\n",
"mg = nlmod.grid.modelgrid_from_ds(ds)\n",
"gi = flopy.utils.GridIntersect(mg, method=\"vertex\")\n",
"bgt_grid = nlmod.grid.gdf_to_grid(bgt, ix=gi).set_index(\"cellid\")\n",
"bgt_grid = nlmod.grid.gdf_to_grid(bgt, ds).set_index(\"cellid\")\n",
"\n",
"bgt_grid[\"cond\"] = bgt_grid.area / bed_resistance\n",
"\n",
Expand All @@ -332,14 +330,17 @@
" \"W0656.cb3c3a25de4141d18c573b561f02e84a\",\n",
"]\n",
"\n",
"mask = bgt_grid[\"identificatie\"].isin(ids_grote_gracht) | bgt_grid[\n",
" \"identificatie\"\n",
"].isin(ids_oude_haven)\n",
"mask = bgt_grid[\"identificatie\"].isin(ids_grote_gracht + ids_oude_haven)\n",
"lakes = bgt_grid[mask].copy()\n",
"lakes[\"name\"] = \"\"\n",
"lakes.loc[lakes[\"identificatie\"].isin(ids_grote_gracht), \"name\"] = \"grotegracht\"\n",
"lakes.loc[lakes[\"identificatie\"].isin(ids_oude_haven), \"name\"] = \"oudehaven\"\n",
"bgt_grid = bgt_grid[~mask]"
"bgt_grid = bgt_grid[~mask]\n",
"\n",
"# cut rainfall and evaporation from model dataset\n",
"lak_rainfall, lak_evaporation = nlmod.gwf.lake.clip_meteorological_data_from_ds(\n",
" lakes, ds, boundname_column=\"name\"\n",
")"
]
},
{
Expand Down Expand Up @@ -400,12 +401,7 @@
"metadata": {},
"outputs": [],
"source": [
"# add specific properties to the lake gdf\n",
"lakes.loc[lakes[\"identificatie\"].isin(ids_grote_gracht), \"lakeno\"] = 0\n",
"lakes.loc[lakes[\"identificatie\"].isin(ids_oude_haven), \"lakeno\"] = 1\n",
"\n",
"# add general properties to the lake gdf\n",
"lakes[\"elev\"] = lakes[\"ahn_min\"] - 0.5\n",
"summer_months = (4, 5, 6, 7, 8, 9)\n",
"if pd.to_datetime(ds.time.start).month in summer_months:\n",
" lakes[\"strt\"] = lakes[\"summer_stage\"]\n",
Expand All @@ -418,13 +414,18 @@
"# lakes.loc[lakes['identificatie'].isin(ids_oude_haven), 'INFLOW'] = 'inflow_lake'\n",
"\n",
"# add outlet to Oude Haven, water flows from Oude Haven to Grote Gracht.\n",
"lakes.loc[lakes[\"identificatie\"].isin(ids_oude_haven), \"lakeout\"] = 0\n",
"lakes.loc[lakes[\"identificatie\"].isin(ids_oude_haven), \"outlet_invert\"] = (\n",
" 1.0 # overstort hoogte\n",
")\n",
"lakes.loc[lakes[\"name\"] == \"oudehaven\", \"lakeout\"] = \"grotegracht\"\n",
"lakes.loc[lakes[\"name\"] == \"oudehaven\", \"outlet_invert\"] = 1.0 # overstort hoogte\n",
"\n",
"# add lake to groundwaterflow model\n",
"lak = nlmod.gwf.lake_from_gdf(gwf, lakes, ds, boundname_column=\"name\")"
"lak = nlmod.gwf.lake_from_gdf(\n",
" gwf,\n",
" lakes,\n",
" ds,\n",
" boundname_column=\"name\",\n",
" rainfall=lak_rainfall,\n",
" evaporation=lak_evaporation,\n",
")"
]
},
{
Expand Down Expand Up @@ -501,7 +502,7 @@
" colorbar_label=\"head [m NAP]\",\n",
" title=\"mean head\",\n",
")\n",
"bgt.dissolve().plot(ax=pc.axes, edgecolor=\"k\", facecolor=\"none\")"
"bgt.dissolve().plot(ax=pc.axes, edgecolor=\"k\", facecolor=\"none\");"
]
},
{
Expand Down Expand Up @@ -784,7 +785,7 @@
"line = ax.add_collection(lc)\n",
"nlmod.plot.colorbar_inside(line, label=\"Travel time (years)\")\n",
"\n",
"bgt.dissolve().plot(ax=ax, edgecolor=\"k\", facecolor=\"none\")"
"bgt.dissolve().plot(ax=ax, edgecolor=\"k\", facecolor=\"none\");"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ potential solutions.

On top of that there are some optional dependecies:

- geocube (used in add_min_ahn_to_gdf)
- geocube (used in nlmod.util.zonal_statistics)
- rasterstats (used in nlmod.util.zonal_statistics)
- h5netcdf (used for the hdf5 backend of xarray)
- scikit-image (used in calculate_sea_coverage)
- scikit-image (used in nlmod.read.rws.calculate_sea_coverage)

These dependencies are only needed (and imported) in a single method or function.
They can be installed using ``pip install nlmod[full]`` or ``pip install -e .[full]``.
Loading

0 comments on commit 8f50b55

Please sign in to comment.