Skip to content

Commit

Permalink
Add 13_plot_methods.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencalje committed Oct 30, 2022
1 parent 2072cb8 commit e454fbf
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 122 deletions.
40 changes: 18 additions & 22 deletions docs/examples/09_schoonhoven.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@
"from nlmod.visualise.netcdf import DatasetCrossSection\n",
"from rasterstats import zonal_stats\n",
"from shapely.geometry import LineString, Point\n",
"import warnings\n",
"from shapely.errors import ShapelyDeprecationWarning\n",
"\n",
"warnings.filterwarnings(\"ignore\", category=ShapelyDeprecationWarning)\n",
"\n",
"# set the log-level to INFO, so more information is shown (compared to the default setting of WARNING)\n",
"logging.basicConfig(level=logging.INFO)\n"
"logging.basicConfig(level=logging.INFO)"
]
},
{
Expand Down Expand Up @@ -157,7 +161,7 @@
"metadata": {},
"outputs": [],
"source": [
"pg = nlmod.gwf.surface_water.download_level_areas(bgt, extent=extent)\n"
"pg = nlmod.gwf.surface_water.download_level_areas(bgt, extent=extent)"
]
},
{
Expand All @@ -179,7 +183,7 @@
"f, ax = nlmod.plot.get_map(extent)\n",
"bgt.plot(color=\"k\", ax=ax)\n",
"for wb in pg:\n",
" pg[wb].plot(\"summer_stage\", ax=ax, vmin=-3, vmax=1, zorder=0)\n"
" pg[wb].plot(\"summer_stage\", ax=ax, vmin=-3, vmax=1, zorder=0)"
]
},
{
Expand Down Expand Up @@ -221,7 +225,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)\n"
"nlmod.plot.colorbar_inside(norm=norm, cmap=cmap)"
]
},
{
Expand All @@ -241,7 +245,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)\n"
"nlmod.plot.colorbar_inside(norm=norm, cmap=cmap)"
]
},
{
Expand All @@ -261,7 +265,7 @@
"outputs": [],
"source": [
"regis = nlmod.read.get_regis(extent, cachedir=cachedir, cachename=\"regis.nc\")\n",
"regis\n"
"regis"
]
},
{
Expand All @@ -280,7 +284,7 @@
"outputs": [],
"source": [
"ds = nlmod.to_model_ds(regis, model_name, model_ws, delr=100.0, delc=100.0)\n",
"ds\n"
"ds"
]
},
{
Expand Down Expand Up @@ -416,7 +420,7 @@
"bgt_grid[\"cond\"] = bgt_grid.area / bed_resistance\n",
"mask = bgt_grid[\"bronhouder\"] == \"L0002\"\n",
"lek = bgt_grid[mask]\n",
"bgt_grid = bgt_grid[~mask]\n"
"bgt_grid = bgt_grid[~mask]"
]
},
{
Expand Down Expand Up @@ -520,7 +524,7 @@
"cbar = nlmod.plot.colorbar_inside(pc)\n",
"for label in cbar.ax.yaxis.get_ticklabels():\n",
" label.set_bbox(dict(facecolor=\"w\", alpha=0.5))\n",
"bgt.plot(ax=ax, edgecolor=\"k\", facecolor=\"none\")\n"
"bgt.plot(ax=ax, edgecolor=\"k\", facecolor=\"none\")"
]
},
{
Expand Down Expand Up @@ -550,7 +554,7 @@
" label.set_bbox(dict(facecolor=\"w\", alpha=0.5))\n",
"dcs.plot_grid()\n",
"dcs.plot_layers(alpha=0.0, min_label_area=1000)\n",
"f.tight_layout(pad=0.0)\n"
"f.tight_layout(pad=0.0)"
]
},
{
Expand All @@ -577,7 +581,7 @@
" head_point = head.interp(x=x, y=y, method=\"nearest\")\n",
"# only keep layers that are active at this location\n",
"head_point = head_point[:, ~head_point.isnull().all(\"time\")]\n",
"head_point.plot.line(hue=\"layer\", size=(10));\n"
"head_point.plot.line(hue=\"layer\", size=10);"
]
},
{
Expand Down Expand Up @@ -617,7 +621,7 @@
" ha=\"center\",\n",
" va=\"top\",\n",
" transform=ax.transAxes,\n",
" )\n"
" )"
]
},
{
Expand Down Expand Up @@ -687,7 +691,7 @@
" pf = pdata[pdata['particleid']==pid]\n",
" ax.plot(pf['x'],pf['y'], color=\"k\", linewidth=0.5)\n",
"ax.plot(pf['x'],pf['y'], color=\"k\", linewidth=0.5, label='pathline')\n",
"bgt.plot(ax=ax, edgecolor=\"blue\", facecolor=\"none\");\n"
"bgt.plot(ax=ax, edgecolor=\"blue\", facecolor=\"none\");"
]
},
{
Expand All @@ -713,16 +717,8 @@
"dcs.plot_grid()\n",
"# add labels with layer names\n",
"dcs.plot_layers(alpha=0.0, min_label_area=1000)\n",
"f.tight_layout(pad=0.0)\n"
"f.tight_layout(pad=0.0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "008d54c3-3ef7-4766-8447-b7837943db6e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
26 changes: 13 additions & 13 deletions docs/examples/10_modpath.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"sim = flopy.mf6.MFSimulation.load(\n",
" \"mfsim.nam\", sim_ws=model_ws, exe_name=exe_name\n",
")\n",
"gwf = sim.get_model(model_name=model_name)\n"
"gwf = sim.get_model(model_name=model_name)"
]
},
{
Expand Down Expand Up @@ -131,7 +131,7 @@
"pg = nlmod.modpath.pg_from_fdt(nodes)\n",
"\n",
"# create the modpath simulation file\n",
"mpsim = nlmod.modpath.sim(mpf, pg, \"backward\", gwf=gwf)\n"
"mpsim = nlmod.modpath.sim(mpf, pg, \"backward\", gwf=gwf)"
]
},
{
Expand Down Expand Up @@ -178,7 +178,7 @@
" color=\"red\",\n",
")\n",
"ax.set_title(f\"pathlines\")\n",
"ax.legend()\n"
"ax.legend()"
]
},
{
Expand All @@ -200,7 +200,7 @@
"ax.set_ylabel(\"distance [m]\")\n",
"ax.set_xlabel(\"time [year]\")\n",
"ax.set_title(\"distance travelled per particle\")\n",
"ax.grid()\n"
"ax.grid()"
]
},
{
Expand Down Expand Up @@ -233,7 +233,7 @@
"pg = nlmod.modpath.pg_from_fdt(nodes)\n",
"\n",
"# create the modpath simulation file\n",
"mpsim = nlmod.modpath.sim(mpf, pg, \"forward\")\n"
"mpsim = nlmod.modpath.sim(mpf, pg, \"forward\")"
]
},
{
Expand Down Expand Up @@ -288,7 +288,7 @@
" ax.set_ylim(498700, 499300)\n",
" elif i == 2:\n",
" ax.set_xlim(101200, 101700)\n",
" ax.set_ylim(496300, 496700)\n"
" ax.set_ylim(496300, 496700)"
]
},
{
Expand All @@ -310,7 +310,7 @@
"ax.set_ylabel(\"distance [m]\")\n",
"ax.set_xlabel(\"time [year]\")\n",
"ax.set_title(\"distance travelled per particle\")\n",
"ax.grid()\n"
"ax.grid()"
]
},
{
Expand Down Expand Up @@ -348,7 +348,7 @@
"pg = nlmod.modpath.pg_from_pd(nodes, localx=0.5, localy=0.5, localz=0.5)\n",
"\n",
"# create the modpath simulation file\n",
"mpsim = nlmod.modpath.sim(mpf, pg, \"backward\", gwf=gwf)\n"
"mpsim = nlmod.modpath.sim(mpf, pg, \"backward\", gwf=gwf)"
]
},
{
Expand Down Expand Up @@ -404,7 +404,7 @@
" ax.set_ylim(498300, 499300)\n",
" elif i == 2:\n",
" ax.set_xlim(101000, 102000)\n",
" ax.set_ylim(496300, 497300)\n"
" ax.set_ylim(496300, 497300)"
]
},
{
Expand All @@ -427,7 +427,7 @@
"ax.set_ylabel(\"distance [m]\")\n",
"ax.set_xlabel(\"time [year]\")\n",
"ax.set_title(\"distance travelled per particle\")\n",
"ax.grid()\n"
"ax.grid()"
]
},
{
Expand Down Expand Up @@ -458,7 +458,7 @@
"pg = nlmod.modpath.pg_from_pd(nodes, localx=0.5, localy=0.5, localz=0.5)\n",
"\n",
"# create the modpath simulation file\n",
"mpsim = nlmod.modpath.sim(mpf, pg, \"forward\", gwf=gwf, stoptime=10 * 365)\n"
"mpsim = nlmod.modpath.sim(mpf, pg, \"forward\", gwf=gwf, stoptime=10 * 365)"
]
},
{
Expand Down Expand Up @@ -513,7 +513,7 @@
" ax.set_ylim(498300, 499300)\n",
" elif i == 2:\n",
" ax.set_xlim(101000, 102000)\n",
" ax.set_ylim(496300, 497300)\n"
" ax.set_ylim(496300, 497300)"
]
},
{
Expand All @@ -536,7 +536,7 @@
"ax.set_ylabel(\"distance [m]\")\n",
"ax.set_xlabel(\"time [year]\")\n",
"ax.set_title(\"distance travelled per particle\")\n",
"ax.grid()\n"
"ax.grid()"
]
}
],
Expand Down
Loading

0 comments on commit e454fbf

Please sign in to comment.