[hdf-compass] 269/295: attempt to make cartopy optional

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun May 8 10:35:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository hdf-compass.

commit b951e784b97da81660fdbd68b6f894c002d05e5a
Author: giumas <giumas at yahoo.it>
Date:   Sat Mar 26 15:57:36 2016 -0400

    attempt to make cartopy optional
---
 hdf_compass/bag_model/model.py                 | 17 ++++++++++++++++-
 hdf_compass/compass_viewer/geo_surface/plot.py |  5 ++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/hdf_compass/bag_model/model.py b/hdf_compass/bag_model/model.py
index 76ef298..abd9a92 100644
--- a/hdf_compass/bag_model/model.py
+++ b/hdf_compass/bag_model/model.py
@@ -333,6 +333,11 @@ class BAGElevationGeoArray(compass_model.GeoArray):
 
     @staticmethod
     def can_handle(store, key):
+        # for GeoSurface we use cartopy that can be challenging to freeze on OSX to dependencies (i.e. geos)
+        try:
+            import cartopy.crs as ccrs
+        except ImportError:
+            return False
         return (key == "/BAG_root/elevation") and (key in store) and (isinstance(store.f[key], h5py.Dataset))
 
     def __init__(self, store, key):
@@ -380,8 +385,13 @@ class BAGElevation(compass_model.GeoSurface):
 
     @staticmethod
     def can_handle(store, key):
-        import matplotlib
+        # for GeoSurface we use cartopy that can be challenging to freeze on OSX to dependencies (i.e. geos)
+        try:
+            import cartopy.crs as ccrs
+        except ImportError:
+            return False
         # for GeoSurface we are using a matplotlib function present after 1.5.x
+        import matplotlib
         plt_maj, plt_min, _ = matplotlib.__version__.split('.')
         if (int(plt_maj) == 1) and (int(plt_min) < 5):
             return False
@@ -692,6 +702,11 @@ class BAGUncertainty(compass_model.GeoArray):
 
     @staticmethod
     def can_handle(store, key):
+        # for GeoSurface we use cartopy that can be challenging to freeze on OSX to dependencies (i.e. geos)
+        try:
+            import cartopy.crs as ccrs
+        except ImportError:
+            return False
         return (key == "/BAG_root/uncertainty") and (key in store) and (isinstance(store.f[key], h5py.Dataset))
 
     def __init__(self, store, key):
diff --git a/hdf_compass/compass_viewer/geo_surface/plot.py b/hdf_compass/compass_viewer/geo_surface/plot.py
index 7b5b742..aa79b98 100644
--- a/hdf_compass/compass_viewer/geo_surface/plot.py
+++ b/hdf_compass/compass_viewer/geo_surface/plot.py
@@ -17,7 +17,10 @@ from __future__ import absolute_import, division, print_function, unicode_litera
 
 import numpy as np
 import wx
-import cartopy.crs as ccrs
+try:  # for GeoSurface we use cartopy that can be challenging to freeze on OSX to dependencies (i.e. geos)
+    import cartopy.crs as ccrs
+except ImportError:
+    pass
 from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
 import matplotlib.pyplot as plt
 from matplotlib.figure import Figure

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-compass.git



More information about the debian-science-commits mailing list