-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prt files mostly working, minimal tests with example data (can remove…
… and programmatically generate once prt pkg classes are in flopy)
- Loading branch information
Showing
5 changed files
with
258 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from autotest.conftest import get_project_root_path | ||
from flopy.utils.prtfile import PathlineFile | ||
|
||
pytestmark = pytest.mark.mf6 | ||
prt_data_path = ( | ||
get_project_root_path() / "examples" / "data" / "mf6" / "prt_data" / "001" | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"path, header_path", | ||
[ | ||
(Path(prt_data_path) / "prt001.trk", None), | ||
( | ||
Path(prt_data_path) / "prt001.trk", | ||
Path(prt_data_path) / "prt001.trk.hdr", | ||
), | ||
(Path(prt_data_path) / "prt001.trk.csv", None), | ||
], | ||
) | ||
def test_init(path, header_path): | ||
file = PathlineFile(path, header_filename=header_path) | ||
assert file.fname == path | ||
assert file.dtype == PathlineFile.dtypes["full"] | ||
if path.suffix == ".csv": | ||
assert len(file._data) == len(open(path).readlines()) - 1 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"path", | ||
[ | ||
Path(prt_data_path) / "prt001.trk", | ||
Path(prt_data_path) / "prt001.trk.csv", | ||
], | ||
) | ||
def test_intersect(path): | ||
file = PathlineFile(path) | ||
nodes = [1, 11, 21] | ||
intersection = file.intersect(nodes) | ||
assert any(intersection) | ||
assert all(d.icell in nodes for d in intersection.itertuples()) |
Binary file not shown.
Oops, something went wrong.