### Alott time series yearmin = 2006 yearmax = 2080 years = np.arange(yearmin, yearmax + 1, 1) months = [ r'Jan', r'Feb', r'Mar', r'Apr', r'May', r'Jun', r'Jul', r'Aug', r'Sep', r'Oct', r'Nov', r'Dec' ] yearslens = np.arange(1920, 2080 + 1, 1) yearsclimo = np.arange(1981, 2010 + 1, 1) ense = ['02','03','04','05','06','07','08','09'] + \ map(str,np.arange(10,36,1)) + map(str,np.arange(101,106,1)) ### Read in functions sitqq, lat2, lon2 = lens.readLENSEnsemble(directorydatal, 0.15, 'rcp85') lats = np.unique(lat2) lons = np.unique(lon2) trendd = True if trendd == True: def deTrend(y): x = np.arange(y.shape[0]) slopes = np.empty((y.shape[1], y.shape[2])) intercepts = np.empty((y.shape[1], y.shape[2])) for i in xrange(y.shape[1]): for j in xrange(y.shape[2]): mask = np.isfinite(y[:, i, j]) yy = y[:, i, j]
### Alott time series yearmin = 1979 yearmax = 2015 years = np.arange(yearmin, yearmax + 1, 1) months = [ r'Jan', r'Feb', r'Mar', r'Apr', r'May', r'Jun', r'Jul', r'Aug', r'Sep', r'Oct', r'Nov', r'Dec' ] yearslens = np.arange(1920, 2080 + 1, 1) yearsclimo = np.arange(1981, 2010 + 1, 1) ense = ['02','03','04','05','06','07','08','09'] + \ map(str,np.arange(10,36,1)) + map(str,np.arange(101,106,1)) ### Read in functions sithq, lat2, lon2 = lens.readLENSEnsemble(directorydatal, 0.15, 'historical') sitf, lat2, lon2 = lens.readLENSEnsemble(directorydatal, 0.15, 'rcp85') lats = np.unique(lat2) lons = np.unique(lon2) sitalln = np.append(sithq, sitf, axis=1) yearsq = np.where((yearslens >= 1979) & (yearslens <= 2015))[0] sitallq = sitalln[:, yearsq, :, :, :] def readPIOMAS(directorydata, threshold): files = 'piomas_regrid_sit_LENS_19792015.nc' filename = directorydata + files data = Dataset(filename)
titletime = currentmn + '/' + currentdy + '/' + currentyr print '\n' '----Plot LENS Correlations - %s----' % titletime ### Alott time series year1 = 1920 year2 = 2080 years = np.arange(year1, year2 + 1, 1) months = [ r'Jan', r'Feb', r'Mar', r'Apr', r'May', r'Jun', r'Jul', r'Aug', r'Sep', r'Oct', r'Nov', r'Dec' ] ense = ['02','03','04','05','06','07','08','09'] + \ map(str,np.arange(10,36,1)) + map(str,np.arange(101,106,1)) #### Read in functions sith, lats, lons = lens.readLENSEnsemble(directorydataSIT, 0.15, 'historical') sitf, lats, lons = lens.readLENSEnsemble(directorydataSIT, 0.15, 'rcp85') ### Read T2M data = Dataset(directorydataN + 'lens_regrid_T2M_19202080.nc') tasall = data.variables['T2M'][:] data.close() ### Combine SIT periods sitall = np.append(sith, sitf, axis=1) #### 2D lat/lon arrays lons, lats = np.meshgrid(lons, lats) ### Plot figure plt.rc('text', usetex=True)
map(str,np.arange(10,36,1)) + map(str,np.arange(101,106,1)) ### Alott time series year1 = 1920 year2 = 2080 months = [r'Jan',r'Feb',r'Mar',r'Apr',r'May',r'Jun',r'Jul',r'Aug', r'Sep',r'Oct',r'Nov',r'Dec'] yearslens = np.arange(year1,year2+1,1) yearsclimo = np.arange(1981,2010+1,1) ### Select variable variable = 'SLP' ### Read in functions var,lats1,lons1 = LV.readLENSEnsemble(directorydataL,variable) sith,lats2,lons2 = lens.readLENSEnsemble(directorydataSIT,0.15,'historical') ### 2D lat/lon arrays lons2,lats2 = np.meshgrid(lons2,lats2) lons1,lats1 = np.meshgrid(lons1,lats1) ########################################################################### ########################################################################### ########################################################################### ### Regrid def regrid(lat1,lon1,lat2,lon2,var,years): """ Interpolated on selected grid. [year,month,lat,lon] """
### Mask out threshold values if threshold == 'None': sitp[np.where(sitp < 0)] = np.nan sitp[np.where(sitp > 12)] = np.nan else: sitp[np.where(sitp < threshold)] = np.nan sitp[np.where(sitp < 0)] = np.nan sitp[np.where(sitp > 12)] = np.nan print 'Completed: Read PIOMAS SIT!' return sitp #### Call functions sit, lats, lons = lens.readLENSEnsemble(directorydatal, 0.15, 'rcp85') lons, lats = np.meshgrid(lons, lats) sitp = readPIOMAS(directorydatap, 0.15) def weightThick(var, lats, types): """ Area weights sit array 5d [ens,year,month,lat,lon] into [ens,year,month] """ if types == 'lens': sityr = np.empty((var.shape[0], var.shape[1], var.shape[2])) for ens in xrange(var.shape[0]): for i in xrange(var.shape[1]): for j in xrange(var.shape[2]):