diff --git a/autotest/t007_test.py b/autotest/t007_test.py index 98327bfde0..9e60916242 100644 --- a/autotest/t007_test.py +++ b/autotest/t007_test.py @@ -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 @@ -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 diff --git a/flopy/mbase.py b/flopy/mbase.py index c6984e1ec4..200cc549a0 100644 --- a/flopy/mbase.py +++ b/flopy/mbase.py @@ -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 diff --git a/flopy/modflow/mfdis.py b/flopy/modflow/mfdis.py index 4d852b731d..e744b36f31 100644 --- a/flopy/modflow/mfdis.py +++ b/flopy/modflow/mfdis.py @@ -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)