Skip to content

Commit

Permalink
closes #481
Browse files Browse the repository at this point in the history
  • Loading branch information
akorosov committed Aug 20, 2020
1 parent ab8d802 commit 9bb34c0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions nansat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@

try:
import matplotlib
if 'DISPLAY' not in os.environ:
matplotlib.use('Agg')
from matplotlib.colors import hex2color
from matplotlib import cm
except ImportError:
MATPLOTLIB_IS_INSTALLED = False
else:
MATPLOTLIB_IS_INSTALLED = True
if 'DISPLAY' not in os.environ:
matplotlib.use('Agg')
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.colors import hex2color
from matplotlib import cm

import numpy as np

Expand Down Expand Up @@ -126,8 +127,8 @@ def register_colormaps():
}

if MATPLOTLIB_IS_INSTALLED:
cm.register_cmap(name='obpg', data=obpg, lut=256)
cm.register_cmap(name='ak01', data=ak01, lut=256)
cm.register_cmap(cmap=LinearSegmentedColormap('obpg', obpg, 256))
cm.register_cmap(cmap=LinearSegmentedColormap('ak01', ak01, 256))

def initial_bearing(lon1, lat1, lon2, lat2):
"""Initial bearing when traversing from point1 (lon1, lat1)
Expand Down

0 comments on commit 9bb34c0

Please sign in to comment.