-
Notifications
You must be signed in to change notification settings - Fork 353
Description
Heavily edited after more consideration
Is your feature request related to a problem? Please describe.
This repo contains example model data in examples/data/. A download link was recently added to example notebooks rendered on ReadTheDocs, but many are not immediately runnable after download as they rely on example data. To run the notebooks first requires cloning the repo, or downloading files from the GitHub web UI, etc. This adds friction for first-time use and (from a maintainer perspective) complicates the docs build.
Describe the solution you'd like
One option is a module (and maybe CLI) providing access to example models. Small models could be included in the package, larger ones downloaded/cached on demand. Projects like PyVista and scikit-image do this. Or model input files could be generated on demand. Models in the following repos could be included:
modflowpy/flopy, inexamples/data/MODFLOW-USGS/modflow6-examplesMODFLOW-USGS/modflow6-testmodelsMODFLOW-USGS/modflow6-largetestmodels
PyVista usage looks like:
from pyvista import examples
teapot = examples.download_teapot()skimage looks like:
from skimage import data
coins = data.coins()The latter seems mildly preferable for brevity and because the data may already be cached (if downloaded) or generated (no downloads).
In flopy's case, maybe e.g.
from flopy import examples
sim = examples.freyberg_mf6()Alternatively, it could return a Path to the model/simulation directory instead of the Modflow/MFSimulation/etc itself. The model/simulation seems preferable as the path is retrievable from it anyway. To avoid polluting the cache with output files and to support the common case of loading then switching to a new workspace before rewriting/running, a workspace or sim_path option may be convenient, perhaps defaulting to a temporary directory.
Notebooks and tests would then be able to use the example model interface. Removing implicit filesystem expectations leaves notebooks dependent only on a python/flopy env and modflow binaries.
PyVista uses Pooch to do the fetching/caching, some of whose source skimage appears to vendor in their own implementation. If we generate model input files instead of downloading them, this would not be necessary.