<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Compute correlation maps nino3-Sea Level Pressure
Correlation analysis are often used to examine climatological systems such as teleconnections. In this notebook, we will calculate the corelationship between ssta anomalies in nino3 area and mean sea level pressure(MSLP). 
SLP Data Source
Step1:  2. Read nino3 SSTA series
Please keep in mind that the nino3 SSTA series lies between 1970 and 1999 <br>
Recall ex2
Step2:  3. Read monthly mean sea levep pressure
Step3:  4. Remove SLP seasonal cycle
Step4:  5. Calculate correlationship between ssta and slp
Step5:  6. Visualize
Correlation and correlation at 5% significant level
<ASSISTANT_TASK:>
Python Code:
% matplotlib inline
import numpy as np
from scipy.stats import pearsonr
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from netCDF4 import Dataset as netcdf # netcdf4-python module
from matplotlib.pylab import rcParams
rcParams['figure.figsize'] = 15, 9
Explanation: Compute correlation maps nino3-Sea Level Pressure
Correlation analysis are often used to examine climatological systems such as teleconnections. In this notebook, we will calculate the corelationship between ssta anomalies in nino3 area and mean sea level pressure(MSLP). 
SLP Data Source:
Brief Description:
NCEP/NCAR Reanalysis 1
Temporal Coverage:
4-times daily, daily and monthly values for 1948/01/01 to present
Spatial Coverage:
2.5 degree latitude x 2.5 degree longitude global grid (144x73) <br>
90N - 90S, 0E - 357.5E
See more from https://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.surface.html
1. Load basic libs
End of explanation
npzfile = np.load('data/ssta.nino3.30y.npz')
npzfile.files
ssta_series = npzfile['ssta_series']
ssta_series.shape
Explanation: 2. Read nino3 SSTA series
Please keep in mind that the nino3 SSTA series lies between 1970 and 1999 <br>
Recall ex2
End of explanation
ncset= netcdf(r'data/slp.mon.mean.1970.1999.nc')
lons = ncset['lon'][:]  
lats = ncset['lat'][:]            
slp = ncset['slp'][:,:,:]   
nt,nlat,nlon = slp.shape
ngrd = nlat*nlon
nyr  = nt/12
Explanation: 3. Read monthly mean sea levep pressure
End of explanation
slp_grd  = slp.reshape((12,nyr, ngrd), order='F').transpose((1,0,2))
slp_clim = np.mean(slp_grd, axis=0)
slp_anom = (slp_grd - slp_clim).transpose((1,0,2)).reshape((nt, ngrd), order='F')
slp_anom[:,1].shape
Explanation: 4. Remove SLP seasonal cycle
End of explanation
corr = np.zeros((1, ngrd))
pval = np.zeros((1, ngrd))
for igrd in np.arange(ngrd):
    crr,pvalue = pearsonr(ssta_series[:,0], slp_anom[:,igrd])
    corr[0,igrd] = crr
    pval[0,igrd] = pvalue   
corr = corr.reshape((nlat,nlon), order='F')
pval = pval.reshape((nlat,nlon), order='F')
Explanation: 5. Calculate correlationship between ssta and slp
End of explanation
# Correlation
m = Basemap(projection='cyl', llcrnrlon=min(lons), llcrnrlat=min(lats),
        urcrnrlon=max(lons), urcrnrlat=max(lats))
x, y = m(*np.meshgrid(lons, lats))
clevs = np.linspace(-1.0, 1.0, 21)
fig = plt.figure(figsize=(15,12))
ax = fig.add_subplot(211)
cs = m.contourf(x, y, corr.squeeze(), clevs, cmap=plt.cm.RdBu_r)
m.drawcoastlines()
cb = m.colorbar(cs)
cb.set_label('Correlation', fontsize=12)
ax.set_title('HCM Nino3-SLP', fontsize=16)
#correlation at 5% significant level
ax = fig.add_subplot(212)
corr_sig = np.ma.masked_array(corr, mask=(pval>=0.05))
cs = m.contourf(x, y, corr_sig.squeeze(), clevs, cmap=plt.cm.RdBu_r)
m.drawcoastlines()
cb = m.colorbar(cs)
cb.set_label('Correlation', fontsize=12)
ax.set_title('HCM Nino3-SLP (sign at 0.05)', fontsize=16)
Explanation: 6. Visualize
Correlation and correlation at 5% significant level
End of explanation
<END_TASK>