Skip to content

Commit

Permalink
#380 tools: split import of matplotlib and basemap
Browse files Browse the repository at this point in the history
  • Loading branch information
akorosov committed Sep 19, 2018
1 parent 243437c commit 66ec289
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions nansat/tools.py
Expand Up @@ -22,20 +22,25 @@
from dateutil.parser import parse

try:
import matplotlib
if 'DISPLAY' not in os.environ:
import matplotlib; matplotlib.use('Agg')
from matplotlib import cm
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.colors import hex2color
from mpl_toolkits.basemap import Basemap
from matplotlib import cm
from matplotlib.patches import Polygon
except ImportError:
BASEMAP_LIB_IS_INSTALLED = False
MATPLOTLIB_IS_INSTALLED = False
else:
BASEMAP_LIB_IS_INSTALLED = True
MATPLOTLIB_IS_INSTALLED = True

try:
from mpl_toolkits.basemap import Basemap
except ImportError:
BASEMAP_LIB_IS_INSTALLED = False
else:
BASEMAP_LIB_IS_INSTALLED = True

import numpy as np

try:
Expand Down

0 comments on commit 66ec289

Please sign in to comment.