Skip to content

Commit

Permalink
mt3dms_examples.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 11, 2024
1 parent 4be0ceb commit 007f18a
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions .docs/Notebooks/mt3dms_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@
# 10. Three-Dimensional Field Case Study

import os
import sys

# +
import sys
from pathlib import Path
from pprint import pformat
from tempfile import TemporaryDirectory

import git
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pooch

import flopy
from flopy.utils.util_array import read1d
Expand All @@ -51,7 +54,6 @@

exe_name_mf = "mf2005"
exe_name_mt = "mt3dms"
datadir = os.path.join("..", "..", "examples", "data", "mt3d_test", "mt3dms")

# temporary directory
temp_dir = TemporaryDirectory()
Expand All @@ -62,6 +64,28 @@
print(f"matplotlib version: {mpl.__version__}")
print(f"flopy version: {flopy.__version__}")

# Check if we are in the repository and define the data path.

try:
root = Path(git.Repo(".", search_parent_directories=True).working_dir)
except:
root = None

data_path = root / "examples" / "data" if root else Path.cwd()
datadir = data_path / "mt3d_test" / "mt3dms"

file_names = {
"p08shead.dat": None,
"p10cinit.dat": None,
"p10shead.dat": None,
}
for fname, fhash in file_names.items():
pooch.retrieve(
url=f"https://github.com/modflowpy/flopy/raw/develop/examples/data/mt3d_test/mt3dms/{fname}",
fname=fname,
path=data_path / "mt3d_test" / "mt3dms",
known_hash=None,
)

# -

Expand Down

0 comments on commit 007f18a

Please sign in to comment.