Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,5 @@ tests/data/mfoutput/*
docs/examples/*/
!docs/examples/data/
!docs/examples/data/chloride_hbossche.nc

docs/data_sources/*
18 changes: 16 additions & 2 deletions docs/examples/09_schoonhoven.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"if not os.path.isfile(fname_bgt):\n",
" raise (\n",
" Exception(\n",
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb first\"\n",
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb in the 'data_sources' directory first\"\n",
" )\n",
" )\n",
"bgt = gpd.read_file(fname_bgt)"
Expand Down Expand Up @@ -857,8 +857,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"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.10"
}
},
"nbformat": 4,
Expand Down
29 changes: 26 additions & 3 deletions docs/utilities/13_plot_methods.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@
"source": [
"model_name = \"Schoonhoven\"\n",
"model_ws = os.path.join(\"..\", \"data_sources\", \"schoonhoven\")\n",
"ds = xr.open_dataset(os.path.join(model_ws, f\"{model_name}.nc\"))\n",
"fname_nc = os.path.join(model_ws, f\"{model_name}.nc\")\n",
"if not os.path.isfile(fname_nc):\n",
" raise (\n",
" Exception(\n",
" f\"{fname_nc} not found. Please run notebook 09_schoonhoven.ipynb in the 'examples' directory first\"\n",
" )\n",
" )\n",
"ds = xr.open_dataset(fname_nc)\n",
"\n",
"# add calculated heads\n",
"ds[\"head\"] = nlmod.gwf.get_heads_da(ds)\n",
Expand Down Expand Up @@ -228,6 +235,7 @@
" cmap(i)\n",
" for i in np.linspace(0, int((len(df) - 1) * cmap.N / len(df)), len(df), dtype=int)\n",
"]\n",
"df['tubecolor'] = 'white'\n",
"gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.x, df.y))\n",
"\n",
"# plot cross section\n",
Expand All @@ -241,7 +249,8 @@
" df,\n",
" legend=True,\n",
" max_dist=max_dist,\n",
" filter_kwargs={'alpha':0.5, 'zorder':10},\n",
" filter_patch_kwargs={'alpha':0.5, 'zorder':10},\n",
" filter_rect_kwargs={'alpha':0.5, 'zorder':10},\n",
" tubeline_kwargs={'alpha':0.5},\n",
" legend_kwds={\"loc\": (0, 1), \"frameon\": False, \"ncol\": 7},\n",
")\n",
Expand Down Expand Up @@ -359,8 +368,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"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.10"
}
},
"nbformat": 4,
Expand Down
18 changes: 16 additions & 2 deletions docs/workflows/03_aggregating_surface_water.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"if not os.path.isfile(fname_bgt):\n",
" raise (\n",
" Exception(\n",
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb first\"\n",
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb in the 'data_sources' directory first\"\n",
" )\n",
" )\n",
"bgt = gpd.read_file(fname_bgt)"
Expand Down Expand Up @@ -635,8 +635,22 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"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.10"
}
},
"nbformat": 4,
Expand Down
22 changes: 15 additions & 7 deletions nlmod/plot/dcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ def plot_wells(
legend_kwds=None,
max_dist=None,
sort_by_dist=True,
filter_kwargs=None,
filter_patch_kwargs=None,
filter_rect_kwargs=None,
tubeline_kwargs=None,
):
"""plot filter screens in cross section from a DataFrame
Expand Down Expand Up @@ -561,9 +562,14 @@ def plot_wells(
by default None
sort_by_dist : bool, optional
if True the values are sorted by distance along the cross section line.
filter_kwargs : None, optional
filter_patch_kwargs : None, optional
additional keyword arguments passed to the PatchCollection of the
filters.
filters. These keyword arguments are typically for how the rectangles
appear in the plot.
filter_rect_kwargs : None, optional
additional keyword arguments passed to the Rectangle shape of the
filters. These keyword arguments are typically for how the rectangles
appear in the legend.
tubeline_kwargs : None, optional
additional keyword arguments passed to the tube line plot.
**kwargs
Expand Down Expand Up @@ -625,8 +631,10 @@ def plot_wells(
df[parname] = color

# parse filter and tube kwargs
if filter_kwargs is None:
filter_kwargs = {}
if filter_patch_kwargs is None:
filter_patch_kwargs = {}
if filter_rect_kwargs is None:
filter_rect_kwargs = {}
if tubeline_kwargs is None:
tubeline_kwargs = {}

Expand Down Expand Up @@ -676,10 +684,10 @@ def plot_wells(
(left, bottom_left_y),
filter_width,
height,
linewidth=linewidth,
facecolor=row["filtercolor_face"],
edgecolor=row["filtercolor_edge"],
label=name,
**filter_rect_kwargs,
)
rectangles.append(rect)
legend_handles[name] = rect
Expand All @@ -689,7 +697,7 @@ def plot_wells(
rectangles,
facecolors=df["filtercolor_face"],
edgecolors=df["filtercolor_edge"],
**filter_kwargs,
**filter_patch_kwargs,
)
self.ax.add_collection(patch_collection)

Expand Down