Skip to content

Commit

Permalink
chore(dependencies/docs): update conda env, fix notebooks (#2414)
Browse files Browse the repository at this point in the history
The `environment.yml` was missing a few optional/developer dependencies we've recently added to `pyproject.toml`. Bring the former into sync with the latter (and list packages in the same order).

With luck, conda will eventually be able to consume `pyproject.toml` files, and we can remove `environment.yml`. More info at issue 10633 on the conda repo (not linking to avoid the crossref showing up there).

There were some old pycharm cell format comments in the notebook scripts which jupytext didn't like, remove them.

This should close #2253. To avoid similar situations in the future, don't skip notebooks due to missing dependencies in CI. We did this for convenient local testing, so tests can run without all optional dependencies, but CI should be strict.
  • Loading branch information
wpbonelli authored Jan 10, 2025
1 parent f058122 commit 1f9c0e3
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 186 deletions.
16 changes: 0 additions & 16 deletions .docs/Notebooks/array_output_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
# - name: Jeremy White
# ---

# + [markdown] pycharm={"name": "#%% md\n"}
# # Formatting ASCII output arrays
#
# ### Configuring numeric arrays written by FloPy

# + [markdown] pycharm={"name": "#%% md\n"}
# load and run the Freyberg model


# + pycharm={"name": "#%%\n"}
import os
import sys
from pathlib import Path
Expand Down Expand Up @@ -111,26 +108,20 @@
errmsg = f"Error. Output file cannot be found: {f}"
print(errmsg)

# + [markdown] pycharm={"name": "#%% md\n"}
# Each ``Util2d`` instance now has a ```.format``` attribute, which is an ```ArrayFormat``` instance:

# + pycharm={"name": "#%%\n"}
print(ml.lpf.hk[0].format)

# + [markdown] pycharm={"name": "#%% md\n"}
# The ```ArrayFormat``` class exposes each of the attributes seen in the ```ArrayFormat.___str___()``` call. ```ArrayFormat``` also exposes ``.fortran``, ``.py`` and ``.numpy`` atrributes, which are the respective format descriptors:

# + pycharm={"name": "#%%\n"}
print(ml.dis.botm[0].format.fortran)
print(ml.dis.botm[0].format.py)
print(ml.dis.botm[0].format.numpy)

# + [markdown] pycharm={"name": "#%% md\n"}
# #### (re)-setting ```.format```
#
# We can reset the format using a standard fortran type format descriptor

# + pycharm={"name": "#%%\n"}
ml.dis.botm[0].format.free = False
ml.dis.botm[0].format.fortran = "(20f10.4)"
print(ml.dis.botm[0].format.fortran)
Expand All @@ -147,25 +138,19 @@
else:
raise ValueError("Failed to run.")

# + [markdown] pycharm={"name": "#%% md\n"}
# Let's load the model we just wrote and check that the desired ```botm[0].format``` was used:

# + pycharm={"name": "#%%\n"}
ml1 = flopy.modflow.Modflow.load("freyberg.nam", model_ws=modelpth)
print(ml1.dis.botm[0].format)

# + [markdown] pycharm={"name": "#%% md\n"}
# We can also reset individual format components (we can also generate some warnings):

# + pycharm={"name": "#%%\n"}
ml.dis.botm[0].format.width = 9
ml.dis.botm[0].format.decimal = 1
print(ml1.dis.botm[0].format)

# + [markdown] pycharm={"name": "#%% md\n"}
# We can also select ``free`` format. Note that setting to free format resets the format attributes to the default, max precision:

# + pycharm={"name": "#%%\n"}
ml.dis.botm[0].format.free = True
print(ml1.dis.botm[0].format)
# -
Expand All @@ -178,6 +163,5 @@
else:
raise ValueError("Failed to run.")

# + pycharm={"name": "#%%\n"}
ml1 = flopy.modflow.Modflow.load("freyberg.nam", model_ws=modelpth)
print(ml1.dis.botm[0].format)
1 change: 0 additions & 1 deletion .docs/Notebooks/mt3dms_sft_lkt_uzt_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,6 @@

# #### Write the MT3D-USGS input files for inspecting and running

# + pycharm={"name": "#%%\n"}
mf.write_input()
mt.write_input()

Expand Down
Loading

0 comments on commit 1f9c0e3

Please sign in to comment.