<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Illustrates the use of the WR (Weather Regime) class
Step1:  import the development version of paleopy
Step2:  instantiates a proxy with the required parameters
Step3:  find the analogs
Step4:  print the updated proxy features
Step5:  Now instantiates a WR class, passing the proxy object
Step6:  WR frequency changes associated with the analog years for Kidson types
Step7:  plots the bar plot, significance level = 99%
Step8:  WR frequency changes associated with the analog years for the SW Pacific regimes  = SW Pacific
Step9:  plots the bar plot, significance level = 99%
Step10:  this is consistent with the known relationships between the SW Pacific regimes and the large-scale SST anomalies
Step11:  now passing an ensemble object
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from matplotlib import pyplot as plt
import pandas as pd
Explanation: Illustrates the use of the WR (Weather Regime) class
End of explanation
import sys
sys.path.insert(0, '../')
from paleopy import proxy
from paleopy import analogs
from paleopy import ensemble
djsons = '../jsons/'
pjsons = '../jsons/proxies'
Explanation: import the development version of paleopy
End of explanation
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 = True, \
          detrend = True)
Explanation: instantiates a proxy with the required parameters
End of explanation
p.find_analogs()
Explanation: find the analogs
End of explanation
p.proxy_repr(pprint=True)
Explanation: print the updated proxy features
End of explanation
from paleopy import WR
Explanation: Now instantiates a WR class, passing the proxy object
End of explanation
w = WR(p, classification='New Zealand')
Explanation: WR frequency changes associated with the analog years for Kidson types: classifation = New Zealand
End of explanation
f = w.plot_bar(sig=1)
f.savefig('/Users/nicolasf/Desktop/proxy.png')
Explanation: plots the bar plot, significance level = 99%
End of explanation
w = WR(p, classification='SW Pacific')
Explanation: WR frequency changes associated with the analog years for the SW Pacific regimes  = SW Pacific
End of explanation
f = w.plot_bar(sig=1)
Explanation: plots the bar plot, significance level = 99%
End of explanation
w.df_probs
Explanation: this is consistent with the known relationships between the SW Pacific regimes and the large-scale SST anomalies: 
i.e. the SW#4 is strongly positively correlated to a La Niña pattern in the ERSST / SST (see e.g. the proxy.ipynb notebook), and here we show that warm anomalies in Rarotonga are related to increased probability of the SW Pacific regime #4. On the other hand, SW#1 and SW#3 see their probability reduced, consistent with their positive correlation with El Niño patterns.
End of explanation
ens = ensemble(djsons=djsons, pjsons=pjsons, season='DJF')
classification = 'SW Pacific'
w = WR(ens, classification=classification)
w.parent.description
w.climatology
w.probs_anomalies(kind='many')
w.df_anoms
f = w.plot_heatmap()
f = w.plot_bar()
w.df_anoms.to_csv('/Users/nicolasf/Desktop/table.csv')
w.df_probs_MC
Explanation: now passing an ensemble object
End of explanation
<END_TASK>