Skip to content

Commit

Permalink
Fix pyproj imports in CGrid_geo
Browse files Browse the repository at this point in the history
  • Loading branch information
stefraynaud committed May 3, 2019
1 parent 11fd6fd commit c4e3c6b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pygridgen/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,10 @@ def __init__(self, lon, lat, proj, use_gcdist=True, ellipse='WGS84'):
try:
import pyproj
except ImportError:
from mpl_toolkits.basemap import pyproj
else:
raise ImportError('pyproj or mpltoolkits-basemap required')
try:
from mpl_toolkits.basemap import pyproj
except ImportError:
raise ImportError('pyproj or mpltoolkits-basemap required')

x, y = proj(lon, lat)
self.lon_vert = lon
Expand Down Expand Up @@ -690,7 +691,7 @@ def lat(self):
"""Shorthand for lat_vert"""
return self.lat_vert

def mask_polygon_geo(lonlat_verts, mask_value=0.0):
def mask_polygon_geo(self, lonlat_verts, mask_value=0.0):
lon, lat = zip(*lonlat_verts)
x, y = proj(lon, lat, inverse=True)
self.mask_polygon(zip(x, y), mask_value)
Expand Down

0 comments on commit c4e3c6b

Please sign in to comment.