Changeset 50
- Timestamp:
- 08/06/14 18:06:12 (10 years ago)
- Location:
- trunk/src/scripts_Laura/ARCTIC/Travail_CEN
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scripts_Laura/ARCTIC/Travail_CEN/map_statistic_parameters.py
r49 r50 78 78 79 79 80 ################################################ 81 # calculate gradient ratio for two frequencies # 82 ################################################ 83 grad_ratio = np.zeros([M, ny, nx], float) 84 for imo in range (0, M): 85 for ilat in range (0, ny): 86 for ilon in range (0, nx): 87 grad_ratio[imo, ilat, ilon] = (ice_spec[0, imo, ilat, ilon] - ice_spec[3, imo, ilat, ilon]) / (ice_spec[0, imo, ilat, ilon] + ice_spec[3, imo, ilat, ilon]) 88 89 90 # test: 80 ''' 81 ############### 82 # map anomaly # 83 ############### 84 print 'map monthly anomaly' 91 85 ion() 92 86 x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() … … 94 88 y_coast = y_ind 95 89 z_coast = z_ind 96 ifr = 0 97 for imo in range (0, M): 98 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, anom_ratio[ifr, imo, :, :], anom_ratio[ifr, imo,:,:][nonzero(isnan(anom_ratio[ifr, imo,:,:]) == False)].min(), anom_ratio[ifr, imo, :, :][nonzero(isnan(anom_ratio[ifr, imo , :, :]) == False)].max(), 0.001, cm.s3pcpn_l_r, 'Anomaly of emissivity ratio') 90 ifr = 0 # anomaly of emissivity ratio from AMSUA89GHz database 91 for imo in range (0, M): 92 print 'month ' + str(month[imo]) 93 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, anom_spec[ifr, imo, :, :], anom_spec[ifr, imo,:,:][nonzero(isnan(anom_spec[ifr, imo,:,:]) == False)].min(), anom_spec[ifr, imo, :, :][nonzero(isnan(anom_spec[ifr, imo , :, :]) == False)].max(), 0.001, cm.s3pcpn_l_r, 'Anomaly of emissivity spec') 99 94 title('AMSUA ' + str(frequ[ifr]) + 'GHz - ' + str(month[imo]) + ' 2009') 100 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/anomaly_ratio_map_AMSUA' + str(frequ[ifr]) + '_with_AMSUA23-and-30-spec_'+str(month[imo])+'_2009.png') 95 print 'save figure in .png file' 96 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/emiss_anomaly/spec/anomaly_spec_map_AMSUA' + str(frequ[ifr]) + '_with_AMSUA23-and-30-spec_'+str(month[imo])+'_2009.png') 101 97 #cm.s3pcpn_l_r 102 103 104 105 98 ''' 99 100 101 ################################################ 102 # calculate gradient ratio for two frequencies # 103 ################################################ 104 print 'calculate gradient ratio' 105 grad_ratio = np.zeros([M, ny, nx], float) 106 hist_ratio = np.zeros([M, 50], float) 107 corresp_ratio = np.zeros([M, 50], float) 108 for imo in range (0, M): 109 print 'month ' + month[imo] 110 for ilat in range (0, ny): 111 for ilon in range (0, nx): 112 grad_ratio[imo, ilat, ilon] = (ice_spec[0, imo, ilat, ilon] - ice_spec[3, imo, ilat, ilon]) / (ice_spec[0, imo, ilat, ilon] + ice_spec[3, imo, ilat, ilon]) 113 ''' 114 # compute histogram distribution of gradient ratio to find characteristic threshold 115 grad_ratio_vec = reshape(grad_ratio[imo, :, :], size(grad_ratio[imo, :, :]))[nonzero(isnan(reshape(grad_ratio[imo, :, :], size(grad_ratio[imo, :, :]))) == False)] 116 hist_ratio[imo, :] = hist(grad_ratio_vec, bins = 50, normed = True, histtype='step')[0] 117 for ibin in range (0, 50): 118 corresp_ratio[imo, ibin] = mean(hist(grad_ratio_vec, bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 119 120 # plot histogram 121 c = np.array(['r', 'b', 'c', 'm', 'y', 'g']) 122 figure() 123 for imo in range (0, 6): 124 plot(corresp_ratio[imo], hist_ratio[imo], c = str(c[imo]), label = str(month[imo])) 125 126 grid() 127 xlim(corresp_ratio.min(), corresp_ratio.max()) 128 xlabel('emissivity ratio') 129 ylabel('frequency of occurence') 130 fontP = FontProperties() 131 fontP.set_size('small') 132 legend(loc = 2, prop = fontP) 133 #plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_spec_AMSUA' + str(frequ) + '_JANUARY-JUNE_2009.png') 134 ## plot six following months of spec emissivity histograms ## 135 figure() 136 for imo in range (6, M): 137 plot(corresp_ratio[imo], hist_ratio[imo], c = str(c[imo - 6]), label = str(month[imo])) 138 139 grid() 140 xlim(corresp_ratio.min(), corresp_ratio.max()) 141 xlabel('emissivity ratio') 142 ylabel('frequency of occurence') 143 legend(loc = 1, prop = fontP) 144 #plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_spec_AMSUA' + str(frequ) + '_JULY-DECEMBER_2009.png') 145 ''' 146 147 ################################ 148 # map cumulation of parameters # 149 ################################ 150 cumul1 = anom_spec[0, :, :, :] - grad_ratio # correlation 151 cumul2 = anom_spec[3, :, :, :] + grad_ratio # anti correlation 152 cumul3 = anom_spec[3, :, :, :] + anom_ratio[3, :, :, :] # anti correlation 153 cumul4 = abs(anom_spec[0, :, :, :]) + abs(anom_spec[3, :, :, :]) + abs(grad_ratio) + abs(anom_ratio[3, :, :, :]) 154 155 156 157 158 ion() 159 x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() 160 x_coast = x_ind 161 y_coast = y_ind 162 z_coast = z_ind 163 for imo in range (0, M): 164 ''' 165 # map cumul1 166 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, cumul1[imo, :, :], -0.25, 0.14, 0.01, cm.s3pcpn_l_r, 'Cumulation [emis spec anomaly 23 - grad ratio 23-89]') 167 title('AMSUA - ' + month[imo] + ' 2009') 168 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/cumul_params/map_cumulation_spec-anom-23_grad-ratio_' + month[imo] +'2009.png') 169 # map cumul2 170 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, cumul2[imo, :, :], -0.17, 0.17, 0.01, cm.s3pcpn_l_r, 'Cumulation [emis spec anomaly 89 + grad ratio 23-89]') 171 title('AMSUA - ' + month[imo] + ' 2009') 172 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/cumul_params/map_cumulation_spec-anom-89_grad-ratio_' + month[imo] +'2009.png') 173 # map cumul3 174 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, cumul3[imo, :, :], -5.46, 2.14, 0.01, cm.s3pcpn_l_r, 'Cumulation [emis spec anomaly 89 + emis ratio 89]') 175 title('AMSUA - ' + month[imo] + ' 2009') 176 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/cumul_params/map_cumulation_spec-anom-89_ratio-anom-89_' + month[imo] +'2009.png') 177 ''' 178 # map cumul4 179 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, cumul4[imo, :, :], cumul4[imo, :, :][nonzero(isnan(cumul4[imo, :, :]) == False)].min(), cumul4[imo, :, :][nonzero(isnan(cumul4[imo, :, :]) == False)].max(), 0.1, cm.s3pcpn_l_r, 'Cumulation all parameters') 180 title('AMSUA - ' + month[imo] + ' 2009') 181 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/cumul_params/map_cumulation_all_parameters_' + month[imo] +'2009.png') 182 183 184 185 186 187 ''' 188 figure() 189 scatter(x_coast, y_coast, c = z_coast, s = volume) 190 #cmap = cm.s3pcpn_l_r 191 levels = np.arange(-1, 11, 1) 192 cs = contour(xvec, yvec, cumul[imo, :, :]) 193 cs = contour(xvec, yvec, new_anom_spec0[imo, :, :], levels) 194 cs = contour(xvec, yvec, new_anom_ratio[imo, :, :], levels) 195 cs = contour(xvec, yvec, new_grad_ratio[imo, :, :], levels) 196 cbar = colorbar(cs, ticks = [-1, 0, 1, 2, 3, 4, 5]) 197 cbar.ax.set_yticklabels(['emis_spec_89', 'emis_spec_23', 'emis_ratio_89', 'grad_ratio_23-89', '-']) 198 #cbar.set_label(text) 199 xlim(-3500, 2700.) 200 ylim(-4000, 2800.) 201 ''' 202 203 204 205 206 207 208 209 ''' 210 ############################################ 211 # time evolution (monthly) in a given zone # 212 ############################################ 213 # read monthly std of emis 214 ifr = 3 215 fichier_temporal_std = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_mean-std_data_lamb_spec_near_nadir_AMSUB' + str(frequ[ifr]) + '_' + month[imo] + '2009.nc', 'r', format='NETCDF3_CLASSIC') 216 217 218 219 #zone 1 : yi = 400. // yf = 720. // xi = -1080. // xf = -920. (Canadian Archipelago) 220 #zone 2 : yi = 920. // yf = 1280. // xi = -720. // xf = -560. (Chukchi Sea, Bering Detroit) 221 # select borders of zone 222 yi = 920. 223 yf = 1280. 224 xi = -720. 225 xf = -560. 226 #find corresponding index in xvec and yvec 227 xxi = np.where(xvec == xi)[0][0] 228 xxf = np.where(xvec == xf)[0][0] 229 yyi = np.where(yvec == yi)[0][0] 230 yyf = np.where(yvec == yf)[0][0] 231 232 # define vectors 233 anom_spec0_zone = np.zeros([M], float) 234 anom_spec3_zone = np.zeros([M], float) 235 anom_ratio_zone = np.zeros([M], float) 236 grad_ratio_zone = np.zeros([M], float) 237 std_as0 = np.zeros([M], float) 238 std_as3 = np.zeros([M], float) 239 std_ar = np.zeros([M], float) 240 std_gr = np.zeros([M], float) 241 for imo in range (0, M): 242 # anom spec emis from 23GHz 243 anom_spec0_vec = reshape(anom_spec[0, imo, yyi : yyf + 1, xxi : xxf + 1], size(anom_spec[0, imo, yyi : yyf + 1, xxi : xxf + 1])) 244 if (len(anom_spec0_vec[nonzero(isnan(anom_spec0_vec) == True)]) != 0): 245 anom_spec0_zone[imo] = NaN 246 std_as0[imo] = NaN 247 anom_spec3_zone[imo] = NaN 248 std_as3[imo] = NaN 249 anom_ratio_zone[imo] = NaN 250 std_ar[imo] = NaN 251 grad_ratio_zone[imo] = NaN 252 std_gr[imo] = NaN 253 continue 254 else: 255 anom_spec0_zone[imo] = anom_spec0_vec.mean() 256 std_as0[imo] = sqrt((1. / (size(anom_spec[0, imo, yyi : yyf + 1, xxi : xxf + 1]) - 1.)) * sum((anom_spec0_vec[:] - anom_spec0_zone[imo])**2)) 257 # anom spec emis from 89GHz 258 anom_spec3_vec = reshape(anom_spec[3, imo, yyi : yyf + 1, xxi : xxf + 1], size(anom_spec[3, imo, yyi : yyf + 1, xxi : xxf + 1])) 259 anom_spec3_zone[imo] = anom_spec3_vec.mean() 260 std_as3[imo] = sqrt((1. / (size(anom_spec[3, imo, yyi : yyf + 1, xxi : xxf + 1]) - 1.)) * sum((anom_spec3_vec[:] - anom_spec3_zone[imo])**2)) 261 # anom emis ratio from 89GHz 262 anom_ratio_vec = reshape(anom_ratio[3, imo, yyi : yyf + 1, xxi : xxf + 1], size(anom_ratio[3, imo, yyi : yyf + 1, xxi : xxf + 1])) 263 anom_ratio_zone[imo] = anom_ratio_vec.mean() 264 std_ar[imo] = sqrt((1. / (size(anom_ratio[3, imo, yyi : yyf + 1, xxi : xxf + 1]) - 1.)) * sum((anom_ratio_vec[:] - anom_ratio_zone[imo])**2)) 265 # gradient ratio from 23 and 89GHz 266 grad_ratio_vec = reshape(grad_ratio[imo, yyi : yyf + 1, xxi : xxf + 1], size(grad_ratio[imo, yyi : yyf + 1, xxi : xxf + 1])) 267 grad_ratio_zone[imo] = grad_ratio_vec.mean() 268 std_gr[imo] = sqrt((1. / (size(grad_ratio[imo, yyi : yyf + 1, xxi : xxf + 1]) - 1.)) * sum((grad_ratio_vec[:] - grad_ratio_zone[imo])**2)) 269 270 271 figure() 272 fontP = FontProperties() 273 fontP.set_size('small') 274 subplot(2,1,1) 275 errorbar(arange(0, M, 1), anom_spec0_zone, yerr = std_as0, label = 'emis spec anomaly 23GHz') 276 errorbar(arange(0, M, 1), anom_spec3_zone, yerr = std_as3, label = 'emis spec anomaly 89GHz') 277 errorbar(arange(0, M, 1), grad_ratio_zone, yerr = std_gr, label = 'gradient ratio 23-89GHz') 278 plot(arange(0, M, 1), np.zeros([M], float), '--k') 279 legend(loc = 3, prop = fontP) 280 grid() 281 xticks(arange(0, M, 1), month, rotation = 15) 282 xlim(-1, M) 283 subplot(2,1,2) 284 errorbar(arange(0, M, 1), anom_ratio_zone, yerr = std_ar, label = 'emis ratio anomaly 89GHz') 285 plot(arange(0, M, 1), np.zeros([M], float), '--k') 286 legend(loc = 2, prop = fontP) 287 grid() 288 xticks(arange(0, M, 1), month, rotation = 15) 289 xlim(-1, M) 290 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/study_by_zones/monthly_evolution_emis_params_zone_North_Beaufort_Sea.png') 291 ### map the selected zone ### 292 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec[xxi : xxf], yvec[yyi : yyf], grad_ratio[imo, yyi : yyf, xxi : xxf], grad_ratio[imo, yyi : yyf, xxi : xxf][nonzero(isnan(grad_ratio[imo, yyi : yyf, xxi : xxf]) == False)].min(), grad_ratio[imo, yyi : yyf, xxi : xxf][nonzero(isnan(grad_ratio[imo, yyi : yyf, xxi : xxf]) == False)].max(), 0.001, cm.s3pcpn_l_r, 'selected zone') 293 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/study_by_zones/map_zone_North_Beaufort_Sea.png') 294 ''' 295 296 297 298 ''' 106 299 ############################################################################ 107 300 # calculate correlation between anom ratio and gradient ratio (spec emiss) # 108 301 ############################################################################ 302 corr_mat = np.zeros([M, 4, 4], float) 303 for imo in range (0, M): 304 a = reshape(anom_spec[0, imo, :, :], size(anom_spec[0, imo, :, :]))[nonzero(isnan(reshape(anom_spec[0, imo, :, :], size(anom_spec[0, imo, :, :]))) == False)] 305 b = reshape(anom_spec[3, imo, :, :], size(anom_spec[3, imo, :, :]))[nonzero(isnan(reshape(anom_spec[3, imo, :, :], size(anom_spec[3, imo, :, :]))) == False)] 306 c = reshape(anom_ratio[3, imo, :, :], size(anom_ratio[3, imo, :, :]))[nonzero(isnan(reshape(anom_ratio[3, imo, :, :], size(anom_ratio[3, imo, :, :]))) == False)] 307 d = reshape(grad_ratio[imo, :, :], size(grad_ratio[imo, :, :]))[nonzero(isnan(reshape(grad_ratio[imo, :, :], size(grad_ratio[imo, :, :]))) == False)] 308 params = np.array([a, b, c, d]) 309 for ii in range (0, 4): 310 for jj in range (0, 4): 311 corr_mat[imo, ii, jj] = corrcoef(params[ii], params[jj])[0][1] 312 313 figure() 314 fontP = FontProperties() 315 fontP.set_size('small') 316 plot(arange(0, M, 1), corr_mat[:, 0, 1], 'r', label = 'spec anomaly 23GHz - spec anomaly 89GHz') 317 plot(arange(0, M, 1), corr_mat[:, 0, 2], 'g', label = 'spec anomaly 23GHz - ratio anomaly 89GHz') 318 plot(arange(0, M, 1), corr_mat[:, 0, 3], 'b', label = 'spec anomaly 23GHz - gradient ratio') 319 plot(arange(0, M, 1), corr_mat[:, 1, 2], 'c', label = 'spec anomaly 89GHz - ratio anomaly 89GHz') 320 plot(arange(0, M, 1), corr_mat[:, 1, 3], 'm', label = 'spec anomaly 89GHz - gradient ratio') 321 plot(arange(0, M, 1), corr_mat[:, 2, 3], 'y', label = 'ratio anomaly 89GHz - gradient ratio') 322 plot(arange(0, M, 1), zeros([M], float), '--k') 323 xlim(-1, M) 324 ylim(-2, 1.) 325 legend(loc = 8, prop = fontP) 326 xticks(arange(0, M, 1), month, rotation = 25) 327 yticks(np.arange(-2., 1., 0.1)) 328 grid() 329 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/correlation_params_2009.png') 330 ''' 331 332 ''' 109 333 corr_mat = np.zeros([4, ny, nx], float) 110 334 for ifr in range (0, 4): … … 117 341 title('AMSUA ' + str(frequ[ifr]) + 'GHz - year 2009') 118 342 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/correlation_map_grad-ratio_emis-spec-anom_AMSUA' + str(frequ[ifr]) + '_with_AMSUA23-and-30-spec_year2009.png') 119 343 ''' 344 345 346 347 348 349 350 351 -
trunk/src/scripts_Laura/ARCTIC/Travail_CEN/read_cartesian_gridded_AMSUA23.py
r46 r50 9 9 from netCDF4 import Dataset 10 10 import scipy.special 11 import ffgrid212 import map_ffgrid13 11 from matplotlib import colors 14 import cartesian_grid_monthly15 12 import arctic_map 16 13 import map_cartesian_grid … … 44 41 45 42 46 47 ################### 48 # Read AMSUA data # 49 ################### 50 es_a_month = np.zeros([M, ny, nx], float) 51 el_a_month = np.zeros([M, ny, nx], float) 52 esl_a_month = np.zeros([M, ny, nx], float) 53 for imo in range (0, M): 54 print 'open file ' + str(month[imo]) 55 file_amsua = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_data_lamb_spec_near_nadir_AMSUA30_' + month[imo] + '2009.nc', 'r', format='NETCDF3_CLASSIC') 56 lon_amsua = file_amsua.variables['longitude'][:] 57 lat_amsua = file_amsua.variables['latitude'][:] 58 days = file_amsua.variables['days'][:] 59 es_a = file_amsua.variables['e_spec'][:] 60 el_a = file_amsua.variables['e_lamb'][:] 61 esl_a = file_amsua.variables['e_spec_lamb'][:] 62 file_amsua.close() 63 print 'compute monthly mean of data for map' 64 for ilon in range (0, len(lon_amsua)): 65 for ilat in range (0, len(lat_amsua)): 66 es_a_month[imo, ilat, ilon] = mean(es_a[ilat, ilon, :][nonzero(isnan(es_a[ilat, ilon, :]) == False)]) 67 el_a_month[imo, ilat, ilon] = mean(el_a[ilat, ilon, :][nonzero(isnan(el_a[ilat, ilon, :]) == False)]) 68 esl_a_month[imo, ilat, ilon] = mean(esl_a[ilat, ilon, :][nonzero(isnan(esl_a[ilat, ilon, :]) == False)]) 69 70 71 print 'map of data' 72 ion() 73 x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() 74 x_coast = x_ind 75 y_coast = y_ind 76 z_coast = z_ind 77 colormap = cm.s3pcpn_l_r 78 for imo in range (0, M): 79 # emiss SPEC 80 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, es_a_month[imo, :, :], 0.45, 1.02, 0.01, colormap, 'emissivity SPEC') 81 title(month[imo] + ' 2009 - AMSUA 30GHz') 82 savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/comparison_lamb_spec/space_evolution/EMIS/cartesian_grid/emis_spec_AMSUA30_' + month[imo] + '2009.png') 83 # emis SPEC-LAMB 84 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, esl_a_month[imo, :, :], 0., 0.03, 0.001, colormap, 'emissivity LAMB - SPEC') 85 title(month[imo] + ' 2009 - AMSUA 30GHz') 86 savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/comparison_lamb_spec/space_evolution/EMIS/cartesian_grid/emis_spec-lamb_AMSUA30_' + month[imo] + '2009.png') 43 frequ = np.array(['23', '30', '50', '89']) 44 for ifr in range (3, 4): 45 print 'frequency ' + str(frequ[ifr]) + 'GHz' 46 ################### 47 # Read AMSUA data # 48 ################### 49 es_month = np.zeros([M, ny, nx], float) 50 el_month = np.zeros([M, ny, nx], float) 51 esl_month = np.zeros([M, ny, nx], float) 52 std_es_month = np.zeros([M, ny, nx], float) 53 std_el_month = np.zeros([M, ny, nx], float) 54 std_esl_month = np.zeros([M, ny, nx], float) 55 for imo in range (0, M): 56 print 'open file ' + str(month[imo]) 57 fichier = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_data_lamb_spec_near_nadir_AMSUB' + str(frequ[ifr]) + '_' + month[imo] + '2009.nc', 'r', format='NETCDF3_CLASSIC') 58 lon = fichier.variables['longitude'][:] 59 lat = fichier.variables['latitude'][:] 60 days = fichier.variables['days'][:] 61 es = fichier.variables['e_spec'][:] 62 el = fichier.variables['e_lamb'][:] 63 esl = fichier.variables['e_spec_lamb'][:] 64 fichier.close() 65 print 'compute monthly mean and std of data for mapping' 66 for ilon in range (0, len(lon)): 67 for ilat in range (0, len(lat)): 68 es_month[imo, ilat, ilon] = mean(es[ilat, ilon, :][nonzero(isnan(es[ilat, ilon, :]) == False)]) 69 el_month[imo, ilat, ilon] = mean(el[ilat, ilon, :][nonzero(isnan(el[ilat, ilon, :]) == False)]) 70 esl_month[imo, ilat, ilon] = mean(esl[ilat, ilon, :][nonzero(isnan(esl[ilat, ilon, :]) == False)]) 71 std_es_month[imo, ilat, ilon] = sqrt((1. / (month_day[imo] - 1)) * sum((es[ilat, ilon, :][nonzero(isnan(es[ilat, ilon, :]) == False)] - es_month[imo, ilat, ilon])**2)) 72 std_el_month[imo, ilat, ilon] = sqrt((1. / (month_day[imo] - 1)) * sum((el[ilat, ilon, :][nonzero(isnan(el[ilat, ilon, :]) == False)] - el_month[imo, ilat, ilon])**2)) 73 std_esl_month[imo, ilat, ilon] = sqrt((1. / (month_day[imo] - 1)) * sum((esl[ilat, ilon, :][nonzero(isnan(esl[ilat, ilon, :]) == False)] - esl_month[imo, ilat, ilon])**2)) 74 ################################## 75 # stack std data in netcdf files # 76 ################################## 77 print 'start stacking' 78 for imo in range (0, M): 79 print 'stack in file month ' + str(month[imo]) 80 rootgrp = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_mean-std_data_lamb_spec_near_nadir_AMSUB' + str(frequ[ifr]) + '_' + month[imo] + '2009.nc', 'w', format='NETCDF3_CLASSIC') 81 rootgrp.createDimension('longitude', nx) 82 rootgrp.createDimension('latitude', ny) 83 nc_lon = rootgrp.createVariable('longitude', 'f', ('longitude',)) 84 nc_lat = rootgrp.createVariable('latitude', 'f', ('latitude',)) 85 nc_mean_spec = rootgrp.createVariable('mean_spec', 'f', ('latitude', 'longitude')) 86 nc_mean_lamb = rootgrp.createVariable('mean_lamb', 'f', ('latitude', 'longitude')) 87 nc_mean_lamb_spec = rootgrp.createVariable('mean_lamb_spec', 'f', ('latitude', 'longitude')) 88 nc_std_spec = rootgrp.createVariable('std_spec', 'f', ('latitude', 'longitude')) 89 nc_std_lamb = rootgrp.createVariable('std_lamb', 'f', ('latitude', 'longitude')) 90 nc_std_lamb_spec = rootgrp.createVariable('std_lamb_spec', 'f', ('latitude', 'longitude')) 91 nc_lon[:] = xvec 92 nc_lat[:] = yvec 93 nc_mean_spec[:] = es_month[imo, :, :] 94 nc_mean_lamb[:] = el_month[imo, :, :] 95 nc_mean_lamb_spec[:] = esl_month[imo, :, :] 96 nc_std_spec[:] = std_es_month[imo, :, :] 97 nc_std_lamb[:] = std_el_month[imo, :, :] 98 nc_std_lamb_spec[:] = std_esl_month[imo, :, :] 99 rootgrp.close() 100 ''' 101 print 'map of data' 102 ion() 103 x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() 104 x_coast = x_ind 105 y_coast = y_ind 106 z_coast = z_ind 107 colormap = cm.s3pcpn_l_r 108 for imo in range (0, M): 109 print 'map month ' + month[imo] 110 # emiss SPEC 111 print 'emis spec' 112 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, es_a_month[imo, :, :], 0.45, 1.02, 0.01, colormap, 'emissivity SPEC') 113 title(month[imo] + ' 2009 - AMSUA 30GHz') 114 savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/comparison_lamb_spec/space_evolution/EMIS/cartesian_grid/emis_spec_AMSUA' + str(frequ[ifr]) + '_' + month[imo] + '2009.png') 115 # emis SPEC-LAMB 116 print 'emis lamb-spec' 117 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, esl_a_month[imo, :, :], 0., 0.03, 0.001, colormap, 'emissivity LAMB - SPEC') 118 title(month[imo] + ' 2009 - AMSUA 30GHz') 119 savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/comparison_lamb_spec/space_evolution/EMIS/cartesian_grid/emis_spec-lamb_AMSUA' + str(frequ[ifr]) + '_' + month[imo] + '2009.png') 120 # std SPEC 121 print 'std emis spec' 122 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, std_es_month[imo, :, :], 0., std_es_month[nonzero(isnan(std_es_month) == False)].max(), 0.001, colormap, 'std of emissivity SPEC') 123 title(month[imo] + ' 2009 - AMSUA ' + str(frequ[ifr]) + 'GHz') 124 savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/comparison_lamb_spec/space_evolution/EMIS/cartesian_grid/std_emis_spec_AMSUA' + str(frequ[ifr]) + '_' + month[imo] + '2009.png') 125 # std LAMB 126 print 'std emis lamb' 127 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, std_el_month[imo, :, :], 0., std_el_month[nonzero(isnan(std_el_month) == False)].max(), 0.001, colormap, 'std of emissivity LAMB') 128 title(month[imo] + ' 2009 - AMSUA ' + str(frequ[ifr]) + 'GHz') 129 savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/comparison_lamb_spec/space_evolution/EMIS/cartesian_grid/std_emis_lamb_AMSUA' + str(frequ[ifr]) + '_' + month[imo] + '2009.png') 130 # std LAMB-SPEC 131 print 'std emis lamb-spec' 132 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, std_esl_month[imo, :, :], 0., std_esl_month[nonzero(isnan(std_esl_month) == False)].max(), 0.0001, colormap, 'std emissivity LAMB - SPEC') 133 title(month[imo] + ' 2009 - AMSUA ' + str(frequ[ifr]) + 'GHz') 134 savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/comparison_lamb_spec/space_evolution/EMIS/cartesian_grid/std_emis_lamb-spec_AMSUA' + str(frequ[ifr]) + '_' + month[imo] + '2009.png') 135 ''' 87 136 88 137 89 138 90
Note: See TracChangeset
for help on using the changeset viewer.