if printtofile: fig.savefig('SICNH_seascyc_OBS.pdf') fig = plt.figure() plt.plot(hadsivcnh,'k'); plt.plot(hadsivpnh,'k--') plt.plot(cansivcnh,'g'); plt.plot(cansivpnh,'g--') plt.legend(('HadISST 1979-89','HadISST 2002-11', 'CanESM2 1979-89','CanESM2 2002-12'),'lower left') plt.title('Total Arctic Sea Ice Volume') if printtofile: fig.savefig('SICNHTotVol_seascyc_OBS.pdf') else: # calc average SST near sea-ice (where exactly?) hadsstc60N = cutl.polar_mean_areawgted3d(hadsicc,lat,lon,latlim=latlim) hadsstp60N = cutl.polar_mean_areawgted3d(hadsicp,lat,lon,latlim=latlim) hurrsstc60N = cutl.polar_mean_areawgted3d(hurrsicc,lat,lon,latlim=latlim) hurrsstp60N = cutl.polar_mean_areawgted3d(hurrsicp,lat,lon,latlim=latlim) cansstc60N = cutl.polar_mean_areawgted3d(cansicc,lat,lon,latlim=latlim) cansstp60N = cutl.polar_mean_areawgted3d(cansicp,lat,lon,latlim=latlim) fig = plt.figure() plt.plot(hadsstc60N,'k'); plt.plot(hadsstp60N,'k--') #plt.plot(hurrsstc60N,'b'); plt.plot(hurrsstp60N,'b--') # SCREWY plt.plot(cansstc60N,'g'); plt.plot(cansstp60N,'g--') plt.legend(('HadISST 1979-89','HadISST 2002-11', 'CanESM2 1979-89','CanESM2 2002-12'),'lower center') plt.title('Average SST North of ' + str(latlim) + 'N') if printtofile: fig.savefig('SST' + str(latlim) + 'N_seascyc_OBS.pdf')
lat = cnc.getNCvar(fnamec,'lat') lon = cnc.getNCvar(fnamec,'lon') fldcclim,fldcstd = cutl.climatologize3d(fldc) fldp1clim,fldp1std = cutl.climatologize3d(fldp1) fldp2clim,fldp2std = cutl.climatologize3d(fldp2) fldp3clim,fldp3std = cutl.climatologize3d(fldp3) if avgtype == 'gt' + str(latlim) + 'Nmasked': print avgtype + '!!!' fldc = ma.masked_where(fldc==0,fldc) fldp1 = ma.masked_where(fldp1==0,fldp1) fldp2 = ma.masked_where(fldp2==0,fldp2) fldp3 = ma.masked_where(fldp3==0,fldp3) fldcpm = cutl.polar_mean_areawgted3d(fldc,lat,lon,latlim=latlim) fldp1pm = cutl.polar_mean_areawgted3d(fldp1,lat,lon,latlim=latlim) fldp2pm = cutl.polar_mean_areawgted3d(fldp2,lat,lon,latlim=latlim) fldp3pm = cutl.polar_mean_areawgted3d(fldp3,lat,lon,latlim=latlim) # calculate polar mean statistics tstatp1 = np.arange(1,13,dtype=float)*0 pvalp1 = np.arange(1,13,dtype=float)*0 tstatp2 = np.arange(1,13,dtype=float)*0 pvalp2 = np.arange(1,13,dtype=float)*0 tstatp3 = np.arange(1,13,dtype=float)*0 pvalp3 = np.arange(1,13,dtype=float)*0 for midx in range(0,12):
# # # ##################### Do calculations ################# # annual time-series (3d) anntsc = cutl.annualize_monthlyts(fldc) anntsp1 = cutl.annualize_monthlyts(fldp1) anntsp2 = cutl.annualize_monthlyts(fldp2) anntsp3 = cutl.annualize_monthlyts(fldp3) # annual global mean time-series anngmc = cutl.global_mean_areawgted3d(anntsc, lat, lon) anngmp1 = cutl.global_mean_areawgted3d(anntsp1, lat, lon) anngmp2 = cutl.global_mean_areawgted3d(anntsp2, lat, lon) anngmp3 = cutl.global_mean_areawgted3d(anntsp3, lat, lon) # annual polar (>=60N) mean time-series annpmc = cutl.polar_mean_areawgted3d(anntsc, lat, lon) annpmp1 = cutl.polar_mean_areawgted3d(anntsp1, lat, lon) annpmp2 = cutl.polar_mean_areawgted3d(anntsp2, lat, lon) annpmp3 = cutl.polar_mean_areawgted3d(anntsp3, lat, lon) # global mean annual mean time mean anngmtmc = np.mean(anngmc) anngmtmp1 = np.mean(anngmp1) anngmtmp2 = np.mean(anngmp2) anngmtmp3 = np.mean(anngmp3) # monthly global mean time-series gmc = cutl.global_mean_areawgted3d(fldc, lat, lon) gmp1 = cutl.global_mean_areawgted3d(fldp1, lat, lon) gmp2 = cutl.global_mean_areawgted3d(fldp2, lat, lon)
# calc sea ice area # mult fraction by grid cell area & sum areas = cutl.calc_cellareas(lat,lon) careasp = np.tile(areas,(cfldp.shape[0],1,1)) # need one per time careasc = np.tile(areas,(cfldc.shape[0],1,1)) # need one per month (climo) cfldc = cfldc*careasc cfldp = cfldp*careasp cfldcall[eii-1,:] = np.sum(np.sum(cfldc[:,lat>0,:],2),1) # NH total ice area cfldpall[eii-1,:] = np.sum(np.sum(cfldp[:,lat>0,:],2),1) # NH total ice area else: latlim = 60 # 60N # just do polar mean for now print 'doing polar mean of ' + cfield cfldcall[eii-1,:] = cutl.polar_mean_areawgted3d(cfldc,lat,lon,latlim=latlim) cfldpall[eii-1,:] = cutl.polar_mean_areawgted3d(cfldp,lat,lon,latlim=latlim) # Now get obs for sea ice if cfield=='sic': # sea ice concentration fhadsicc = basepath2 + 'HadISST/hadisst1.1_bc_128_64_1870_2013m03_sicn_' +\ ctimstr + 'climo.nc' #SICN, 129x64 CLIMO fhadsicp = basepath2 + 'HadISST/hadisst1.1_bc_128_64_1870_2013m03_sicn_1870010100-2013030100.nc' fnsidcsicc = basepath2 + 'NSIDC/nsidc_bt_128x64_1978m11_2011m12_sicn_' + ctimstr + 'climo.nc' fnsidcsicp = basepath2 + 'NSIDC/nsidc_bt_128x64_1978m11_2011m12_sicn_1978111600-2011121612.nc' #SICN, 129x64 # nsidc_bt_128x64_1978m11_2011m12_sicn_1978111600-2011121612.nc