Testing colormaps on a organized line + Stratiform from ARM C-SAPR

In [1]:
#Imports
from matplotlib import pyplot as plt
import viscm
import pyart
from colorspacious import (cspace_converter, cspace_convert,
                           CIECAM02Space, CIECAM02Surround)

import numpy as np
import cartopy

%matplotlib inline
## You are using the Python ARM Radar Toolkit (Py-ART), an open source
## library for working with weather radar data. Py-ART is partly
## supported by the U.S. Department of Energy as part of the Atmospheric
## Radiation Measurement (ARM) Climate Research Facility, an Office of
## Science user facility.
##
## If you use this software to prepare a publication, please cite:
##
##     JJ Helmus and SM Collis, JORS 2016, doi: 10.5334/jors.119

Load colormaps from this repo

In [2]:
# Use this after updating colormaps.py
%run ../code/colormap_generator.py
/Users/scollis/funded_projects/CVD-colormaps/code/colormap_generator.py:44: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if 'red' in spec:
/Users/scollis/funded_projects/CVD-colormaps/code/colormap_generator.py:60: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if 'red' in spec:

Make colormaps look like viewer has 100% deuteranomaly CVD

In [3]:
# from https://github.com/matplotlib/viscm/blob/master/viscm/gui.py
deuter50_space = {"name": "sRGB1+CVD",
                   "cvd_type": "deuteranomaly",
                   "severity": 100}

deuter50_to_sRGB1 = cspace_converter(deuter50_space, "sRGB1")

def deuter_transform(RGBA):
            # clipping, alpha handling
            RGB = RGBA[..., :3]
            RGB = np.clip(deuter50_to_sRGB1(RGB), 0, 1)
            return np.concatenate((RGB, RGBA[..., 3:]), axis=-1)
In [4]:
deuter_HomeyerRainbow = viscm.gui.TransformedCMap(deuter_transform, HomeyerRainbow)
deuter_HomeyerRainbow.N = HomeyerRainbow.N

deuter_LangRainbow12 = viscm.gui.TransformedCMap(deuter_transform, LangRainbow12)
deuter_LangRainbow12.N = LangRainbow12.N

deuter_NWSRef = viscm.gui.TransformedCMap(deuter_transform, pyart.graph.cm.NWSRef)
deuter_NWSRef.N = pyart.graph.cm.NWSRef.N

deuter_Carbone11 = viscm.gui.TransformedCMap(deuter_transform, pyart.graph.cm.Carbone11)
deuter_Carbone11.N = pyart.graph.cm.Carbone11.N

deuter_Blue_to_red = viscm.gui.TransformedCMap(deuter_transform, Blue_to_red)
deuter_Blue_to_red.N = Blue_to_red.N

deuter_NWSVel = viscm.gui.TransformedCMap(deuter_transform, pyart.graph.cm.NWSVel)
deuter_NWSVel.N = pyart.graph.cm.NWSVel.N

deuter_BuOrR14 = viscm.gui.TransformedCMap(deuter_transform, pyart.graph.cm.BuOrR14)
deuter_BuOrR14.N = pyart.graph.cm.BuOrR14.N

deuter_jet= viscm.gui.TransformedCMap(deuter_transform, plt.get_cmap('jet'))
deuter_jet.N = plt.get_cmap('jet').N

deuter_balance= viscm.gui.TransformedCMap(deuter_transform, balance)
deuter_balance.N = balance.N

Make colormaps for Protanopia

In [5]:
# from https://github.com/matplotlib/viscm/blob/master/viscm/gui.py
protanopia_space = {"name": "sRGB1+CVD",
                   "cvd_type": "protanomaly",
                   "severity": 100}

protanopia_to_sRGB1 = cspace_converter(protanopia_space, "sRGB1")

def protanopia_transform(RGBA):
            # clipping, alpha handling
            RGB = RGBA[..., :3]
            RGB = np.clip(protanopia_to_sRGB1(RGB), 0, 1)
            return np.concatenate((RGB, RGBA[..., 3:]), axis=-1)
In [6]:
protanopia_HomeyerRainbow = viscm.gui.TransformedCMap(protanopia_transform, HomeyerRainbow)
protanopia_HomeyerRainbow.N = HomeyerRainbow.N

protanopia_LangRainbow12 = viscm.gui.TransformedCMap(protanopia_transform, LangRainbow12)
protanopia_LangRainbow12.N = LangRainbow12.N

protanopia_NWSRef = viscm.gui.TransformedCMap(protanopia_transform, pyart.graph.cm.NWSRef)
protanopia_NWSRef.N = pyart.graph.cm.NWSRef.N

protanopia_Carbone11 = viscm.gui.TransformedCMap(protanopia_transform, pyart.graph.cm.Carbone11)
protanopia_Carbone11.N = pyart.graph.cm.Carbone11.N

protanopia_Blue_to_red = viscm.gui.TransformedCMap(protanopia_transform, Blue_to_red)
protanopia_Blue_to_red.N = Blue_to_red.N

protanopia_NWSVel = viscm.gui.TransformedCMap(protanopia_transform, pyart.graph.cm.NWSVel)
protanopia_NWSVel.N = pyart.graph.cm.NWSVel.N

protanopia_BuOrR14 = viscm.gui.TransformedCMap(protanopia_transform, pyart.graph.cm.BuOrR14)
protanopia_BuOrR14.N = pyart.graph.cm.BuOrR14.N

protanopia_jet= viscm.gui.TransformedCMap(protanopia_transform, plt.get_cmap('jet'))
protanopia_jet.N = plt.get_cmap('jet').N

protanopia_balance= viscm.gui.TransformedCMap(protanopia_transform, balance)
protanopia_balance.N = balance.N

Evaluate colormaps using VISCM

In [7]:
myfig = plt.figure(figsize=[15,10])
ret = viscm.viscm(LangRainbow12, figure=myfig)
In [8]:
myfig = plt.figure(figsize=[15,10])
ret = viscm.viscm(HomeyerRainbow, figure=myfig)
In [9]:
myfig = plt.figure(figsize=[15,10])
ret = viscm.viscm(pyart.graph.cm.Carbone11, figure=myfig)