Skip to content

Commit

Permalink
Fix depricated pyproj.transform calls
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed May 19, 2020
1 parent 97975b7 commit 76bd7f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/make_mpas_to_lat_lon_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

remapper = Remapper(inDescriptor, outDescriptor, mappingFileName)

remapper.build_mapping_file(method='bilinear', mpiTasks=4)
remapper.build_mapping_file(method='bilinear', mpiTasks=1)

outFileName = 'temp_{}.nc'.format(outGridName)
ds = xarray.open_dataset(inGridFileName)
Expand Down
5 changes: 3 additions & 2 deletions pyremap/descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,9 @@ def project_to_lat_lon(self, X, Y): # {{{
# -------
# Xylar Asay-Davis

Lon, Lat = pyproj.transform(self.projection, self.latLonProjection,
X, Y)
transformer = pyproj.Transformer.from_proj(self.projection,
self.latLonProjection)
Lon, Lat = transformer.transform(X, Y)

return (Lat, Lon) # }}}

Expand Down
8 changes: 4 additions & 4 deletions pyremap/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def to_polar(points):
projection = get_antarctic_stereographic_projection()
latLonProjection = pyproj.Proj(proj='latlong', datum='WGS84')

x, y = pyproj.transform(latLonProjection, projection, points[:, 0],
points[:, 1], radians=False)
transformer = pyproj.Transformer.from_proj(latLonProjection, projection)
x, y = transformer.transform(points[:, 0], points[:, 1], radians=False)
points[:, 0] = x
points[:, 1] = y
return points
Expand All @@ -137,8 +137,8 @@ def from_polar(points):
projection = get_antarctic_stereographic_projection()
latLonProjection = pyproj.Proj(proj='latlong', datum='WGS84')

lon, lat = pyproj.transform(projection, latLonProjection, points[:, 0],
points[:, 1], radians=False)
transformer = pyproj.Transformer.from_proj(projection, latLonProjection)
lon, lat = transformer.transform(points[:, 0], points[:, 1], radians=False)
points[:, 0] = lon
points[:, 1] = lat
return points
Expand Down

0 comments on commit 76bd7f7

Please sign in to comment.