Skip to content
Open
1 change: 1 addition & 0 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
with:
path: ~/.local/bin
github_token: ${{ secrets.GITHUB_TOKEN }}
repo: modflow6
- name: Modflow version
shell: bash -l {0}
run: mf6 --version
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ on:

jobs:
build:
name: ${{ matrix.python-version }}, ${{ matrix.os }}
name: ${{ matrix.env }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: ['3.12']
env:
- installation/environment.yml
- ci/pandas2_env.yml

steps:
- name: Checkout source
Expand All @@ -31,7 +33,7 @@ jobs:
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@main
with:
environment-file: installation/environment.yml
environment-file: ${{ matrix.env }}
cache-environment: false
cache-downloads: false
# persist on the same day.
Expand All @@ -51,6 +53,8 @@ jobs:
with:
path: ~/.local/bin
github_token: ${{ secrets.GITHUB_TOKEN }}
repo: modflow6
cache: false
- name: Modflow version
shell: bash -l {0}
run: mf6 --version
Expand All @@ -75,6 +79,6 @@ jobs:
- name: Run tests
shell: bash -l {0}
run: |
pytest tests/test_notebooks.py -v
pytest tests/test_notebooks.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion AGENDA.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ Monday
- 1500-1515: break
- 1515-1545: 08 Modflow-setup demo (Andy)
- 1545-1600: break
- 1600-1630: 09 Run and process MF6T (Kalle)
- 1600-1630: 09 Run and process MF6 GWT (Kalle)
- 1630-1700: 10 Run and process MODPATH/MF6-PRT models (Andy)
- 1700: Wrap up
52 changes: 52 additions & 0 deletions ci/pandas2_env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: pyclass
channels:
- conda-forge
- nodefaults
dependencies:
# required
- python=3.14
- pip

- numpy
- matplotlib

- jupyter
- jupytext
- jupyterlab
- git
- python-dateutil
- affine
- scipy
- openpyxl
- xlrd
- pandas<3
- netcdf4
- pyshp
- rasterio
- rasterstats
- fiona
- descartes
- pyproj
- shapely
- geos
- geojson
- geopandas
- xarray
- rioxarray
- uxarray
- pyyaml
- rtree
- pyvista
- vtk
- imageio
- requests
- pytest
- statsmodels
- dataretrieval
- flopy=3.9
- gis-utils
- sfrmaker
- contextily
- cartopy
- modflow-export
- modflow-setup
2 changes: 1 addition & 1 deletion docs/docs-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
# required
- python=3.11
- python=3.14
- pip

- numpy
Expand Down
4 changes: 2 additions & 2 deletions installation/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- scipy
- openpyxl
- xlrd
- pandas<3.0
- pandas
- netcdf4
- pyshp
- rasterio
Expand All @@ -43,7 +43,7 @@ dependencies:
- pytest
- statsmodels
- dataretrieval
- flopy>=3.7
- flopy=3.9
- gis-utils
- sfrmaker
- contextily
Expand Down
65 changes: 16 additions & 49 deletions notebooks/part1_flopy/03_Loading_and_visualizing_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,6 @@
"ax.set_ylabel(f'{modelgrid.units.capitalize()} northing, {modelgrid.crs.name}')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exporting the model grid to a shapefile"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"modelgrid.write_shapefile(str(output_folder / 'pleasant_grid.shp'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -213,41 +197,15 @@
"outputs": [],
"source": [
"modelgrid = model.modelgrid\n",
"modelgrid_gdf = modelgrid.geo_dataframe"
"modelgrid_gdf = modelgrid.geo_dataframe\n",
"modelgrid_gdf"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Add row, column information to model grid `GeoDataFrame`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"modelgrid.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"modelgrid_gdf.index[-1] // modelgrid.ncol"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"1 // modelgrid.ncol"
"### Exporting the model grid to a shapefile"
]
},
{
Expand All @@ -256,9 +214,7 @@
"metadata": {},
"outputs": [],
"source": [
"modelgrid_gdf['i'] = modelgrid_gdf.index // modelgrid.ncol\n",
"modelgrid_gdf['j'] = modelgrid_gdf.index % modelgrid.ncol\n",
"modelgrid_gdf.head()"
"modelgrid_gdf.to_file(output_folder / 'pleasant_grid.shp')"
]
},
{
Expand Down Expand Up @@ -1100,13 +1056,24 @@
"fig, ax = plt.subplots(figsize=(10, 5))\n",
"in_cols = ['STO-SS_IN', 'STO-SY_IN', 'WEL_IN', 'RCHA_IN', 'CHD_IN', 'SFR_IN', 'LAK_IN']\n",
"out_cols = [c.replace('_IN', '_OUT') for c in in_cols]\n",
"# as of pandas 3.0.1, \n",
"# the datatime index of the flux dataframe produced by Flopy produces an error with .plot.bar();\n",
"# switch the index to a categorical (date string) index instead\n",
"flux.index = flux.index.strftime('%Y-%m-%d')\n",
"flux[in_cols].plot.bar(stacked=True, ax=ax)\n",
"(-flux[out_cols]).plot.bar(stacked=True, ax=ax)\n",
"ax.legend(loc='lower left', bbox_to_anchor=(1, 0))\n",
"ax.axhline(0, lw=0.5, c='k')\n",
"ax.set_ylabel('Simulated Flux, in $m^3/d$')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -1142,7 +1109,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.11"
"version": "3.14.3"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion notebooks/part1_flopy/04_Modelgrid_and_intersection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@
"outputs": [],
"source": [
"main_stem = []\n",
"gx = GridIntersect(modelgrid, method=\"vertex\")\n",
"gx = GridIntersect(modelgrid)\n",
"for iloc, row in flw_main.iterrows():\n",
" results = gx.intersect(row.geometry)\n",
" main_stem.extend(results.cellids)\n",
Expand Down
18 changes: 9 additions & 9 deletions notebooks/part1_flopy/05_Unstructured_Grid_generation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
"metadata": {},
"outputs": [],
"source": [
"ix = GridIntersect(sgrid, method=\"vertex\")\n",
"ix = GridIntersect(sgrid)\n",
"result = ix.intersect(basindf.geometry.values[0], contains_centroid=True)\n",
"rowcol = result[\"cellids\"]"
]
Expand Down Expand Up @@ -550,7 +550,7 @@
"outputs": [],
"source": [
"rowcols = []\n",
"ix = GridIntersect(sgrid, method=\"vertex\")\n",
"ix = GridIntersect(sgrid)\n",
"for geom in nhddf.geometry.values:\n",
" rcs = ix.intersects(geom)[\"cellids\"]\n",
" rowcols.extend(list(rcs))"
Expand Down Expand Up @@ -673,7 +673,7 @@
"metadata": {},
"outputs": [],
"source": [
"ix = GridIntersect(rfgrid, method=\"vertex\")\n",
"ix = GridIntersect(rfgrid)\n",
"result = ix.intersect(basindf.geometry.values[0], contains_centroid=True)\n",
"rowcol = result[\"cellids\"]\n",
"\n",
Expand Down Expand Up @@ -849,7 +849,7 @@
"# live code this/give it as an activity\n",
"idomainp = np.ones(sgrid.idomain.shape, dtype=int)\n",
"\n",
"gix = GridIntersect(sgrid, method=\"vertex\")\n",
"gix = GridIntersect(sgrid)\n",
"result = gix.intersect(lgr_gdf.geometry.values[0])\n",
"cid = result[\"cellids\"]\n",
"\n",
Expand Down Expand Up @@ -959,7 +959,7 @@
"metadata": {},
"outputs": [],
"source": [
"ix = GridIntersect(childgrid, method=\"vertex\")\n",
"ix = GridIntersect(childgrid)\n",
"cstrmcells = []\n",
"for geom in nhddf.geometry.values:\n",
" rcs = ix.intersects(geom)[\"cellids\"]\n",
Expand Down Expand Up @@ -1120,7 +1120,7 @@
"source": [
"# create the idomain array\n",
"idomain = np.zeros(quadgrid.shape, dtype=int)\n",
"ix = GridIntersect(quadgrid, method=\"vertex\")\n",
"ix = GridIntersect(quadgrid)\n",
"nodes = ix.intersect(basindf.geometry.values[0], contains_centroid=True)[\"cellids\"]\n",
"\n",
"idomain[:, list(nodes)] = 1\n",
Expand All @@ -1136,7 +1136,7 @@
"source": [
"# create an array of stream cells\n",
"qstr = []\n",
"ix = GridIntersect(quadgrid, method=\"vertex\")\n",
"ix = GridIntersect(quadgrid)\n",
"for geom in nhddf.geometry.values:\n",
" nodes = ix.intersects(geom)[\"cellids\"]\n",
" qstr.extend(list(nodes))"
Expand Down Expand Up @@ -1383,7 +1383,7 @@
"outputs": [],
"source": [
"tristr = []\n",
"ix = GridIntersect(trigrid, method=\"vertex\")\n",
"ix = GridIntersect(trigrid)\n",
"for geom in nhddf.geometry.values:\n",
" nodes = ix.intersects(geom)[\"cellids\"]\n",
" tristr.extend(list(nodes))\n",
Expand Down Expand Up @@ -1519,7 +1519,7 @@
"outputs": [],
"source": [
"vorst = []\n",
"ix = GridIntersect(vorgrid, method=\"vertex\")\n",
"ix = GridIntersect(vorgrid)\n",
"for geom in nhddf.geometry.values:\n",
" nodes = ix.intersects(geom)[\"cellids\"]\n",
" vorst.extend(list(nodes))\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/part1_flopy/06-Project-structured.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"metadata": {},
"outputs": [],
"source": [
"ix = GridIntersect(base_grid, method=\"vertex\", rtree=True)"
"ix = GridIntersect(base_grid, rtree=True)"
]
},
{
Expand Down
18 changes: 15 additions & 3 deletions notebooks/part1_flopy/07-stream_capture_voronoi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@
"for gage_num in range(2):\n",
" for lay_num in range(3):\n",
" cax = ax[ax_num]\n",
" data = drf.loc[lay_num][f'Gage{gage_num+1}'].values\n",
" data[data<0] =0\n",
" data = drf.loc[lay_num][f'Gage{gage_num+1}'].values.copy()\n",
" data[data < 0] = 0\n",
" mm = fp.plot.PlotMapView(model= base_m, ax=cax)\n",
" mm.plot_bc('SFR', plotAll=True, color='blue')\n",
" mm.plot_bc('WEL', plotAll=True)\n",
Expand Down Expand Up @@ -696,9 +696,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "pyclass",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.3"
}
},
"nbformat": 4,
Expand Down
Loading
Loading