import matplotlib
LUTSIZE = matplotlib.rcParams['image.lut']
import matplotlib.colors as colors
_NWSRef_data = {
'blue': [
(0.0, 0.92549019607843142, 0.92549019607843142),
(0.07142857, 0.96470588235294119, 0.96470588235294119),
(0.14285714, 0.96470588235294119, 0.96470588235294119),
(0.21428571, 0.0, 0.0),
(0.28571429, 0.0, 0.0),
(0.35714286, 0.0, 0.0),
(0.42857143, 0.0, 0.0),
(0.50000000, 0.0, 0.0),
(0.57142857, 0.0, 0.0),
(0.64285714, 0.0, 0.0),
(0.71428571, 0.0, 0.0),
(0.78571429, 0.0, 0.0),
(0.85714286, 1.0, 1.0),
(0.92857143, 0.78823529411764703, 0.78823529411764703),
(1.0, 0.0, 0.0)
],
'green': [
(0.0, 0.92549019607843142, 0.92549019607843142),
(0.07142857, 0.62745098039215685, 0.62745098039215685),
(0.14285714, 0.0, 0.0),
(0.21428571, 1.0, 1.0),
(0.28571429, 0.78431372549019607, 0.78431372549019607),
(0.35714286, 0.56470588235294117, 0.56470588235294117),
(0.42857143, 1.0, 1.0),
(0.50000000, 0.75294117647058822, 0.75294117647058822),
(0.57142857, 0.56470588235294117, 0.56470588235294117),
(0.64285714, 0.0, 0.0),
(0.71428571, 0.0, 0.0),
(0.78571429, 0.0, 0.0),
(0.85714286, 0.0, 0.0),
(0.92857143, 0.33333333333333331, 0.33333333333333331),
(1.0, 0.0, 0.0)],
'red': [
(0.0, 0.0, 0.0),
(0.07142857, 0.0039215686274509803, 0.0039215686274509803),
(0.14285714, 0.0, 0.0),
(0.21428571, 0.0, 0.0),
(0.28571429, 0.0, 0.0),
(0.35714286, 0.0, 0.0),
(0.42857143, 1.0, 1.0),
(0.50000000, 0.90588235294117647, 0.90588235294117647),
(0.57142857, 1.0, 1.0),
(0.64285714, 1.0, 1.0),
(0.71428571, 0.83921568627450982, 0.83921568627450982),
(0.78571429, 0.75294117647058822, 0.75294117647058822),
(0.85714286, 1.0, 1.0),
(0.92857143, 0.59999999999999998, 0.59999999999999998),
(1.0, 0.0, 0.0)
]
}
_NWSVel_data = {
'blue': [
(0.0, 0.62352941176470589, 0.62352941176470589),
(0.071428571428571425, 0.0, 0.0),
(0.14285714285714285, 0.0, 0.0),
(0.21428571428571427, 0.0, 0.0),
(0.2857142857142857, 0.0, 0.0),
(0.3571428571428571, 0.0, 0.0),
(0.42857142857142855, 0.0, 0.0),
(0.5, 0.46666666666666667, 0.46666666666666667),
(0.5714285714285714, 0.46666666666666667, 0.46666666666666667),
(0.64285714285714279, 0.0, 0.0),
(0.71428571428571419, 0.0, 0.0),
(0.7857142857142857, 0.0, 0.0),
(0.8571428571428571, 0.0, 0.0),
(0.92857142857142849, 0.0, 0.0),
(1.0, 0.0, 0.0)
],
'green': [
(0.0, 0.0, 0.0),
(0.071428571428571425, 1.0, 1.0),
(0.14285714285714285, 0.90980392156862744, 0.90980392156862744),
(0.21428571428571427, 0.78431372549019607, 0.78431372549019607),
(0.2857142857142857, 0.69019607843137254, 0.69019607843137254),
(0.3571428571428571, 0.56470588235294117, 0.56470588235294117),
(0.42857142857142855, 0.4392156862745098, 0.4392156862745098),
(0.5, 0.59215686274509804, 0.59215686274509804),
(0.5714285714285714, 0.46666666666666667, 0.46666666666666667),
(0.64285714285714279, 0.0, 0.0),
(0.71428571428571419, 0.0, 0.0),
(0.7857142857142857, 0.0, 0.0),
(0.8571428571428571, 0.0, 0.0),
(0.92857142857142849, 0.0, 0.0),
(1.0, 0.0, 0.0)
],
'red': [
(0.0, 0.56470588235294117, 0.56470588235294117),
(0.071428571428571425, 0.0, 0.0),
(0.14285714285714285, 0.0, 0.0),
(0.21428571428571427, 0.0, 0.0),
(0.2857142857142857, 0.0, 0.0),
(0.3571428571428571, 0.0, 0.0),
(0.42857142857142855, 0.0, 0.0),
(0.5, 0.46666666666666667, 0.46666666666666667),
(0.5714285714285714, 0.59215686274509804, 0.59215686274509804),
(0.64285714285714279, 0.50196078431372548, 0.50196078431372548),
(0.71428571428571419, 0.62745098039215685, 0.62745098039215685),
(0.7857142857142857, 0.72156862745098038, 0.72156862745098038),
(0.8571428571428571, 0.84705882352941175, 0.84705882352941175),
(0.92857142857142849, 0.93333333333333335, 0.93333333333333335),
(1.0, 1.0, 1.0)
]
}
for c in _NWSVel_data.iterkeys():
trim = _NWSVel_data[c][1:]
low, high = trim[0][0], trim[-1][0]
remap = lambda x: (x - low) / (high - low)
trim = [ (remap(stop), c_lo, c_hi) for stop, c_lo, c_hi in trim ]
_NWSVel_data[c] = trim
datad = {}
for name in locals().keys():
if name.endswith('_data'):
newname = name[1:-5]
#Put data for colortable into dictionary under new name
datad[newname] = locals()[name]
#Create colortable from data and place it in local namespace under new name
locals()[newname] = colors.LinearSegmentedColormap(newname, locals()[name],
LUTSIZE)