In [1]:
from ahh import exp, vis

In [2]:
ds = exp.arr_ds()

In [3]:
cmap_list = vis.DRY_COLOR_LIST + vis.WET_COLOR_LIST
cmap = vis.get_cmap(cmap_list)
vis.plot_map(ds.air[0], cmap=cmap, wrap=True) # dont mind the actual data (it's temperature)


/home/solactus/anaconda3/lib/python3.5/site-packages/matplotlib/ticker.py:1856: UserWarning: Steps argument should be a sequence of numbers
increasing from 1 to 10, inclusive. Behavior with
values outside this range is undefined, and will
raise a ValueError in future versions of mpl.
  warnings.warn('Steps argument should be a sequence of numbers\n'
Out[3]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x7fa5011ee908>

In [4]:
vis.set_figsize(17, 10)
vis_dict = dict(contourf=False, wrap=True, cols=2, rows=2, shrink=0.3, figsize='na')

# don't like Python colormaps but love NCL colormaps? no problem!
ax = vis.plot_map(ds.air[0], ds.lat, ds.lon, cmap=vis.get_cmap('cmp_flux'),
                  title='NCL Colormaps, "cmp_flux"', **vis_dict) # select NCL colormaps
ax2 = vis.plot_map(ds.air[0], ds.lat, ds.lon, cmap=vis.get_cmap('cmp_flux', start=0.25, stop=0.75),
                   pos=2, title='Subselect "start=0.25, stop=0.75"', **vis_dict) # subselect
ax3 = vis.plot_map(ds.air[0], ds.lat, ds.lon, cmap=vis.get_cmap('cmp_flux', n=255), pos=3,
                   title='Interpolate "n=255"', **vis_dict) # interpolate
ax4 = vis.plot_map(ds.air[0], ds.lat, ds.lon, cmap=vis.get_cmap('cmp_flux', r=True), pos=4,
                   title='Reverse "r=True"', **vis_dict) # reverse
vis.utils(tight_layout=True)


Out[4]:
<matplotlib.figure.Figure at 0x7fa4ffe59898>

In [5]:
cmap_list = vis.HOT_COLOR_LIST + vis.COOL_COLOR_LIST
cmap = vis.get_cmap(cmap_list, r=True) # reverse the color list
vis.plot_map(ds.air[0].values, ds.lat, ds.lon, cmap=cmap, wrap=True)


Out[5]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x7fa501d9a588>

In [6]:
cmap_list = vis.HOT_COLOR_LIST + vis.COOL_COLOR_LIST
cmap = vis.get_cmap(cmap_list, n=30) # specify how many colors to use and it will interpolate
vis.plot_map(ds.air[0].values, ds.lat, ds.lon, cmap=cmap, wrap=True, contourf=False)


Out[6]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x7fa500a0b828>

In [7]:
random_color_list = [(1, 1, 1), (0, 0, 0)]
cmap = vis.get_cmap(random_color_list, stop=0.8) # don't like the black? crop it by stopping at 0.8
vis.plot_map(ds.air[0].values, ds.lat, ds.lon, cmap=cmap, wrap=True)


Out[7]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x7fa5016a24e0>

In [8]:
random_color_list = [(255, 255, 255), (0, 0, 0)] # values can be in RGB
cmap = vis.get_cmap(random_color_list, start=0.2) # don't like the white? crop it by starting at 0.2
vis.plot_map(ds.air[0].values, ds.lat, ds.lon, cmap=cmap, wrap=True)


Out[8]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x7fa4fc90f240>

In [9]:
random_color_list = [(255, 255, 255), (150, 150, 150), (0, 0, 0)] # values can be in RGB
cmap = vis.get_cmap(random_color_list, start=0.2) # note if length of color list is longer than 2 and n isn't provided...
vis.plot_map(ds.air[0].values, ds.lat, ds.lon, cmap=cmap, wrap=True) # it'll inherit that length


Out[9]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x7fa4fcd7a358>

In [10]:
random_color_list = [(255, 255, 255), (150, 150, 150), (0, 0, 0)] # values can be in RGB
cmap = vis.get_cmap(random_color_list, start=0.2, n=10) # you can provide n to interpolate
vis.plot_map(ds.air[0].values, ds.lat, ds.lon, cmap=cmap, wrap=True)


Out[10]:
<cartopy.mpl.geoaxes.GeoAxesSubplot at 0x7fa4fcf73b00>

In [ ]: