Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion autotest/t007_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,24 @@ def test_free_format_flag():
assert ms1.free_format_input == ms1.bas6.ifrefm


def test_sr():
import flopy
m = flopy.modflow.Modflow("test", model_ws="./temp",
xll=12345, yll=12345,
proj4_str="test test test")
flopy.modflow.ModflowDis(m,10,10,10)
m.sr.xll = 12345
m.sr.yll = 12345
m.write_input()
mm = flopy.modflow.Modflow.load("test.nam", model_ws="./temp")
if mm.sr.xul != 12345:
raise AssertionError()
if mm.sr.yul != 12355:
raise AssertionError()
if mm.sr.proj4_str != "test test test":
raise AssertionError()


def test_mg():
import flopy
from flopy.utils import geometry
Expand Down Expand Up @@ -1310,5 +1328,6 @@ def test_export_contourf():
# test_export_array()
#test_export_array_contours()
#test_tricontour_NaN()
test_export_contourf()
#test_export_contourf()
test_sr()
pass
8 changes: 4 additions & 4 deletions flopy/mbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ def __init__(self, modelname='modflowtest', namefile_ext='nam',
warnings.warn('xul/yul have been deprecated. Use xll/yll instead.',
DeprecationWarning)

rotation = kwargs.pop("rotation", 0.0)
proj4_str = kwargs.pop("proj4_str", None)
self._rotation = kwargs.pop("rotation", 0.0)
self._proj4_str = kwargs.pop("proj4_str", None)
self._start_datetime = kwargs.pop("start_datetime", "1-1-1970")

# build model discretization objects
self._modelgrid = Grid(proj4=proj4_str, xoff=xll, yoff=yll,
angrot=rotation)
self._modelgrid = Grid(proj4=self._proj4_str, xoff=xll, yoff=yll,
angrot=self._rotation)
self._modeltime = None

# Model file information
Expand Down
5 changes: 4 additions & 1 deletion flopy/modflow/mfdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,13 @@ def __init__(self, model, nlay=1, nrow=2, ncol=2, nper=1, delr=1.0,
yll = mg._yul_to_yll(yul)
mg.set_coord_info(xoff=xll, yoff=yll, angrot=rotation, proj4=proj4_str)

xll = mg.xoffset
yll = mg.yoffset
rotation = mg.angrot
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=DeprecationWarning)
self._sr = SpatialReference(self.delr, self.delc, self.lenuni,
xul=xul, yul=yul,
xll=xll, yll=yll,
rotation=rotation or 0.0,
proj4_str=proj4_str)

Expand Down