illustrates the use of the ensemble and analogs classes


In [1]:
%matplotlib inline

adds paleopy to the Python path


In [2]:
import sys

In [3]:
sys.path.insert(0, '../')

In [4]:
from paleopy import ensemble
from paleopy import analogs
from paleopy.plotting import scalar_plot

where to find the jsons defining the datasets, and the proxies jsons


In [5]:
djsons = '../jsons/'
pjsons = '../jsons/proxies'

instantiates an ensemble class


In [6]:
ens = ensemble(djsons=djsons, pjsons=pjsons, season='DJF')

calculates the analog composite in the ERSST SSTs, uses all repeated years (the default)


In [7]:
sst = analogs(ens, 'ersst', 'sst').composite()

plots


In [8]:
f = scalar_plot(sst, test=0.1, proj='cyl').plot()


close the files


In [9]:
sst.close()

calculates the analog composite the NCEP Z1000


In [10]:
hgt = analogs(ens, 'ncep', 'hgt_1000').composite()

In [11]:
f = scalar_plot(hgt, test=0.1, proj='moll').plot()


Warning: Cannot label meridians on Mollweide basemap

In [12]:
m = scalar_plot(hgt, test=0.1, proj='merc', domain=[0., 360., -89.9, 89.9])

In [13]:
m = scalar_plot(hgt, test=0.1, proj='spstere', domain=[0., 360., -89.9, 89.9]).plot()



In [14]:
hgt.dset


Out[14]:
<xarray.Dataset>
Dimensions:              (latitudes: 73, longitudes: 144, years: 206)
Coordinates:
  * longitudes           (longitudes) float32 0.0 2.5 5.0 7.5 10.0 12.5 15.0 ...
  * latitudes            (latitudes) float32 90.0 87.5 85.0 82.5 80.0 77.5 ...
  * years                (years) int64 2014 2001 2003 1997 1987 2013 1983 ...
Data variables:
    composite_sample     (years, latitudes, longitudes) float64 7.553 7.553 ...
    composite_anomalies  (latitudes, longitudes) float64 0.8701 0.8701 ...
    weights              (years) float64 0.1419 0.1349 0.1321 0.1291 0.126 ...
    pvalues              (latitudes, longitudes) float64 0.8912 0.8912 ...

In [15]:
hgt.save_to_file('/Users/nicolasf/Desktop/hgt.nc')

In [16]:
hgt.locations


Out[16]:
{'Amedee': [166.0, -22.0],
 'Avoca': [172.5, -42.5],
 'Boundary Stream Tarn': [170.1, -44.05],
 'Browning Creek': [170.0, -45.0],
 'Cameron': [172.5, -42.5],
 'Caples': [167.5, -45.0],
 'Cass': [170.0, -42.5],
 'Clarke': [170.0, -45.0],
 'Crow': [170.0, -42.5],
 'Crow Glacier': [171.0, -43.35],
 'Falls Creek': [167.5, -45.0],
 'Frances': [167.5, -45.0],
 'Fraser': [167.5, -45.0],
 'Greenlaw': [172.5, -42.5],
 'Gunn': [170.0, -42.5],
 'Hopkins': [170.0, -45.0],
 'Hunter': [170.0, -45.0],
 'Jollie': [170.0, -42.5],
 'Mistake': [167.5, -45.0],
 'Oroko': [170.0, -42.5],
 'Pear Drop': [170.0, -45.0],
 'Pyke': [167.5, -45.0],
 'Rarotonga': [200.0, -22.0],
 'Taramakau': [172.5, -42.5],
 'Temple': [170.0, -45.0],
 'Turnbull': [170.0, -45.0]}

closes the associated xray datasets


In [17]:
hgt.close()

In [ ]: