illustrates the use of the indices class


In [1]:
%matplotlib inline
import matplotlib.pyplot as plt

In [2]:
import sys

import the development version of paleopy


In [3]:
sys.path.append('../')

In [4]:
from paleopy import proxy 
from paleopy import analogs
from paleopy.plotting import indices

first example, defines one proxy


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

In [7]:
p = proxy(sitename='Rarotonga', \
          lon = -159.82, \
          lat = -21.23, \
          djsons = djsons, \
          pjsons = pjsons, \
          pfname = 'Rarotonga.json', \
          dataset = 'ersst', \
          variable ='sst', \
          measurement ='delta O18', \
          dating_convention = 'absolute', \
          calendar = 'gregorian',\
          chronology = 'historic', \
          season = 'DJF', \
          value = 0.6, \
          calc_anoms = 1, \
          detrend = 1)

In [8]:
p.find_analogs()

In [9]:
p.analog_years


Out[9]:
array([1982, 1997, 1999, 2000, 2001, 2006, 2009], dtype=int32)

In [10]:
p.analogs


Out[10]:
d_anomalies cat weights
time
1982-02-15 0.638992 WA 0.156455
1997-02-15 0.747619 WA 0.128005
1999-02-15 0.736547 WA 0.130905
2000-02-15 0.612678 WA 0.163346
2001-02-15 0.565475 WA 0.157625
2006-02-15 0.429462 WA 0.122003
2009-02-15 0.504521 WA 0.141661

In [11]:
f = p.plot_season_ts()



In [12]:
p.proxy_repr(pprint=True)


{
sitename:Rarotonga
proxy_type:None
measurement:delta O18
dating_convention:absolute
calendar:gregorian
chronology:historic
coords:(200.18, -21.23)
aspect:None
elevation:None
season:DJF
dataset:ersst
variable:sst
calc_anoms:True
detrend:True
value:0.6
climatology:(1981, 2010)
period:(1979, 2014)
extracted_coords:[200.0, -22.0]
distance_point:87.56368858840081
trend_params:{'slope': 0.030535947029886677, 'intercept': -60.965016377755163}
category:WA
analog_years:[1982, 1997, 1999, 2000, 2001, 2006, 2009]
weights:[0.15645480307020584, 0.12800536294956205, 0.13090508326029401, 0.16334634614636281, 0.15762466128135916, 0.1220029495538857, 0.1416607937383304]
}

In [13]:
indice = indices(p)

In [14]:
indice.composite()

In [15]:
indice.compos.std()


Out[15]:
NINO34    0.555699
SAM       1.001978
IOD       0.760739
SOI       0.372481
dtype: float64

In [16]:
f = indices(p).plot()


second example, we use an ensemble instance


In [18]:
from paleopy import ensemble

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

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

In [21]:
f = indices(ens).plot()



In [29]:
obj = indices(p)

In [30]:
obj.composite()

In [31]:
obj.compos


Out[31]:
NINO34 SAM IOD SOI
1982-02-01 0.032729 1.001330 0.544804 0.471084
1997-02-01 -0.365314 0.124978 -0.181042 0.813785
1999-02-01 -1.375472 1.252810 -0.907732 1.347353
2000-02-01 -1.569476 1.533521 0.434085 1.066006
2001-02-01 -0.589422 -0.816528 1.131153 0.970974
2006-02-01 -0.719873 -1.017501 -0.851495 0.415971
2009-02-01 -0.696459 0.691977 0.418646 1.319047

In [ ]: