Skip to content

Commit

Permalink
fix(autotests): added pytest.ini to declare test naming convention (#…
Browse files Browse the repository at this point in the history
…1307)

* fix(plot_pathline): sort projected pathline points by travel time instead of cell order 

#1302

* Linting

* fix(autotests): added pytest.ini to declare test naming convention

* fixed t069_test_vtkexportmodel.py
* updated voronoi tests in t075_test_ugrid.py
* fixed ulstrd open/close read method for scale factors

* revert changes made to voronoi tests

* revert all changes to t075_test_ugrid.py
  • Loading branch information
jlarsen-usgs committed Dec 3, 2021
1 parent 976ad81 commit bbdf008
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions autotest/pytest.ini
@@ -0,0 +1,2 @@
[pytest]
python_files = *_test*.py
6 changes: 3 additions & 3 deletions autotest/t069_test_vtkexportmodel.py
Expand Up @@ -14,10 +14,10 @@

def test_vtk_export_model_without_packages_names():
base_dir = base_test_dir(__file__, rel_path="temp", verbose=True)
test_setup = FlopyTestSetup(verbose=True, test_dirs=baseDir)
test_setup = FlopyTestSetup(verbose=True, test_dirs=base_dir)

name = "mymodel"
sim = flopy.mf6.MFSimulation(sim_name=name, sim_ws=baseDir, exe_name="mf6")
sim = flopy.mf6.MFSimulation(sim_name=name, sim_ws=base_dir, exe_name="mf6")
tdis = flopy.mf6.ModflowTdis(sim)
ims = flopy.mf6.ModflowIms(sim)
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
Expand All @@ -29,7 +29,7 @@ def test_vtk_export_model_without_packages_names():
)

# Export model without specifying packages_names parameter
vtk.export_model(sim.get_model(), baseDir)
vtk.export_model(sim.get_model(), base_dir)

# If the function executes without error then test was successful
assert True
Expand Down
5 changes: 3 additions & 2 deletions flopy/plot/crosssection.py
Expand Up @@ -1069,8 +1069,9 @@ def plot_pathline(
markers = []
for _, arr in plines.items():
arr = np.array(arr)
arr = arr[arr[:, 0].argsort()]
linecol.append(arr)
# sort by travel time
arr = arr[arr[:, -1].argsort()]
linecol.append(arr[:, :-1])
if marker is not None:
for xy in arr[::markerevery]:
markers.append(xy)
Expand Down
8 changes: 3 additions & 5 deletions flopy/plot/plotutil.py
Expand Up @@ -2681,9 +2681,7 @@ def intersect_modpath_with_crosssection(
nppts = {}

for cell, verts in projpts.items():
tcell = cell
while tcell >= ncpl:
tcell -= ncpl
tcell = cell % ncpl
zmin = np.min(np.array(verts)[:, 1])
zmax = np.max(np.array(verts)[:, 1])
nmin = np.min(v_norm[tcell])
Expand Down Expand Up @@ -2807,7 +2805,7 @@ def reproject_modpath_to_crosssection(
rec[xp] = x
rec[yp] = y
pid = rec["particleid"][0]
pline = list(zip(rec[proj], rec[zp]))
pline = list(zip(rec[proj], rec[zp], rec["time"]))
if pid not in ptdict:
ptdict[pid] = pline
else:
Expand All @@ -2825,7 +2823,7 @@ def reproject_modpath_to_crosssection(
rec[xp] = x
rec[yp] = y
pid = rec["particleid"][0]
pline = list(zip(rec[proj], rec[zp]))
pline = list(zip(rec[proj], rec[zp], rec["time"]))
if pid not in ptdict:
ptdict[pid] = pline
else:
Expand Down
1 change: 1 addition & 0 deletions flopy/utils/flopy_io.py
Expand Up @@ -462,6 +462,7 @@ def ulstrd(f, nlist, ra, model, sfac_columns, ext_unit_dict):
# check for scaling factor
if not binary:
if line.strip().lower().startswith("sfac"):
line_list = line_parse(line)
sfac = float(line_list[1])
line = file_handle.readline()

Expand Down

0 comments on commit bbdf008

Please sign in to comment.