Skip to content

Commit

Permalink
Support pyproj < 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Jul 16, 2020
1 parent ee96057 commit 5d6bc92
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions satpy/readers/msi_safe.py
Expand Up @@ -126,7 +126,10 @@ def end_time(self):

def get_area_def(self, dsid):
"""Get the area definition of the dataset."""
from pyproj import CRS
try:
from pyproj import CRS
except ImportError:
CRS = None
geocoding = self.root.find('.//Tile_Geocoding')
epsg = geocoding.find('HORIZONTAL_CS_CODE').text
rows = int(geocoding.find('Size[@resolution="' + str(dsid.resolution) + '"]/NROWS').text)
Expand All @@ -137,11 +140,15 @@ def get_area_def(self, dsid):
xdim = float(geoposition.find('XDIM').text)
ydim = float(geoposition.find('YDIM').text)
area_extent = (ulx, uly + rows * ydim, ulx + cols * xdim, uly)
if CRS is not None:
proj = CRS(epsg)
else:
proj = {'init': epsg}
area = geometry.AreaDefinition(
self.tile,
"On-the-fly area",
self.tile,
CRS(epsg),
proj,
cols,
rows,
area_extent)
Expand Down

0 comments on commit 5d6bc92

Please sign in to comment.