Skip to content

Commit

Permalink
fix(ModflowDis.sr): rotate model prior to calculating xll and yll fro…
Browse files Browse the repository at this point in the history
…m xul and yul. (#737)

#733
  • Loading branch information
jlarsen-usgs authored and langevin-usgs committed Nov 25, 2019
1 parent 8c118ec commit 935db67
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions autotest/t007_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,32 @@ def test_sr():
raise AssertionError()


def test_dis_sr():
import flopy
import numpy as np

delr = 640
delc = 640
nrow = np.ceil(59040. / delc).astype(int)
ncol = np.ceil(33128. / delr).astype(int)
nlay = 3

xul = 2746975.089
yul = 1171446.45
rotation = -39
bg = flopy.modflow.Modflow(modelname='base')
dis = flopy.modflow.ModflowDis(bg, nlay=nlay, nrow=nrow, ncol=ncol,
delr=delr, delc=delc, lenuni=1,
rotation=rotation, xul=xul, yul=yul,
proj4_str='epsg:2243')

if abs(dis.sr.xul - xul) > 0.01:
raise AssertionError()

if abs(dis.sr.yul - yul) > 0.01:
raise AssertionError()


def test_mg():
import flopy
from flopy.utils import geometry
Expand Down
2 changes: 2 additions & 0 deletions flopy/modflow/mfdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ def __init__(self, model, nlay=1, nrow=2, ncol=2, nper=1, delr=1.0,
xll = None
yll = None
mg = model.modelgrid
if rotation is not None:
mg.set_coord_info(xoff=None, yoff=None, angrot=rotation)
if xul is not None:
xll = mg._xul_to_xll(xul)
if yul is not None:
Expand Down

0 comments on commit 935db67

Please sign in to comment.