diff --git a/.gitignore b/.gitignore index 5edf9e93..9772658e 100644 --- a/.gitignore +++ b/.gitignore @@ -156,3 +156,5 @@ tests/data/mfoutput/* docs/examples/*/ !docs/examples/data/ !docs/examples/data/chloride_hbossche.nc + +docs/data_sources/* \ No newline at end of file diff --git a/docs/examples/09_schoonhoven.ipynb b/docs/examples/09_schoonhoven.ipynb index fe0778f2..12049fad 100644 --- a/docs/examples/09_schoonhoven.ipynb +++ b/docs/examples/09_schoonhoven.ipynb @@ -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)" @@ -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, diff --git a/docs/utilities/13_plot_methods.ipynb b/docs/utilities/13_plot_methods.ipynb index 0f0515a7..7f2fdd5f 100644 --- a/docs/utilities/13_plot_methods.ipynb +++ b/docs/utilities/13_plot_methods.ipynb @@ -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", @@ -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", @@ -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", @@ -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, diff --git a/docs/workflows/03_aggregating_surface_water.ipynb b/docs/workflows/03_aggregating_surface_water.ipynb index 9908bcc3..bedefdee 100644 --- a/docs/workflows/03_aggregating_surface_water.ipynb +++ b/docs/workflows/03_aggregating_surface_water.ipynb @@ -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)" @@ -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, diff --git a/nlmod/plot/dcs.py b/nlmod/plot/dcs.py index bb2624ba..5f65614b 100644 --- a/nlmod/plot/dcs.py +++ b/nlmod/plot/dcs.py @@ -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 @@ -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 @@ -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 = {} @@ -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 @@ -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)