Skip to content

Commit 19e1ce8

Browse files
authored
minor fixes and changes (#530)
* minor fixes and changes * reinstate fix
1 parent ae8c574 commit 19e1ce8

File tree

5 files changed

+75
-14
lines changed

5 files changed

+75
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,5 @@ tests/data/mfoutput/*
156156
docs/examples/*/
157157
!docs/examples/data/
158158
!docs/examples/data/chloride_hbossche.nc
159+
160+
docs/data_sources/*

docs/examples/09_schoonhoven.ipynb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"if not os.path.isfile(fname_bgt):\n",
9494
" raise (\n",
9595
" Exception(\n",
96-
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb first\"\n",
96+
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb in the 'data_sources' directory first\"\n",
9797
" )\n",
9898
" )\n",
9999
"bgt = gpd.read_file(fname_bgt)"
@@ -857,8 +857,22 @@
857857
}
858858
],
859859
"metadata": {
860+
"kernelspec": {
861+
"display_name": "venv",
862+
"language": "python",
863+
"name": "python3"
864+
},
860865
"language_info": {
861-
"name": "python"
866+
"codemirror_mode": {
867+
"name": "ipython",
868+
"version": 3
869+
},
870+
"file_extension": ".py",
871+
"mimetype": "text/x-python",
872+
"name": "python",
873+
"nbconvert_exporter": "python",
874+
"pygments_lexer": "ipython3",
875+
"version": "3.12.10"
862876
}
863877
},
864878
"nbformat": 4,

docs/utilities/13_plot_methods.ipynb

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@
7777
"source": [
7878
"model_name = \"Schoonhoven\"\n",
7979
"model_ws = os.path.join(\"..\", \"data_sources\", \"schoonhoven\")\n",
80-
"ds = xr.open_dataset(os.path.join(model_ws, f\"{model_name}.nc\"))\n",
80+
"fname_nc = os.path.join(model_ws, f\"{model_name}.nc\")\n",
81+
"if not os.path.isfile(fname_nc):\n",
82+
" raise (\n",
83+
" Exception(\n",
84+
" f\"{fname_nc} not found. Please run notebook 09_schoonhoven.ipynb in the 'examples' directory first\"\n",
85+
" )\n",
86+
" )\n",
87+
"ds = xr.open_dataset(fname_nc)\n",
8188
"\n",
8289
"# add calculated heads\n",
8390
"ds[\"head\"] = nlmod.gwf.get_heads_da(ds)\n",
@@ -228,6 +235,7 @@
228235
" cmap(i)\n",
229236
" for i in np.linspace(0, int((len(df) - 1) * cmap.N / len(df)), len(df), dtype=int)\n",
230237
"]\n",
238+
"df['tubecolor'] = 'white'\n",
231239
"gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.x, df.y))\n",
232240
"\n",
233241
"# plot cross section\n",
@@ -241,7 +249,8 @@
241249
" df,\n",
242250
" legend=True,\n",
243251
" max_dist=max_dist,\n",
244-
" filter_kwargs={'alpha':0.5, 'zorder':10},\n",
252+
" filter_patch_kwargs={'alpha':0.5, 'zorder':10},\n",
253+
" filter_rect_kwargs={'alpha':0.5, 'zorder':10},\n",
245254
" tubeline_kwargs={'alpha':0.5},\n",
246255
" legend_kwds={\"loc\": (0, 1), \"frameon\": False, \"ncol\": 7},\n",
247256
")\n",
@@ -359,8 +368,22 @@
359368
}
360369
],
361370
"metadata": {
371+
"kernelspec": {
372+
"display_name": "venv",
373+
"language": "python",
374+
"name": "python3"
375+
},
362376
"language_info": {
363-
"name": "python"
377+
"codemirror_mode": {
378+
"name": "ipython",
379+
"version": 3
380+
},
381+
"file_extension": ".py",
382+
"mimetype": "text/x-python",
383+
"name": "python",
384+
"nbconvert_exporter": "python",
385+
"pygments_lexer": "ipython3",
386+
"version": "3.12.10"
364387
}
365388
},
366389
"nbformat": 4,

docs/workflows/03_aggregating_surface_water.ipynb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"if not os.path.isfile(fname_bgt):\n",
7070
" raise (\n",
7171
" Exception(\n",
72-
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb first\"\n",
72+
" f\"{fname_bgt} not found. Please run notebook 02_surface_water.ipynb in the 'data_sources' directory first\"\n",
7373
" )\n",
7474
" )\n",
7575
"bgt = gpd.read_file(fname_bgt)"
@@ -635,8 +635,22 @@
635635
}
636636
],
637637
"metadata": {
638+
"kernelspec": {
639+
"display_name": "venv",
640+
"language": "python",
641+
"name": "python3"
642+
},
638643
"language_info": {
639-
"name": "python"
644+
"codemirror_mode": {
645+
"name": "ipython",
646+
"version": 3
647+
},
648+
"file_extension": ".py",
649+
"mimetype": "text/x-python",
650+
"name": "python",
651+
"nbconvert_exporter": "python",
652+
"pygments_lexer": "ipython3",
653+
"version": "3.12.10"
640654
}
641655
},
642656
"nbformat": 4,

nlmod/plot/dcs.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,8 @@ def plot_wells(
515515
legend_kwds=None,
516516
max_dist=None,
517517
sort_by_dist=True,
518-
filter_kwargs=None,
518+
filter_patch_kwargs=None,
519+
filter_rect_kwargs=None,
519520
tubeline_kwargs=None,
520521
):
521522
"""plot filter screens in cross section from a DataFrame
@@ -561,9 +562,14 @@ def plot_wells(
561562
by default None
562563
sort_by_dist : bool, optional
563564
if True the values are sorted by distance along the cross section line.
564-
filter_kwargs : None, optional
565+
filter_patch_kwargs : None, optional
565566
additional keyword arguments passed to the PatchCollection of the
566-
filters.
567+
filters. These keyword arguments are typically for how the rectangles
568+
appear in the plot.
569+
filter_rect_kwargs : None, optional
570+
additional keyword arguments passed to the Rectangle shape of the
571+
filters. These keyword arguments are typically for how the rectangles
572+
appear in the legend.
567573
tubeline_kwargs : None, optional
568574
additional keyword arguments passed to the tube line plot.
569575
**kwargs
@@ -625,8 +631,10 @@ def plot_wells(
625631
df[parname] = color
626632

627633
# parse filter and tube kwargs
628-
if filter_kwargs is None:
629-
filter_kwargs = {}
634+
if filter_patch_kwargs is None:
635+
filter_patch_kwargs = {}
636+
if filter_rect_kwargs is None:
637+
filter_rect_kwargs = {}
630638
if tubeline_kwargs is None:
631639
tubeline_kwargs = {}
632640

@@ -676,10 +684,10 @@ def plot_wells(
676684
(left, bottom_left_y),
677685
filter_width,
678686
height,
679-
linewidth=linewidth,
680687
facecolor=row["filtercolor_face"],
681688
edgecolor=row["filtercolor_edge"],
682689
label=name,
690+
**filter_rect_kwargs,
683691
)
684692
rectangles.append(rect)
685693
legend_handles[name] = rect
@@ -689,7 +697,7 @@ def plot_wells(
689697
rectangles,
690698
facecolors=df["filtercolor_face"],
691699
edgecolors=df["filtercolor_edge"],
692-
**filter_kwargs,
700+
**filter_patch_kwargs,
693701
)
694702
self.ax.add_collection(patch_collection)
695703

0 commit comments

Comments
 (0)