Activation impacts on fast cloud responses in a coupled aerosol-climate model ...

... and nifty visualization / analysis tools

or - Why I don't have cool results to show you (yet)

Daniel Rothenberg (

Joint Program Student Luncheon, July 16, 2015

Python for Scientists

  • Mature (well-documented, efficient, easy-to-use) data analysis packages
  • Portable ecosystem - any machine, any operating system
  • Huge userbase
  • Many cool tools in active development
  • Supports many different development styles
    • scripting (editing files from terminal/shell)
    • notebook environment
    • full-blown IDEs for software development - Spyder, PyCharm, etc.

Python helps create reproducible, verifiable science

Reproducibility (1) - Version Control

In [16]:
def get_git_versioning():
    """ Returns the currently checked out commit shortname. """
    return subprocess.check_output(
        ['git', 'rev-parse', '--short', 'HEAD']

print("Current HEAD git commit: ", str(get_git_versioning()))
Current HEAD git commit:  b'3fde6fc'

Fetch git commit at any time, attach it as metadata in whatever figure or output file you create

But why should you care about this?

In [35]:
!git log -2
commit d667821e910c1104ce48bd80fc2dec29be01f612
Author: Daniel Rothenberg <>
Date:   Thu Jul 16 09:59:45 2015 -0400

    Unified naming scheme for notebooks

commit 383aaa394614be2ee78a6943bc0a720bb742d98d
Author: Daniel Rothenberg <>
Date:   Thu Jul 16 09:55:07 2015 -0400

    updated global radiative forcing (PD - PI) change calculations

Oh no, I broke something!

In [30]:
!git diff ee8a2e9 ebe1ce2 marc_aie/
diff --git a/marc_aie/ b/marc_aie/
index ed7d01a..4120eab 100644
--- a/marc_aie/
+++ b/marc_aie/
@@ -109,12 +109,12 @@ def create_master(var, data_dict=None, new_fields=["PS", ]):
     if isinstance(var, str):
         assert data_dict is not None
         acts, aers = decompose_multikeys(list(data_dict.keys()))
-        new_fields.append(var)
+        new_fields += var
     elif isinstance(var, Var):
         data_dict =
         acts = var.cases['act']
         aers = var.cases['aer']
-        new_fields.append(var.varname)
+        new_fields += var.varname
         raise ValueError("`var` must be a Var or a string.")

But, I can't make my [insert-super-secret-project] public!

Reproducibility (2) - Environments

Common Problems

  • Something changed in a version of a toolkit or a package and now I get different answers!
  • It's worse, my code doesn't even run any more!
  • Someone forgot to tell me that I need package xyz:v.a.b.c but it won't compile on my machine!
  • It's worse, it has a conflicting dependency with another package that I really need!

Solution - Package Managers


  • A python package manager with sophisticated environment management (a là virtualenv)
  • Maintain minimal Python installation for a given project
  • Distribute and automatically build your dependencies
  • Automatically comes with Anaconda Python distribution and Miniconda
  • Social site binstar for contributing packages


  • Full-stack software management
  • Rapidly re-deploy your entire working environment to a new machine (local, supercomputer, distributed)


name: marc_aie
  - unidata
  - scitools
  - cartopy>=0.12
  - ipython>=3.2.0
  - ipython-notebook
  - matplotlib
  - netcdf4
  - numpy
  - python=3.4
  - seaborn
  - xlrd
  - xray>=0.5

Create environment based on environment.yml

cd [my_repo_dir]
conda env create

Activate environment

source activate marc_aie
In [45]:
!conda info -e
# conda environments:
cartopy_py3              /Users/daniel/anaconda/envs/cartopy_py3
ipython-dev              /Users/daniel/anaconda/envs/ipython-dev
iris_1_7_2               /Users/daniel/anaconda/envs/iris_1_7_2
marc_aie              *  /Users/daniel/anaconda/envs/marc_aie
marc_aie2                /Users/daniel/anaconda/envs/marc_aie2
pymc3_test               /Users/daniel/anaconda/envs/pymc3_test
python3                  /Users/daniel/anaconda/envs/python3
scipy-tutorial           /Users/daniel/anaconda/envs/scipy-tutorial
vispy_test               /Users/daniel/anaconda/envs/vispy_test
root                     /Users/daniel/anaconda

In [46]:
!conda list
# packages in environment at /Users/daniel/anaconda/envs/marc_aie:
binstar                   0.11.0                   py34_0    defaults
cartopy                   0.13.0               np19py34_0
certifi                   14.05.14                 py34_0    defaults
clyent                    0.3.4                    py34_0    defaults
curl                      7.38.0                        0
freetype                  2.5.2                         2    defaults
geos                      3.4.2                         4
hdf5                      1.8.14                        0    defaults
ipython                   3.2.1                    py34_0    defaults
ipython-notebook          3.2.1                    py34_0    defaults
jinja2                    2.7.3                    py34_1    defaults
jpeg                      8d                            2
jsonschema                2.4.0                    py34_0    defaults
libnetcdf                 4.3.2                         1    defaults
libpng                    1.6.17                        0    defaults
libsodium                 0.4.5                         0
libtiff                   4.0.2                         1
markupsafe                0.23                     py34_0    defaults
matplotlib                1.4.3                np19py34_3    defaults
mistune                   0.6                      py34_0    defaults
mock                      1.0.1                    py34_0    defaults
netcdf4                   1.1.8                np19py34_0    defaults
nose                      1.3.7                    py34_0    defaults
numpy                     1.9.2                    py34_0    defaults
openssl                   1.0.1k                        1
owslib                    0.9.0                    py34_0
pandas                    0.16.2               np19py34_0    defaults
pillow                    2.9.0                    py34_0    defaults
pip                       7.1.0                    py34_0    defaults
proj4                     4.9.1                         1
ptyprocess                0.4                      py34_0    defaults
pyepsg                    0.2.0                    py34_0
pygments                  2.0.2                    py34_0    defaults
pyparsing                 2.0.3                    py34_0    defaults
pyqt                      4.11.3                   py34_0    defaults
pyshp                     1.2.1                    py34_0
python                    3.4.3                         0    defaults
python-dateutil           2.4.2                    py34_0    defaults                1.2                      py34_4    defaults
pytz                      2015.4                   py34_0    defaults
pyyaml                    3.11                     py34_1    defaults
pyzmq                     14.7.0                   py34_0    defaults
qgrid                     0.1.1                     <pip>
qt                        4.8.6                         3    defaults
readline                  6.2                           2    <unknown>
requests                  2.7.0                    py34_0    defaults
scipy                     0.15.1               np19py34_0    defaults
seaborn                   0.6.0                np19py34_0    defaults
setuptools                18.0.1                   py34_0    defaults
shapely                   1.5.8                np19py34_2
sip                       4.16.5                   py34_0    defaults
six                       1.9.0                    py34_0    defaults
sqlite                                 1    defaults
terminado                 0.5                      py34_0    defaults
tk                        8.5.18                        0    defaults
tornado                   4.2                      py34_0    defaults
xlrd                      0.9.3                    py34_0    defaults
xray                      0.5.1                np19py34_0    defaults
xz                        5.0.5                         0    defaults
yaml                      0.1.6                         0    defaults
zeromq                    4.0.5                         1
zlib                      1.2.8                         1
In [48]:
!binstar search -t conda cartopy
Using binstar api site
Run 'binstar show <USER/PACKAGE>' to get more details:
     Name                      |  Version | Package Types   | Platforms      
     ------------------------- |   ------ | --------------- | ---------------
     ChrisBarker/cartopy       |          | conda           | osx-64         
                                          : None
     asmeurer/cartopy          |   0.11.1 | conda           | linux-64       
                                          : None
     benbovy/cartopy           |   0.11.2 | conda           | linux-64, osx-64
                                          : A library providing cartographic tools for python
     christophkeller/cartopy   |   0.11.2 | conda           | osx-64         
                                          : A library providing cartographic tools for python
     jklymak/cartopy           |    1.6.0 | conda           | osx-64         
                                          : None
     julienchastang/cartopy    |   0.10.0 | conda           | osx-64         
                                          : None
     krisvanneste/cartopy      |   0.11.2 | conda           | win-64         
                                          : None
     nbren12/cartopy           |    1.6.0 | conda           | linux-64, osx-64
                                          : None
     shoyer/cartopy            |   0.11.2 | conda           | osx-64         
                                          : A library providing cartographic tools for python
     vsheremet/cartopy         |   0.11.2 | conda           | linux-32       
                                          : None
Found 10 packages


Cartopy is a powerful wrapper for matplotlib enabling cartographic/geographic transformations of your data

In [74]:
import marc_aie as ma
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np

v = ma.CESMVar("TS")
v.apply(lambda ds: ds['TS'].mean("time"))
data =['arg_comp', 'F2000']
Loading TS (Surface temperature (radiative)) [K]
from /Users/daniel/Desktop/MARC_AIE/work/
Loading TS (Surface temperature (radiative)) [K]
from /Users/daniel/Desktop/MARC_AIE/work/
Loading TS (Surface temperature (radiative)) [K]
from /Users/daniel/Desktop/MARC_AIE/work/
Loading TS (Surface temperature (radiative)) [K]
from /Users/daniel/Desktop/MARC_AIE/work/
<xray.DataArray 'TS' (lat: 96, lon: 144)>
array([[ 218.58482361,  218.5799408 ,  218.60137939, ...,  218.58233643,
         218.57707214,  218.59594727],
       [ 218.88679504,  218.29620361,  218.22875977, ...,  219.26359558,
         219.11993408,  218.63648987],
       [ 218.0002594 ,  218.05961609,  217.96510315, ...,  218.80046082,
         218.55628967,  218.3144989 ],
       [ 256.84292603,  256.97180176,  257.05990601, ...,  256.39889526,
         256.53231812,  256.67669678],
       [ 256.02627563,  256.08166504,  256.13250732, ...,  255.80848694,
         255.88676453,  255.96191406],
       [ 255.69245911,  255.72254944,  255.75584412, ...,  255.62876892,
         255.6466217 ,  255.66511536]], dtype=float32)
  * lat      (lat) float64 -90.0 -88.11 -86.21 -84.32 -82.42 -80.53 -78.63 ...
  * lon      (lon) float64 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 20.0 22.5 ...
In [83]:
fig = plt.figure(figsize=(12, 5))
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
gp = ma.global_plot(data, ax=ax, cmap="cubehelix_r",
               levels=np.linspace(210, 320, 23))
cb = plt.colorbar(orientation='horizontal')
_ = plt.title(v.long_name + " (%s)" % v.units)

Under the hood

(link to xray docs)


  • Powerful toolkit for accessing and manipulating and wrangling NetCDF / HDF5 data
  • Maintained by employees from THE CLIMATE CORPORATION
  • Under active development
  • Cool features:
    • lazy evaluation system; doesn't do any numerical work until it absolutely needs to
    • implements dask out-of-core computation library
    • extends pythonic interfaces for arrays and maps
    • serialize to/from NetCDF

Simple xray example

In [91]:
Dimensions:    (act: 2, aer: 2, lat: 96, lev: 30, lon: 144, nbnd: 2, time: 12)
  * act        (act) <U12 'arg_min_smax' 'arg_comp'
  * aer        (aer) <U5 'F2000' 'F1850'
  * lev        (lev) float64 3.643 7.595 14.36 24.61 38.27 54.6 72.01 87.82 ...
  * time       (time) datetime64[ns] 2007-02-01 2007-03-01 2007-04-01 ...
  * lat        (lat) float64 -90.0 -88.11 -86.21 -84.32 -82.42 -80.53 -78.63 ...
  * lon        (lon) float64 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 20.0 22.5 ...
  * nbnd       (nbnd) int64 0 1
Data variables:
    hyam       (lev) float64 0.003643 0.007595 0.01436 0.02461 0.03827 ...
    hybm       (lev) float64 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ...
    P0         float64 1e+05
    time_bnds  (time, nbnd) float64 2.555e+03 2.586e+03 2.586e+03 2.614e+03 ...
    gw         (lat) float64 0.0001367 0.001093 0.002185 0.003275 0.004361 ...
    PS         (act, aer, time, lat, lon) float64 6.871e+04 6.871e+04 ...
    TS         (act, aer, time, lat, lon) float64 239.3 239.3 239.3 239.3 ...
    Conventions: CF-1.0
    source: CAM
    case: arg_min_smax
    title: UNSET
    logname: darothen
    host: ys4032
    Version: $Name$
    revision_Id: $Id$
    initial_file: /glade/p/cesm/cseg/inputdata/atm/cam/inic/fv/
    topography_file: /glade/p/cesm/cseg/inputdata/atm/cam/topo/
    history: Mon Jul 13 10:25:41 2015: ncatted -O -a years_omit,global,o,i,5 -a years_offset,global,o,i,0 -a git_commit,global,o,c,2ae4314 -a units,TS,o,c,K -a long_name,TS,o,c,Surface temperature (radiative) /Users/daniel/Desktop/MARC_AIE/work/
Mon Jul 13 10:25:41 2015: ncrcat -O -v TS,time_bnds,hyam,hybm,PS,P0,gw /Users/daniel/Desktop/MARC_AIE/F2000/arg_min_smax/ /Users/daniel/Desktop/MARC_AIE/F2000/arg_min_smax/arg_min_smax.cam2.h0.0008-02....
    nco_openmp_thread_number: 1
    years_omit: 5
    years_offset: 0
    git_commit: 2ae4314
In [106]:
pd_minus_pi = lambda ds: ds.sel(aer='F2000') - ds.sel(aer='F1850')

a = (data['TS']
<xray.DataArray 'TS' (act: 2, season: 4, lat: 96)>
array([[[  4.61950867e-01,   5.59026612e-01,   4.55550123e-01,
           2.36727326e-01,   3.18702133e-01,   3.07158188e-01,
           4.00162096e-01,   2.57165096e-01,  -2.51953690e-03,
          -1.69026445e-01,  -2.49001574e-01,  -2.79389205e-01,
          -1.92487787e-01,  -1.28579458e-01,  -8.24304510e-02,
          -5.55523766e-02,  -3.27090511e-02,  -1.18752939e-02,
          -1.07835840e-03,  -7.05789637e-03,  -1.06829890e-02,
          -9.91637618e-03,  -1.87625885e-02,  -2.38267404e-02,
          -3.81276872e-02,  -2.91075530e-02,  -8.74378063e-03,
           5.13648987e-03,   2.97010210e-02,   8.00307945e-02,
           1.22102243e-01,   1.57001919e-01,   1.46723571e-01,
           1.78918768e-01,   1.59398679e-01,   1.16689329e-01,
           8.40828507e-02,   3.72428894e-02,  -4.74922039e-02,
          -8.98047553e-02,  -9.58072521e-02,  -7.10083290e-02,
          -4.92844758e-02,  -2.74109311e-02,  -1.85739729e-02,
          -1.87570784e-02,  -1.69532917e-02,  -2.33111205e-02,
          -3.27513659e-02,  -3.97032279e-02,  -5.51194085e-02,
          -1.36929265e-02,  -6.68758816e-03,  -3.77916407e-02,
          -3.64000532e-02,  -4.79006591e-02,  -5.71512999e-02,
          -4.76754506e-02,  -2.97665066e-02,  -2.76909581e-02,
           3.32267196e-03,   6.08161644e-03,   2.34984645e-02,
           7.48620210e-02,   1.36555071e-01,  -2.07953983e-03,
           2.04202864e-03,  -9.78082021e-02,  -3.50580321e-01,
          -4.22725925e-01,  -5.40097131e-01,  -5.02463553e-01,
          -6.63829026e-01,  -6.39031092e-01,  -6.06076982e-01,
          -6.03618692e-01,  -7.28095055e-01,  -6.94898252e-01,
          -4.85111625e-01,  -1.95414155e-01,   2.04403701e-01,
           4.80703036e-01,   8.70608824e-01,   9.62710239e-01,
           1.00792009e+00,   1.21536597e+00,   1.39035550e+00,
           1.88134331e+00,   2.39306701e+00,   2.90343793e+00,
           3.47283515e+00,   4.14868394e+00,   5.17647001e+00,
           6.17412853e+00,   6.98954925e+00,   7.17029628e+00],
        [  1.59742871e+00,   1.54895984e+00,   1.32986274e+00,
           1.21900629e+00,   1.52778707e+00,   1.79198851e+00,
           1.88053265e+00,   1.99816379e+00,   1.70156451e+00,
           1.29102816e+00,   9.25821022e-01,   2.11967963e-01,
          -2.86178412e-01,  -5.78626279e-01,  -7.61585765e-01,
          -5.29023700e-01,  -2.15047836e-01,  -5.55934906e-02,
          -7.24319175e-03,   2.76311239e-03,   6.54743336e-03,
          -1.30074113e-03,  -1.78571630e-02,  -1.57094178e-02,
          -1.68893602e-02,  -1.17082243e-02,   2.62458236e-03,
           7.80656603e-03,   2.79021793e-02,   2.89714248e-02,
           3.18734911e-02,   1.47480435e-02,  -2.21372534e-03,
          -4.54728162e-02,  -7.70418379e-02,  -6.15302898e-02,
           9.92245144e-04,   7.76996613e-02,   5.31682615e-02,
           1.56864590e-02,  -4.93885323e-02,  -2.63998244e-02,
           7.20363193e-03,  -7.70144992e-04,  -3.35345798e-02,
          -4.57673249e-02,  -2.70599083e-02,  -3.86047363e-02,
          -5.62635351e-02,  -4.31913446e-02,  -1.32381298e-02,
          -1.18043688e-03,  -1.50187457e-02,   1.17538593e-02,
           5.56898470e-02,   8.57960736e-03,  -6.55918121e-02,
          -1.89799909e-01,  -2.49309257e-01,  -2.63202738e-01,
          -2.35350644e-01,  -1.89605289e-01,  -1.67005751e-01,
          -6.96381463e-02,  -2.48590399e-02,  -4.78550240e-02,
          -4.56760548e-03,  -1.78177374e-01,  -2.40644384e-01,
          -3.36792769e-01,  -2.56034498e-01,  -2.47035768e-01,
          -3.67465690e-01,  -5.29830014e-01,  -6.20083279e-01,
          -7.11591438e-01,  -6.77188732e-01,  -6.37745186e-01,
          -6.53869134e-01,  -5.04177941e-01,  -4.16831829e-01,
          -2.19293206e-01,   2.06888093e-01,   5.96995919e-01,
           5.64722167e-01,   5.33223894e-01,   9.40711057e-02,
          -1.66380847e-03,  -1.88207238e-01,  -2.38651594e-01,
          -1.86001601e-01,   8.76995369e-02,   4.26370691e-01,
           8.06796462e-01,   1.18346370e+00,   1.11046862e+00],
        [ -3.82077217e-01,  -6.76048067e-01,  -1.17496653e+00,
          -1.53682281e+00,  -2.18566478e+00,  -2.31917855e+00,
          -2.08759594e+00,  -1.40901972e+00,  -1.16008059e+00,
          -7.96236179e-01,  -3.30285496e-01,  -4.83774609e-02,
           4.83460603e-02,   2.63951973e-02,  -9.18918186e-03,
           3.70562518e-03,   1.27863001e-03,   3.84295428e-05,
          -1.40437373e-04,  -1.74543593e-03,  -3.63710192e-03,
          -5.18438551e-03,  -1.43487718e-02,  -2.22259804e-02,
          -2.08394086e-02,  -2.24071079e-02,  -1.90643734e-02,
          -2.17006825e-02,  -2.05194685e-02,  -1.44280328e-03,
          -3.46743972e-02,  -5.67135281e-02,  -7.49197359e-02,
          -1.26913848e-01,  -1.57057374e-01,  -1.35476501e-01,
          -7.15058645e-02,  -1.16507919e-02,  -2.87159107e-02,
          -4.45199189e-02,  -5.11052873e-02,  -6.22259776e-02,
          -4.41783622e-02,  -3.13016397e-02,  -4.10676179e-02,
          -4.20825393e-02,  -4.62586438e-02,  -5.44336107e-02,
          -8.41406363e-02,  -1.07264554e-01,  -1.47642559e-01,
          -2.08984446e-01,  -7.91128653e-02,   1.06768431e-02,
           7.70940427e-02,   7.11005176e-02,   8.85332602e-02,
           1.56131674e-01,   2.26606510e-01,   2.95570091e-01,
           3.58249029e-01,   4.23777616e-01,   5.45723527e-01,
           6.69472871e-01,   5.55258398e-01,   4.59428681e-01,
           5.69268333e-01,   5.34137796e-01,   2.87134347e-01,
           2.15818794e-01,  -1.92398919e-01,   8.37764034e-03,
          -1.91454711e-02,  -1.48970957e-01,  -5.32409173e-01,
          -7.30902177e-01,  -9.57634007e-01,  -1.09516804e+00,
          -1.24096079e+00,  -1.40046289e+00,  -1.31663722e+00,
          -1.11651361e+00,  -8.96431994e-01,  -9.70580807e-01,
          -9.11322912e-01,  -4.52680270e-01,   2.25480751e-02,
           8.72013304e-02,   2.57818928e-01,   1.95494475e-01,
           3.71932242e-01,   9.97986299e-01,   1.43282753e+00,
           1.33014541e+00,   1.10960685e+00,   8.12744494e-01],
        [ -8.22598457e-01,  -2.97727090e-01,  -2.06133065e-01,
          -1.70755316e-01,  -1.70740587e-01,  -2.40162037e-02,
           1.16648497e-02,  -1.37869270e-01,  -4.17228805e-01,
          -5.60251589e-01,  -7.52417247e-01,  -6.35506453e-01,
          -2.94056151e-01,  -2.17875092e-01,  -5.81850829e-02,
           7.58174260e-02,   6.59214302e-02,   2.45380402e-02,
           1.73303816e-02,  -3.60425313e-03,  -9.30715490e-03,
          -1.26451563e-02,  -1.52140017e-02,  -8.69984097e-03,
          -1.17270152e-02,  -1.13637006e-02,  -4.32205200e-03,
           1.10937048e-02,   4.01131665e-02,   6.86656811e-02,
           6.95114842e-02,   6.59488395e-02,   6.94317994e-02,
           7.10311466e-02,   6.99031265e-02,   6.80349138e-02,
           5.91137498e-02,   6.89967120e-02,   9.30835583e-03,
          -2.38222899e-02,  -4.35042911e-02,  -4.84054000e-02,
          -3.45449094e-02,  -4.89553522e-02,  -3.76740915e-02,
          -1.73135687e-02,  -3.29690863e-02,  -3.44840156e-02,
          -2.42895903e-02,  -3.43219616e-02,  -6.23101128e-02,
          -8.43714961e-02,  -1.12998609e-01,  -1.19471868e-01,
          -1.09935831e-01,  -1.78571842e-01,  -1.58152262e-01,
          -1.18862364e-01,  -1.56414103e-01,  -1.84109582e-01,
          -1.47943214e-01,  -1.66714138e-01,  -1.33813717e-01,
          -2.80935499e-02,  -3.35033558e-02,  -1.57976504e-02,
          -1.98215908e-03,   1.72023773e-02,  -1.19864640e-01,
          -2.49831871e-01,  -2.40651872e-01,  -3.13083154e-01,
          -4.43415041e-01,  -7.09413175e-01,  -9.44506963e-01,
          -1.10638505e+00,  -1.18929919e+00,  -1.20947421e+00,
          -1.22493179e+00,  -1.33110831e+00,  -1.46014242e+00,
          -1.49743430e+00,  -1.28854239e+00,  -1.12518339e+00,
          -7.29334407e-01,  -3.71138997e-01,  -2.04542937e-01,
           3.02723779e-02,   1.20620516e-01,   2.41935942e-01,
           3.60483805e-01,   1.16609796e+00,   1.77171414e+00,
           2.04114730e+00,   2.34822651e+00,   2.19805852e+00]],

       [[  9.15976630e-02,  -4.28082643e-01,  -3.64809072e-01,
          -2.91214837e-01,  -3.05052651e-01,  -2.21124932e-01,
          -8.19827892e-02,  -6.58226013e-03,   2.58937553e-01,
           4.13170815e-01,   4.05208658e-01,   2.88204582e-01,
           8.27579852e-02,   3.12856745e-02,  -6.11926891e-02,
          -5.02895073e-02,  -1.42333419e-02,   9.17646620e-05,
           1.18340386e-03,   5.91977437e-03,   7.18159146e-03,
           6.37647841e-03,   2.03929477e-02,   3.22408323e-02,
           3.72825199e-02,   2.01775586e-02,  -5.25199042e-03,
          -4.81070059e-02,  -1.36212455e-01,  -1.58511621e-01,
          -1.98958362e-01,  -1.94228914e-01,  -1.57244294e-01,
          -8.09635586e-02,   5.84468135e-02,   8.90079781e-02,
           9.88380291e-02,   3.84590714e-02,  -1.48618486e-02,
          -3.56311798e-02,  -2.76345853e-02,  -1.93875631e-02,
          -2.02801316e-02,  -3.55996026e-03,  -4.60829558e-03,
           9.42103068e-03,   8.70415016e-03,   4.27450957e-03,
          -1.54028998e-03,  -8.29873262e-03,   1.98810719e-02,
          -6.69034322e-03,  -5.59726291e-02,  -8.04602305e-02,
          -6.65356671e-02,  -6.99327963e-02,  -5.41773196e-02,
          -5.51011827e-02,  -3.21566264e-02,   1.16442928e-02,
          -1.07104690e-02,  -1.09576826e-01,  -2.26064894e-01,
          -3.51206108e-01,  -2.63885498e-01,  -2.94774020e-01,
          -2.98252918e-01,  -3.77463729e-01,  -1.37682173e-01,
          -1.92358052e-01,  -2.85671587e-01,  -3.09155570e-01,
          -1.91660634e-01,  -3.16375132e-01,  -2.92766147e-01,
          -5.81528946e-01,  -8.94472687e-01,  -1.11451806e+00,
          -9.90696730e-01,  -6.70391436e-01,  -2.17080893e-01,
          -7.48038469e-02,   6.90196708e-02,   4.05739537e-01,
           8.29826284e-01,   1.11981657e+00,   1.31201239e+00,
           1.63403762e+00,   1.98559980e+00,   1.96488833e+00,
           2.35645545e+00,   2.15564364e+00,   1.66540686e+00,
           1.55752532e+00,   1.59244375e+00,   1.49102511e+00],
        [ -1.16339556e+00,  -1.03887597e+00,  -7.53709828e-01,
          -4.05583735e-01,  -2.25109877e-01,   6.52910162e-02,
           4.49190599e-01,   5.35438855e-01,   3.50746119e-01,
           1.02676639e-01,  -1.76443877e-03,   1.06977675e-01,
           1.27729169e-01,   3.23830004e-02,  -5.34224687e-02,
          -8.78639928e-02,  -8.30212346e-02,  -3.07125515e-02,
          -3.46169648e-03,  -3.02865770e-03,  -1.01569847e-03,
          -4.69497398e-03,  -2.47361925e-03,  -6.29425049e-05,
          -2.80330799e-03,   4.41544144e-03,   9.72733674e-03,
           6.98287399e-03,  -9.33781377e-03,  -3.63928477e-02,
          -1.49938795e-02,   4.27363360e-02,   1.06382582e-01,
           1.09153324e-01,   9.38683969e-02,   7.39487542e-02,
           4.25870683e-02,  -6.43864384e-03,  -6.40395836e-03,
          -1.96042944e-02,  -4.53492624e-02,  -4.51544302e-02,
          -5.58138247e-02,  -4.31663372e-02,  -3.11143663e-02,
          -1.05247498e-02,  -2.33429096e-02,  -7.11511683e-03,
          -3.02067509e-03,  -1.00820329e-02,  -1.08397449e-02,
          -4.09260503e-03,  -1.60602993e-02,  -2.12372674e-02,
          -5.98008191e-02,  -6.27423039e-02,  -2.04472012e-02,
           7.37234751e-02,   5.99406913e-02,   7.06977844e-02,
          -1.81972362e-02,  -3.24225956e-02,   7.44480557e-03,
          -2.04953088e-02,   3.12847561e-03,  -1.23239376e-01,
          -1.53865390e-01,  -3.03961648e-01,  -3.12669401e-01,
          -3.13649495e-01,  -3.96696868e-01,  -5.00946327e-01,
          -5.35320635e-01,  -4.16026080e-01,  -3.54273478e-01,
          -3.62772059e-01,  -3.36979548e-01,  -3.66761879e-01,
          -4.05141124e-01,  -3.87227588e-01,  -4.37115846e-01,
          -6.54908357e-01,  -8.80530534e-01,  -1.05948247e+00,
          -6.80778751e-01,  -8.44186147e-02,   1.41250964e-01,
           5.03746668e-02,  -3.87550637e-02,  -2.37722962e-01,
          -2.69078537e-01,  -2.62595707e-01,  -4.81267858e-01,
          -1.08958294e+00,  -1.45534876e+00,  -1.52456806e+00],
        [  6.24256240e-01,   3.63184011e-01,  -2.02166875e-01,
          -9.64299061e-01,  -1.26213279e+00,  -1.12855530e+00,
          -7.12960314e-01,   1.44051799e-02,   6.30684323e-01,
           8.64001168e-01,   5.33826439e-01,   4.31410542e-01,
           4.03966374e-01,   2.64586131e-01,   9.69322346e-02,
           1.87270553e-02,   2.08275406e-03,   2.62083831e-05,
           1.12180357e-04,  -6.14166260e-04,   1.50616964e-03,
           9.98150861e-03,   1.84795945e-02,   2.34837709e-02,
           2.89206328e-02,   2.84249341e-02,   3.49264498e-02,
           2.96546088e-02,   1.25238631e-02,  -7.53106011e-03,
           6.28753945e-03,   5.83501745e-02,   8.88781371e-02,
           7.93674610e-02,   8.06610673e-02,   7.89381663e-02,
           7.79892957e-02,   4.29876822e-02,  -1.25796000e-02,
          -6.17358596e-02,  -8.90064946e-02,  -5.71065832e-02,
          -2.11909259e-02,  -3.59450446e-03,   7.55394830e-03,
           1.40951651e-02,  -2.69713225e-04,   1.36660823e-02,
           5.55523766e-02,   5.20463166e-02,   4.83277639e-02,
           1.05372535e-02,  -9.17844419e-03,   1.38303969e-02,
           7.24507085e-02,  -8.03862678e-03,  -3.03936711e-02,
          -2.43237813e-02,  -1.45106139e-02,  -3.52922369e-02,
          -1.16051992e-01,  -2.25200300e-01,  -3.14513454e-01,
          -3.01121076e-01,  -3.23851091e-01,  -2.27176772e-01,
          -2.32331453e-01,  -4.26442394e-01,  -4.64662199e-01,
          -6.22044952e-01,  -8.83302441e-01,  -8.77390791e-01,
          -5.31117545e-01,  -1.99830656e-01,  -4.22695548e-01,
          -3.87133952e-01,  -2.89060310e-01,  -2.27182918e-01,
          -2.56863594e-01,  -5.84991243e-01,  -8.32977260e-01,
          -8.32065547e-01,  -6.16604946e-01,  -3.46965437e-02,
           4.82832485e-01,   9.09155598e-01,   1.27009286e+00,
           1.67856082e+00,   2.31488648e+00,   3.10503077e+00,
           3.76821928e+00,   4.19009996e+00,   4.75526365e+00,
           5.61351133e+00,   6.01343310e+00,   5.91123902e+00],
        [  9.56740167e-01,   7.68774245e-01,   8.28318419e-01,
           7.75613538e-01,   1.19197143e+00,   1.62212397e+00,
           1.82044432e+00,   1.84666295e+00,   1.99456307e+00,
           2.12301413e+00,   2.23514733e+00,   2.10825115e+00,
           1.56003832e+00,   9.53459775e-01,   3.49730845e-01,
           4.69974235e-02,  -3.40035756e-02,  -6.76800057e-02,
          -4.80296523e-02,  -1.63751532e-02,  -7.15729042e-03,
          -4.31767216e-03,  -5.51908988e-03,   1.56678094e-03,
           5.69986414e-03,   5.81345735e-03,   9.84997220e-03,
           1.73927590e-02,   1.72858768e-02,   7.95759978e-03,
          -2.59683397e-02,  -1.48432696e-02,  -1.25723238e-02,
          -3.74680272e-02,  -3.07574096e-02,  -4.14282481e-02,
          -2.84253580e-02,  -4.16805126e-02,  -6.95266724e-02,
          -9.39949177e-02,  -9.91954803e-02,  -7.66963959e-02,
          -8.90266984e-02,  -5.71851377e-02,  -3.41161092e-02,
           2.32569377e-03,   1.44530402e-02,   1.87437269e-02,
           3.62998821e-02,   2.87455806e-02,   1.09800409e-02,
          -2.37171738e-02,  -4.04033661e-02,  -5.80814503e-02,
          -6.13633615e-02,  -9.54746670e-02,  -1.65553623e-02,
           1.54949330e-01,   7.31214594e-02,   5.83347744e-02,
           1.57563881e-01,   2.10483057e-01,   1.55524925e-01,
          -2.87205731e-02,  -1.42612175e-01,  -2.64423865e-01,
          -3.72209690e-01,  -3.58880220e-01,  -3.21994216e-01,
          -3.62546214e-01,  -3.41191610e-01,  -3.58398084e-01,
          -3.74227029e-01,  -3.69356650e-01,  -3.10893235e-01,
          -2.72119028e-01,  -2.24444001e-01,  -2.62521320e-01,
          -3.70167697e-01,  -4.52463715e-01,  -5.32103574e-01,
          -6.30819992e-01,  -6.53066141e-01,  -4.73506044e-01,
          -3.72824174e-01,  -2.70568000e-01,  -2.07967087e-01,
          -1.04214032e-01,  -2.24823069e-01,  -6.03847610e-01,
          -6.95897102e-01,  -7.24681925e-01,  -6.97719786e-01,
          -7.76748375e-01,  -9.61732970e-01,  -1.54122589e+00]]])
  * act      (act) <U12 'arg_min_smax' 'arg_comp'
  * lat      (lat) float64 -90.0 -88.11 -86.21 -84.32 -82.42 -80.53 -78.63 ...
  * season   (season) object 'DJF' 'JJA' 'MAM' 'SON'
In [120]:
import seaborn as sns

with sns.color_palette('Paired'):

    for seas in a.season:
        for act in a.act:
            d = a.sel(season=seas, act=act)
            plt.plot(, d, label="%s - %s" %
                     (act.values, seas.values))
<matplotlib.legend.Legend at 0x1143fc0b8>