diff --git a/autotest/t007_test.py b/autotest/t007_test.py index e8e8be2bd2..f6fd7cf3bd 100644 --- a/autotest/t007_test.py +++ b/autotest/t007_test.py @@ -605,11 +605,15 @@ def test_dis_sr(): 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() + # SpatialReference has been deprecated + # if abs(dis.sr.xul - xul) > 0.01: + # raise AssertionError() + # if abs(dis.sr.yul - yul) > 0.01: + # raise AssertionError() + # Use StructuredGrid instead + x, y = bg.modelgrid.get_coords(0, delc * nrow) + np.testing.assert_almost_equal(x, xul) + np.testing.assert_almost_equal(y, yul) def test_mg(): diff --git a/flopy/export/netcdf.py b/flopy/export/netcdf.py index f717f5f388..a5c4749f0c 100644 --- a/flopy/export/netcdf.py +++ b/flopy/export/netcdf.py @@ -733,6 +733,8 @@ def initialize_geometry(self): if pyproj220: self.grid_crs = pyproj.CRS(proj4_str) else: + if proj4_str.lower().startswith("epsg:"): + proj4_str = "+init=" + proj4_str self.grid_crs = pyproj.Proj(proj4_str, preserve_units=True) print("initialize_geometry::self.grid_crs = {}".format(self.grid_crs)) @@ -753,7 +755,10 @@ def initialize_geometry(self): self.grid_crs, nc_crs, always_xy=True ) else: - nc_crs = pyproj.Proj(self.nc_epsg_str) + nc_epsg_str = self.nc_epsg_str + if nc_epsg_str.lower().startswith("epsg:"): + nc_epsg_str = "+init=" + nc_epsg_str + nc_crs = pyproj.Proj(nc_epsg_str) self.transformer = None print("initialize_geometry::nc_crs = {}".format(nc_crs)) diff --git a/flopy/utils/reference.py b/flopy/utils/reference.py index 7d01c1f893..feb37d9b05 100755 --- a/flopy/utils/reference.py +++ b/flopy/utils/reference.py @@ -300,7 +300,7 @@ def _parse_units_from_proj4(self): elif ( "units=ft" in proj_str or "units=us-ft" in proj_str - or "to_meters:0.3048" in proj_str + or "to_meter=0.3048" in proj_str ): units = "feet" return units