Skip to content

Commit

Permalink
CI(t007): patch for python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhughes-dev committed Dec 9, 2019
1 parent a20ab9a commit 34803d1
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 22 deletions.
2 changes: 0 additions & 2 deletions autotest/t007_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ def test_epsgs():
msg = 'sr.epsg is not 102733 ({})'.format(sr.epsg)
assert sr.epsg == 102733, msg

# if not "proj4_str:+init=epsg:102733" in sr.__repr__():
t_value = sr.__repr__()
msg = 'proj4_str:epsg:102733 not in sr.__repr__(): ({})'.format(t_value)
if not 'proj4_str:epsg:102733' in t_value:
Expand All @@ -683,7 +682,6 @@ def test_epsgs():
msg = 'grid_mapping_name is not latitude_longitude: {}'.format(t_value)
assert t_value == 'latitude_longitude', msg

# if not "proj4_str:+init=epsg:4326" in sr.__repr__():
t_value = sr.__repr__()
msg = 'proj4_str:epsg:4326 not in sr.__repr__(): ({})'.format(t_value)
if not 'proj4_str:epsg:4326' in t_value:
Expand Down
5 changes: 0 additions & 5 deletions flopy/discretization/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,13 @@ def proj4(self):
if self._proj4 is not None:
if "epsg" in self._proj4.lower():
proj4 = self._proj4
# if "init" not in self._proj4.lower():
# proj4 = "+init=" + self._proj4
# else:
# proj4 = self._proj4
# set the epsg if proj4 specifies it
tmp = [i for i in self._proj4.split() if
'epsg' in i.lower()]
self._epsg = int(tmp[0].split(':')[1])
else:
proj4 = self._proj4
elif self.epsg is not None:
# proj4 = '+init=epsg:{}'.format(self.epsg)
proj4 = 'epsg:{}'.format(self.epsg)
return proj4

Expand Down
12 changes: 4 additions & 8 deletions flopy/export/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def __init__(self, output_filename, model, time_values=None,

proj4_str = self.model_grid.proj4
if proj4_str is None:
# proj4_str = '+init=epsg:4326'
proj4_str = 'epsg:4326'
self.log(
'Warning: model has no coordinate reference system specified. '
Expand Down Expand Up @@ -632,8 +631,6 @@ def initialize_geometry(self):
proj4_str = self.proj4_str
print('initialize_geometry::proj4_str = {}'.format(proj4_str))

# if "epsg" in proj4_str.lower() and "init" not in proj4_str.lower():
# proj4_str = "+init=" + proj4_str
self.log("building grid crs using proj4 string: {}".format(proj4_str))
try:
self.grid_crs = Proj(proj4_str, preserve_units=True, errcheck=True)
Expand All @@ -657,7 +654,6 @@ def initialize_geometry(self):
xs = self.model_grid.xyzcellcenters[0].copy()

# Transform to a known CRS
# nc_crs = Proj(init=self.nc_epsg_str)
nc_crs = Proj(self.nc_epsg_str)
print('initialize_geometry::nc_crs = {}'.format(nc_crs))

Expand Down Expand Up @@ -709,15 +705,15 @@ def initialize_file(self, time_values=None):
import netCDF4
except Exception as e:
self.logger.warn("error importing netCDF module")
raise Exception(
"NetCdf error importing netCDF4 module:\n" + str(e))
msg = "NetCdf error importing netCDF4 module:\n" + str(e)
raise Exception(msg)

# open the file for writing
try:
self.nc = netCDF4.Dataset(self.output_filename, "w")
except Exception as e:
raise Exception(
"error creating netcdf dataset:\n{0}".format(str(e)))
msg = "error creating netcdf dataset:\n{}".format(str(e))
raise Exception(msg)

# write some attributes
self.log("setting standard attributes")
Expand Down
1 change: 0 additions & 1 deletion flopy/export/shapefile_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,6 @@ def get_spatialreference(epsg, text='esriwkt'):
# epsg code not listed on spatialreference.org
# may still work with pyproj
elif text == 'epsg':
# return '+init=epsg:{}'.format(epsg)
return 'epsg:{}'.format(epsg)

@staticmethod
Expand Down
6 changes: 0 additions & 6 deletions flopy/utils/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,13 @@ def proj4_str(self):
if self._proj4_str is not None:
if "epsg" in self._proj4_str.lower():
proj4_str = self._proj4_str
# if "init" not in self._proj4_str.lower():
# proj4_str = "+init=" + self._proj4_str
# else:
# proj4_str = self._proj4_str
# set the epsg if proj4 specifies it
tmp = [i for i in self._proj4_str.split() if
'epsg' in i.lower()]
self._epsg = int(tmp[0].split(':')[1])
else:
proj4_str = self._proj4_str
elif self.epsg is not None:
# proj4_str = '+init=epsg:{}'.format(self.epsg)
proj4_str = 'epsg:{}'.format(self.epsg)
return proj4_str

Expand Down Expand Up @@ -2197,7 +2192,6 @@ def get_spatialreference(epsg, text='esriwkt'):
# epsg code not listed on spatialreference.org
# may still work with pyproj
elif text == 'epsg':
#return '+init=epsg:{}'.format(epsg)
return 'epsg:{}'.format(epsg)


Expand Down

0 comments on commit 34803d1

Please sign in to comment.