Changeset 47
- Timestamp:
- 07/30/14 18:21:31 (10 years ago)
- Location:
- trunk/src/scripts_Laura/ARCTIC/Travail_CEN
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scripts_Laura/ARCTIC/Travail_CEN/compare_ice_area_different_data.py
r46 r47 146 146 xlim(-1, M) 147 147 grid() 148 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ compar_total_ice_area_AMSUA_AMSUB_SPEC_LAMB_OSISAF_2009.png')148 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/total_ice_area/compar_total_ice_area_AMSUA_AMSUB_SPEC_LAMB_OSISAF_2009.png') 149 149 150 150 … … 153 153 # calculation of bias and std # 154 154 ############################### 155 a = np.zeros([M], float) 156 b = np.zeros([M], float) 157 c = np.zeros([M], float) 158 d = np.zeros([M], float) 159 e = np.zeros([M], float) 160 f = np.zeros([M], float) 161 g = np.zeros([M], float) 162 h = np.zeros([M], float) 163 i = np.zeros([M], float) 164 j = np.zeros([M], float) 165 for imo in range (0, M): 166 a[imo] = AS[0, imo] - area_osi[imo] 167 b[imo] = AL[0, imo] - area_osi[imo] 168 c[imo] = AS[1, imo] - area_osi[imo] 169 d[imo] = AL[1, imo] - area_osi[imo] 170 e[imo] = AS[2, imo] - area_osi[imo] 171 f[imo] = AL[2, imo] - area_osi[imo] 172 g[imo] = AS[3, imo] - area_osi[imo] 173 h[imo] = AL[3, imo] - area_osi[imo] 174 i[imo] = area_s_B[imo] - area_osi[imo] 175 j[imo] = area_l_B[imo] - area_osi[imo] 176 177 155 178 figure() 156 plot((AS[0, :] - AS[1, :]) * 100. / ((mean(AS[0, :]) + mean(AS[0, :])) / 2.), 'r', label = 'AMSUA spec 23GHz - 50GHz') 157 plot((AS[0, :] - AS[2, :]) * 100. / ((mean(AS[0, :]) + mean(AS[2, :])) / 2.), 'b', label = 'AMSUA spec 23GHz - 89GHz') 158 plot((AS[1, :] - AS[2, :]) * 100. / ((mean(AS[1, :]) + mean(AS[2, :])) / 2.), 'g', label = 'AMSUA spec 50GHz - 89GHz') 179 plot(a, 'c', label = 'AMSUA spec 23GHz') 180 plot(b, 'c--', label = 'AMSUA lamb 23GHz') 181 plot(c, 'r', label = 'AMSUA spec 30GHz') 182 plot(d, 'r--', label = 'AMSUA lamb 30GHz') 183 plot(e, 'm', label = 'AMSUA spec 50GHz') 184 plot(f, 'm--', label = 'AMSUA lamb 50GHz') 185 plot(g, 'g', label = 'AMSUA spec 89GHz') 186 plot(h, 'g--', label = 'AMSUA lamb 89GHz') 187 plot(i, 'b', label = 'AMSUB spec 89GHz') 188 plot(j, 'b--', label = 'AMSUB lamb 89GHz') 189 plot(np.arange(0, M, 1), np.zeros([M], float), 'k') 159 190 fontP = FontProperties() 160 191 fontP.set_size('small') 161 192 legend(loc = 3, prop = fontP) 162 ylabel('bias of total ice area (%)') 163 yticks(np.arange(0, M, 1), month, rotation = 25) 193 ylabel('bias of total ice area') 164 194 xticks(np.arange(0, M, 1), month, rotation = 25) 165 195 xlim(-1, M) 166 196 grid() 167 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/total_ice_area/ compar_bias_total_ice_area_AMSUA_SPEC_2009.png')168 169 170 171 172 197 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/total_ice_area/bias_total_ice_area_AMSU_OSI_2009.png') 198 199 200 201 202 -
trunk/src/scripts_Laura/ARCTIC/Travail_CEN/ice_class_delimit_AMSU_data.py
r46 r47 85 85 emis_ratio = np.zeros([ny, nx, M], float) 86 86 for imo in range (0, M): 87 #print 'month ' + month[imo]87 print 'month ' + month[imo] 88 88 ############## 89 89 # emissivity # 90 90 ############## 91 #print 'read file for emiss'91 print 'read file for emiss' 92 92 fichier_emis = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_data_lamb_spec_near_nadir_AMSUA' + str(frequ) + '_' + month[imo] + '2009.nc', 'r', format='NETCDF3_CLASSIC') 93 93 xdist = fichier_emis.variables['longitude'][:] … … 97 97 emis_lamb = fichier_emis.variables['e_lamb'][:] 98 98 fichier_emis.close() 99 #print 'calculation of monthly mean'99 print 'calculation of monthly mean' 100 100 for ilon in range (0, nx): 101 101 for ilat in range (0, ny): 102 102 emis_spec_moy[ilat, ilon, imo] = mean(emis_spec[ilat, ilon, :][nonzero(isnan(emis_spec[ilat, ilon, :]) == False)]) 103 103 emis_lamb_moy[ilat, ilon, imo] = mean(emis_lamb[ilat, ilon, :][nonzero(isnan(emis_lamb[ilat, ilon, :]) == False)]) 104 #print 'calculation of monthly mean difference lamb-spec'104 print 'calculation of monthly mean difference lamb-spec' 105 105 emis_diff[:, :, imo] = emis_lamb_moy[:, :, imo] - emis_spec_moy[:, :, imo] 106 106 ######### 107 107 # ratio # 108 108 ######### 109 #print 'read file for ratio'109 print 'read file for ratio' 110 110 fichier_ratio = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_lamb-spec_ratio_near_nadir_AMSUA' + str(frequ) + '_' + month[imo] + '2009.nc', 'r', format='NETCDF3_CLASSIC') 111 111 xdist = fichier_ratio.variables['longitude'][:] … … 119 119 # emissivity distribution after filtering # 120 120 ########################################### 121 '''122 121 hist_val_spec = np.zeros([50, M], float) 123 122 hist_val_lamb = np.zeros([50, M], float) … … 127 126 corresp_val_lamb = np.zeros([50, M], float) 128 127 corresp_val_ratio = np.zeros([50, M], float) 129 corresp_val_diff = np.zeros([50, M], float) 130 ''' 128 corresp_val_diff = np.zeros([50, M], float) 131 129 emis_spec_f = np.zeros([7000, M], float) 132 130 emis_lamb_f = np.zeros([7000, M], float) 133 131 emis_ratio_f = np.zeros([7000, M], float) 134 132 emis_diff_f = np.zeros([7000, M], float) 133 X = np.zeros([7000, M], float) 134 Y = np.zeros([7000, M], float) 135 135 L_spec = np.zeros([M], int) 136 136 for imo in range (0, M): 137 #print 'month ' + month[imo]137 print 'month ' + month[imo] 138 138 # choice of spec emissivity as the threshold for the study // definition of x and y index corresponding to the points which emissivity value is over threshold 139 139 y_index_spec = np.where(emis_spec_moy[:, :, imo] >= lim_spec[imo])[0] 140 Y[0 : len(y_index_spec), imo] = y_index_spec[:] 140 141 x_index_spec = np.where(emis_spec_moy[:, :, imo] >= lim_spec[imo])[1] 142 X[0 : len(x_index_spec), imo] = x_index_spec[:] 141 143 L_spec[imo] = len(x_index_spec) # = len(y_index) 142 144 #print 'length of x and y index ', L_spec[imo] 143 145 # definition of filtered values (vectors) with the previous threshold // values of filtered emissivity SPEC, LAMB, rate and difference LAMB-SPEC 146 print 'calculation of vectors of filtered data' 144 147 for ii in range (0, L_spec[imo]): 145 148 emis_spec_f[ii, imo] = emis_spec_moy[y_index_spec[ii], x_index_spec[ii], imo] … … 147 150 emis_ratio_f[ii, imo] = emis_ratio[y_index_spec[ii], x_index_spec[ii], imo] 148 151 emis_diff_f[ii, imo] = emis_diff[y_index_spec[ii], x_index_spec[ii], imo] 149 '''152 print 'calculation of histogram distribution' 150 153 # definition of their distribution within the new filtered values 151 hist_val_spec[:, imo] = hist(emis_spec_f, bins = 50, normed = True, histtype='step')[0] 152 hist_val_lamb[:, imo] = hist(emis_lamb_f, bins = 50, normed = True, histtype='step')[0] 153 hist_val_ratio[:, imo] = hist(emis_ratio_f, bins = 50, normed = True, histtype='step')[0] 154 hist_val_diff[:, imo] = hist(emis_diff_f, bins = 50, normed = True, histtype='step')[0] 154 hist_val_spec[:, imo] = hist(emis_spec_f[0 : L_spec[imo], imo], bins = 50, normed = True, histtype='step')[0] 155 hist_val_lamb[:, imo] = hist(emis_lamb_f[0 : L_spec[imo], imo], bins = 50, normed = True, histtype='step')[0] 156 hist_val_ratio[:, imo] = hist(emis_ratio_f[0 : L_spec[imo], imo], bins = 50, normed = True, histtype='step')[0] 157 hist_val_diff[:, imo] = hist(emis_diff_f[0 : L_spec[imo] 158 159 , imo], bins = 50, normed = True, histtype='step')[0] 155 160 for ibin in range (0, 50): 156 corresp_val_spec[ibin, imo] = mean(hist(emis_spec_f, bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 157 corresp_val_lamb[ibin, imo] = mean(hist(emis_lamb_f, bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 158 corresp_val_ratio[ibin, imo] = mean(hist(emis_ratio_f, bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 159 corresp_val_diff[ibin, imo] = mean(hist(emis_diff_f, bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 160 ''' 161 corresp_val_spec[ibin, imo] = mean(hist(emis_spec_f[0 : L_spec[imo], imo], bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 162 corresp_val_lamb[ibin, imo] = mean(hist(emis_lamb_f[0 : L_spec[imo], imo], bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 163 corresp_val_ratio[ibin, imo] = mean(hist(emis_ratio_f[0 : L_spec[imo], imo], bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 164 corresp_val_diff[ibin, imo] = mean(hist(emis_diff_f[0 : L_spec[imo], imo], bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) 161 165 162 return(emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec) 166 167 return(emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec, X, Y, hist_val_spec, hist_val_lamb, hist_val_ratio, hist_val_diff, corresp_val_spec, corresp_val_lamb, corresp_val_ratio, corresp_val_diff) 163 168 164 169 -
trunk/src/scripts_Laura/ARCTIC/Travail_CEN/ice_delimit_AMSUB_data.py
r46 r47 41 41 42 42 43 frequ = 89 43 44 44 45 ##################### … … 56 57 ### emissivity ### 57 58 print 'open emissivity file' 58 fichier_emis = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_data_lamb_spec_near_nadir_AMSU A30_' + str(month[imo]) + '2009.nc', 'r', format='NETCDF3_CLASSIC')59 fichier_emis = 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) + '_' + str(month[imo]) + '2009.nc', 'r', format='NETCDF3_CLASSIC') 59 60 xdist = fichier_emis.variables['longitude'][:] 60 61 ydist = fichier_emis.variables['latitude'][:] … … 70 71 ### monthly emissivity ratio ### 71 72 print 'open emissivity ratio file' 72 fichier_ratio = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_lamb-spec_ratio_near_nadir_AMSU A30_' + str(month[imo]) + '2009.nc', 'r', format='NETCDF3_CLASSIC')73 fichier_ratio = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/monthly_GLACE/gridded_data/cartesian_grid/res_40/cartesian_grid_monthly_lamb-spec_ratio_near_nadir_AMSUB' + str(frequ) + '_' + str(month[imo]) + '2009.nc', 'r', format='NETCDF3_CLASSIC') 73 74 xdist = fichier_ratio.variables['longitude'][:] 74 75 ydist = fichier_ratio.variables['latitude'][:] … … 94 95 95 96 c = np.array(['r', 'b', 'c', 'm', 'y', 'g']) 96 limit_coef_spec = np.array([0.6, 0.6, 0.7, 0.8, 0.75]) # i1 = AMSUA23GHz / i2 = AMSUA30GHz / i3 = AMSUA50GHz / i4 = AMSUA89GHz / i5 = AMSUB89GHz 97 limit_coef_lamb = np.array([0.6, 0.6, 0.8, 0.8, 0.77]) # i1 = AMSUA23GHz / i2 = AMSUA30GHz / i3 = AMSUA50GHz / i4 = AMSUA89GHz / i5 = AMSUB89GHz 98 idata = 1 97 #limit_coef_spec = np.array([0.6, 0.6, 0.7, 0.8, 0.75]) # i1 = AMSUA23GHz / i2 = AMSUA30GHz / i3 = AMSUA50GHz / i4 = AMSUA89GHz / i5 = AMSUB89GHz 98 #limit_coef_lamb = np.array([0.6, 0.6, 0.8, 0.8, 0.77]) # i1 = AMSUA23GHz / i2 = AMSUA30GHz / i3 = AMSUA50GHz / i4 = AMSUA89GHz / i5 = AMSUB89GHz 99 #idata = 0 100 fontP = FontProperties() 101 fontP.set_size('small') 99 102 print 'distribution of emissivity values' 100 103 ################################### … … 119 122 xlabel('emissivity SPEC') 120 123 ylabel('frequency of occurence') 121 fontP = FontProperties()122 fontP.set_size('small')123 124 legend(loc = 2, prop = fontP) 124 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_spec_AMSUA30_JANUARY-JUNE_2009.png')125 #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') 125 126 ## plot six following months of spec emissivity histograms ## 126 127 figure() … … 133 134 ylabel('frequency of occurence') 134 135 legend(loc = 9, prop = fontP) 135 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_spec_AMSUA30_JULY-DECEMBER_2009.png')136 #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') 136 137 137 138 # find the emissivity value corresponding to the threshold of ice/no_ice limit … … 139 140 for imo in range (0, M): 140 141 print 'month ' + str(month[imo]) 141 bb = np.where((corresp_emis_spec[imo, :] < limit_coef_spec[idata]))[0] # only consider low emissivity values (open sea) // CHANGE EMISSIVITY VALUE ACCORDING TO FREQUENCY142 aa = np.where(hist_vals_spec[imo, bb] < max(hist_vals_spec[imo, bb]) / 2.)[0] # of these latter values, only consider emissivity values lower than 1/4*peak emissivity143 cc = np.where(hist_vals_spec[imo, bb] == max(hist_vals_spec[imo, bb]))[0] # which emissivity index corresponds to peak emissivity144 dd = np.where(aa > cc[0])[0]145 emis_lim_spec[imo] = corresp_emis_spec[imo, bb][aa][ dd[0]]142 bb = np.where((corresp_emis_spec[imo, :] > 0.7) & (corresp_emis_spec[imo, :] < 0.77))[0] # only consider low emissivity values (open sea) // CHANGE EMISSIVITY VALUE ACCORDING TO FREQUENCY 143 aa = np.where(hist_vals_spec[imo, bb] == min(hist_vals_spec[imo, bb]))[0] # of these latter values, only consider emissivity values lower than 1/4*peak emissivity 144 #cc = np.where(hist_vals_spec[imo, bb] == max(hist_vals_spec[imo, bb]))[0] # which emissivity index corresponds to peak emissivity 145 #dd = np.where(aa > cc[0])[0] 146 emis_lim_spec[imo] = corresp_emis_spec[imo, bb][aa][0] 146 147 147 148 # plot monthly evolution of emissivity spec threshold used for delimitation … … 153 154 legend(loc = 2) 154 155 xlim(-1, M) 155 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSU A/emis_lim_frequ_SPEC_AMSUA30_2009.png')156 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUB/emis_lim_frequ_SPEC_AMSUB' + str(frequ) + '_2009.png') 156 157 157 158 … … 177 178 ylabel('frequency of occurence') 178 179 legend(loc = 2, prop = fontP) 179 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_lamb_AMSUA30_JANUARY-JUNE_2009.png')180 #plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_lamb_AMSUA' + str(frequ) + '_JANUARY-JUNE_2009.png') 180 181 ## plot six following months of spec emissivity histograms ## 181 182 figure() … … 188 189 ylabel('frequency of occurence') 189 190 legend(loc = 9, prop = fontP) 190 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_lamb_AMSUA30_JULY-DECEMBER_2009.png')191 #plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_lamb_AMSUA' + str(frequ) + '_JULY-DECEMBER_2009.png') 191 192 192 193 # find the emissivity value corresponding to the threshold of ice/no_ice limit … … 194 195 for imo in range (0, M): 195 196 print 'month ' + str(month[imo]) 196 bb = np.where((corresp_emis_lamb[imo, :] < limit_coef_lamb[idata]))[0] # only consider low emissivity values (open sea) // CHANGE EMISSIVITY VALUE ACCORDING TO FREQUENCY197 aa = np.where(hist_vals_lamb[imo, bb] < max(hist_vals_lamb[imo, bb]) / 2.)[0] # of these latter values, only consider emissivity values lower than 1/4*peak emissivity198 cc = np.where(hist_vals_lamb[imo, bb] == max(hist_vals_lamb[imo, bb]))[0] # which emissivity index corresponds to peak emissivity199 dd = np.where(aa > cc[0])[0]200 emis_lim_lamb[imo] = corresp_emis_lamb[imo, bb][aa][ dd[0]]197 bb = np.where((corresp_emis_lamb[imo, :] > 0.72) & (corresp_emis_lamb[imo, :] < 0.8))[0] # only consider low emissivity values (open sea) // CHANGE EMISSIVITY VALUE ACCORDING TO FREQUENCY 198 aa = np.where(hist_vals_lamb[imo, bb] == min(hist_vals_lamb[imo, bb]))[0] # of these latter values, only consider emissivity values lower than 1/4*peak emissivity 199 #cc = np.where(hist_vals_lamb[imo, bb] == max(hist_vals_lamb[imo, bb]))[0] # which emissivity index corresponds to peak emissivity 200 #dd = np.where(aa > cc[0])[0] 201 emis_lim_lamb[imo] = corresp_emis_lamb[imo, bb][aa][0] 201 202 202 203 # plot monthly evolution of emissivity spec threshold used for delimitation … … 208 209 legend(loc = 2) 209 210 xlim(-1, M) 210 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSU A/emis_lim_frequ_LAMB_AMSUA30_2009.png')211 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUB/emis_lim_frequ_LAMB_AMSUB' + str(frequ) + '_2009.png') 211 212 212 213 … … 233 234 ylabel('frequency of occurence') 234 235 legend(prop = fontP) 235 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_rate_AMSUA30_JANUARY-JUNE_2009.png')236 #plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_rate_AMSUA'+str(frequ)+'_JANUARY-JUNE_2009.png') 236 237 ## plot six following months of spec emissivity histograms ## 237 238 figure() … … 244 245 ylabel('frequency of occurence') 245 246 legend(loc = 9, prop = fontP) 246 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_rate_AMSUA30_JULY-DECEMBER_2009.png')247 #plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emiss_rate_AMSUA'+str(frequ)+'_JULY-DECEMBER_2009.png') 247 248 248 249 # no definition of threshold for ICE / NO_ICE delimitation because no apparent distinction signal // use of this signal for internal ice classification … … 280 281 legend(loc = 2, prop = fontP) 281 282 xlim(-1, M) 282 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSU A/emis_lim_frequ_spec_and_lamb_AMSUA30_2009.png')283 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUB/emis_lim_frequ_spec_and_lamb_AMSUB' + str(frequ) + '_2009.png') 283 284 284 285 … … 304 305 else: 305 306 if (emis_spec_month[imo, ilat, ilon] <= emis_lim_spec[imo]): # use the monthly SPEC emissivity threshold 306 ice_zone_spec[imo, ilat, ilon] = 0.307 ice_zone_spec[imo, ilat, ilon] = NaN 307 308 else: 308 ice_zone_spec[imo, ilat, ilon] = 1.309 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xdist, ydist, ice_zone_spec[ imo, :, :], -1, 2., 1., colors.ListedColormap(['0.5', 'blue']), 'Ice limit(threshold : emis_SPEC > ' + str(emis_lim_spec[imo])[0:6] + ')')310 title(str(month[imo]) + ' 2009 - AMSUA 30GHz')311 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/AMSUA 30_ice_emis_spec_thresh' + '_' + month[imo] + '2009.png')309 ice_zone_spec[imo, ilat, ilon] = emis_spec_month[imo, ilat, ilon] 310 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xdist, ydist, ice_zone_spec[8, :, :], 0.5, 1.02, 0.01, cm.s3pcpn_l_r, 'Sea ice emissivity spec (threshold : emis_SPEC > ' + str(emis_lim_spec[imo])[0:6] + ')') 311 title(str(month[imo]) + ' 2009 - AMSUA ' + str(frequ) + 'GHz') 312 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/AMSUA' + str(frequ) + '_ice_emis_spec_thresh' + '_' + month[imo] + '2009.png') 312 313 313 314 #### LAMB emiss #### … … 322 323 else: 323 324 if (emis_lamb_month[imo, ilat, ilon] <= emis_lim_lamb[imo]): # use the monthly SPEC emissivity threshold 324 ice_zone_lamb[imo, ilat, ilon] = 0.325 ice_zone_lamb[imo, ilat, ilon] = NaN 325 326 else: 326 ice_zone_lamb[imo, ilat, ilon] = 1.327 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xdist, ydist, ice_zone_lamb[ imo, :, :], -1, 2., 1., colors.ListedColormap(['0.5', 'blue']), 'Ice limit(threshold : emis_LAMB > ' + str(emis_lim_lamb[imo])[0:6] + ')')328 title(str(month[imo]) + ' 2009 - AMSUA 30GHz')329 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/AMSUA 30_ice_emis_lamb_thresh' + '_' + month[imo] + '2009.png')327 ice_zone_lamb[imo, ilat, ilon] = emis_lamb_month[imo, ilat, ilon] 328 map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xdist, ydist, ice_zone_lamb[8, :, :], 0.5, 1.02, 0.01, cm.s3pcpn_l_r, 'Sea ice emissivity lamb (threshold : emis_LAMB > ' + str(emis_lim_lamb[imo])[0:6] + ')') 329 title(str(month[imo]) + ' 2009 - AMSUA ' + str(frequ) + 'GHz') 330 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/AMSUA' + str(frequ) + '_ice_emis_lamb_thresh' + '_' + month[imo] + '2009.png') 330 331 331 332 … … 343 344 for imo in range (0, M): 344 345 ice_spec = reshape(ice_zone_spec[imo, :, :], size(ice_zone_spec[imo, :, :])) 345 nb_pix_spec[imo] = len(np.where(i ce_spec == 1.)[0])346 nb_pix_spec[imo] = len(np.where(isnan(ice_spec) == False)[0]) 346 347 total_ice_area_spec[imo] = (pix_area * nb_pix_spec[imo]) + (926. * pix_area) 347 348 … … 353 354 for imo in range (0, M): 354 355 ice_lamb = reshape(ice_zone_lamb[imo, :, :], size(ice_zone_lamb[imo, :, :])) 355 nb_pix_lamb[imo] = len(np.where(i ce_lamb == 1.)[0])356 nb_pix_lamb[imo] = len(np.where(isnan(ice_lamb) == False)[0]) 356 357 total_ice_area_lamb[imo] = (pix_area * nb_pix_lamb[imo]) + (926. * pix_area) 357 358 … … 364 365 ###################### 365 366 print 'start stacking in .dat file' 366 data_classif = open ('/net/argos/data/parvati/lahlod/ARCTIC/AMSU A_ice_class/AMSUA30_data_classification_parameters_ice_no-ice_2009.dat', 'a')367 data_classif = open ('/net/argos/data/parvati/lahlod/ARCTIC/AMSUB_ice_class/AMSUB'+str(frequ)+'_data_classification_parameters_ice_no-ice_2009.dat', 'a') 367 368 for imo in range (0, M): 368 369 for ii in range (0, 50): … … 391 392 for imo in range (0, M): 392 393 print 'stack in file month ' + str(month[imo]) 393 rootgrp = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSU A_ice_class/cartesian_grid_map_ice_no-ice_' + month[imo] + '2009_AMSUA30_spec_lamb_thresholds.nc', 'w', format='NETCDF3_CLASSIC')394 rootgrp = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSUB_ice_class/cartesian_grid_map_ice_no-ice_' + month[imo] + '2009_AMSUB' + str(frequ) + '_spec_lamb_thresholds.nc', 'w', format='NETCDF3_CLASSIC') 394 395 rootgrp.createDimension('longitude', len(xdist)) 395 396 rootgrp.createDimension('latitude', len(ydist)) -
trunk/src/scripts_Laura/ARCTIC/Travail_CEN/import_ice_class_delimit_AMSU_data.py
r46 r47 5 5 import matplotlib.pyplot as plt 6 6 from pylab import * 7 from mpl_toolkits.basemap import Basemap8 from mpl_toolkits.basemap import shiftgrid, cm9 7 from netCDF4 import Dataset 10 import arctic_map # function to regrid coast limits 11 import cartesian_grid_test # function to convert grid from polar to cartesian 12 import scipy.special 13 import ffgrid2 14 import map_ffgrid 8 #import arctic_map # function to regrid coast limits 9 #import cartesian_grid_test # function to convert grid from polar to cartesian 15 10 from matplotlib.font_manager import FontProperties 16 import map_cartesian_grid11 #import map_cartesian_grid 17 12 import ice_class_delimit_AMSU_data 18 13 19 14 20 15 21 frequ = 23 22 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec = ice_class_delimit_AMSU_data.filtering(frequ) 23 spec_23 = emis_spec_f 24 lamb_23 = emis_lamb_f 25 ratio_23 = emis_ratio_f 26 diff_23 = emis_diff_f 27 L_spec_23 = L_spec 28 16 17 MONTH = np.array(['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']) 18 month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER']) 19 month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) 20 M = len(month) 21 22 23 24 frequ = 89 25 26 ################################################################################ 27 # compute filtered points of emissivity SPEC, LAMB, rate, difference LAMB-SPEC # 28 ################################################################################ 29 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec, X, Y, hist_val_spec, hist_val_lamb, hist_val_ratio, hist_val_diff, corresp_val_spec, corresp_val_lamb, corresp_val_ratio, corresp_val_diff = ice_class_delimit_AMSU_data.filtering(frequ) 30 spec = emis_spec_f 31 lamb = emis_lamb_f 32 ratio = emis_ratio_f 33 diff = emis_diff_f 34 L_spec = L_spec 35 X = X 36 Y = Y 37 hist_spec = hist_val_spec 38 hist_lamb = hist_val_lamb 39 hist_ratio = hist_val_ratio 40 hist_diff = hist_val_diff 41 corresp_spec = corresp_val_spec 42 corresp_lamb = corresp_val_lamb 43 corresp_ratio = corresp_val_ratio 44 corresp_diff = corresp_val_diff 45 46 47 48 ######## 49 # plot # 50 ######## 51 ion() 52 c = np.array(['r', 'b', 'c', 'm', 'y', 'g']) 53 fontP = FontProperties() 54 fontP.set_size('small') 55 #### SPEC #### 56 figure() 57 for imo in range (0, 6): 58 plot(corresp_spec[:, imo], hist_spec[:, imo], c = str(c[imo]), label = str(month[imo])) 59 60 grid() 61 xlim(corresp_spec.min() - 0.02, corresp_spec.max() + 0.02) 62 xlabel('emissivity spec') 63 ylabel('frequency of occurence') 64 legend(prop = fontP, loc = 2) 65 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_spec_AMSUA' + str(frequ) + '_JANUARY-JUNE_2009.png') 66 ## plot six following months of spec emissivity histograms ## 67 figure() 68 for imo in range (6, M): 69 plot(corresp_spec[:, imo], hist_spec[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 70 71 grid() 72 xlim(corresp_spec.min() - 0.02, corresp_spec.max() + 0.02) 73 xlabel('emissivity spec') 74 ylabel('frequency of occurence') 75 legend(loc = 1, prop = fontP) 76 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_spec_AMSUA' + str(frequ) + '_JULY-DECEMBER_2009.png') 77 78 79 80 #### LAMB #### 81 figure() 82 for imo in range (0, 6): 83 plot(corresp_lamb[:, imo], hist_lamb[:, imo], c = str(c[imo]), label = str(month[imo])) 84 85 grid() 86 xlim(corresp_lamb.min() - 0.02, corresp_lamb.max() + 0.02) 87 xlabel('emissivity lamb') 88 ylabel('frequency of occurence') 89 fontP = FontProperties() 90 fontP.set_size('small') 91 legend(prop = fontP, loc = 2) 92 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_lamb_AMSUA' + str(frequ) + '_JANUARY-JUNE_2009.png') 93 ## plot six following months of spec emissivity histograms ## 94 figure() 95 for imo in range (6, M): 96 plot(corresp_lamb[:, imo], hist_lamb[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 97 98 grid() 99 xlim(corresp_lamb.min() - 0.02, corresp_lamb.max() + 0.02) 100 xlabel('emissivity lamb') 101 ylabel('frequency of occurence') 102 legend(loc = 1, prop = fontP) 103 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_lamb_AMSUA' + str(frequ) + '_JULY-DECEMBER_2009.png') 104 105 #### RATE #### 106 figure() 107 for imo in range (0, 6): 108 plot(corresp_ratio[:, imo], hist_ratio[:, imo], c = str(c[imo]), label = str(month[imo])) 109 110 grid() 111 xlim(corresp_ratio.min() - 0.02, corresp_ratio.max() + 0.02) 112 xlabel('emissivity ratio') 113 ylabel('frequency of occurence') 114 fontP = FontProperties() 115 fontP.set_size('small') 116 legend(prop = fontP, loc = 1) 117 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_ratio_AMSUA' + str(frequ) + '_JANUARY-JUNE_2009.png') 118 ## plot six following months of spec emissivity histograms ## 119 figure() 120 for imo in range (6, M): 121 plot(corresp_ratio[:, imo], hist_ratio[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 122 123 grid() 124 xlim(corresp_ratio.min() - 0.02, corresp_ratio.max() + 0.02) 125 xlabel('emissivity ratio') 126 ylabel('frequency of occurence') 127 legend(loc = 1, prop = fontP) 128 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_ratio_AMSUA' + str(frequ) + '_JULY-DECEMBER_2009.png') 129 130 #### DIFF #### 131 figure() 132 for imo in range (0, 6): 133 plot(corresp_diff[:, imo], hist_diff[:, imo], c = str(c[imo]), label = str(month[imo])) 134 135 grid() 136 xlim(corresp_diff.min() - 0.002, corresp_diff.max() + 0.002) 137 xlabel('emissivity diff') 138 ylabel('frequency of occurence') 139 fontP = FontProperties() 140 fontP.set_size('small') 141 legend(prop = fontP, loc = 1) 142 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_diff_AMSUA' + str(frequ) + '_JANUARY-JUNE_2009.png') 143 ## plot six following months of spec emissivity histograms ## 144 figure() 145 for imo in range (6, M): 146 plot(corresp_diff[:, imo], hist_diff[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 147 148 grid() 149 xlim(corresp_diff.min() - 0.002, corresp_diff.max() + 0.002) 150 xlabel('emissivity diff') 151 ylabel('frequency of occurence') 152 legend(loc = 1, prop = fontP) 153 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/emiss_diff_AMSUA' + str(frequ) + '_JULY-DECEMBER_2009.png') 154 155 156 157 158 ''' 29 159 frequ = 30 30 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec = ice_class_delimit_AMSU_data.filtering(frequ)160 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec, X, Y, hist_val_spec, hist_val_lamb, hist_val_ratio, hist_val_diff, corresp_val_spec, corresp_val_lamb, corresp_val_ratio, corresp_val_diff = ice_class_delimit_AMSU_data.filtering(frequ) 31 161 spec_30 = emis_spec_f 32 162 lamb_30 = emis_lamb_f … … 34 164 diff_30 = emis_diff_f 35 165 L_spec_30 = L_spec 166 X_30 = X 167 Y_30 = Y 36 168 37 169 frequ = 50 38 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec = ice_class_delimit_AMSU_data.filtering(frequ)170 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec, X, Y, hist_val_spec, hist_val_lamb, hist_val_ratio, hist_val_diff, corresp_val_spec, corresp_val_lamb, corresp_val_ratio, corresp_val_diff = ice_class_delimit_AMSU_data.filtering(frequ) 39 171 spec_50 = emis_spec_f 40 172 lamb_50 = emis_lamb_f … … 42 174 diff_50 = emis_diff_f 43 175 L_spec_50 = L_spec 176 X_50 = X 177 Y_50 = Y 44 178 45 179 frequ = 89 46 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec = ice_class_delimit_AMSU_data.filtering(frequ)180 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec, X, Y, hist_val_spec, hist_val_lamb, hist_val_ratio, hist_val_diff, corresp_val_spec, corresp_val_lamb, corresp_val_ratio, corresp_val_diff = ice_class_delimit_AMSU_data.filtering(frequ) 47 181 spec_89 = emis_spec_f 48 182 lamb_89 = emis_lamb_f … … 50 184 diff_89 = emis_diff_f 51 185 L_spec_89 = L_spec 52 53 54 55 56 57 MONTH = np.array(['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']) 58 month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER']) 59 month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) 60 M = len(month) 186 X_89 = X 187 Y_89 = Y 188 189 190 XX = X_89[:, 0][nonzero(X_89[:, 0] != 0.)] 191 YY = Y_89[:, 0][nonzero(Y_89[:, 0] != 0.)] 192 L = len(XX) 193 for ii in range (0, L): 194 emis_spec_moy[YY[ii], XX[ii]] 195 196 197 61 198 62 199 a1 = np.zeros([M], float) … … 70 207 a4[imo] = corrcoef(spec_89[0 : 3243, imo], diff_89[0 : 3243, imo])[0][1] 71 208 72 correl_matrix = corrcoef(np.array([spec_89[0 : 3243, imo], lamb_89[0 : 3243, imo], ratio_89[0 : 3243, imo], diff_89[0 : 3243, imo], spec_50[0 : 3243, imo], lamb_50[0 : 3243, imo], ratio_50[0 : 3243, imo], diff_50[0 : 3243, imo], spec_30[0 : 3243, imo], lamb_30[0 : 3243, imo], ratio_30[0 : 3243, imo], diff_30[0 : 3243, imo], spec_23[0 : 3243, imo], lamb_23[0 : 3243, imo], ratio_23[0 : 3243, imo], diff_23[0 : 3243, imo]]))209 params = np.array([spec_89[0 : 3243, imo], lamb_89[0 : 3243, imo], ratio_89[0 : 3243, imo], diff_89[0 : 3243, imo], spec_50[0 : 3243, imo], lamb_50[0 : 3243, imo], ratio_50[0 : 3243, imo], diff_50[0 : 3243, imo], spec_30[0 : 3243, imo], lamb_30[0 : 3243, imo], ratio_30[0 : 3243, imo], diff_30[0 : 3243, imo], spec[0 : 3243, imo], lamb[0 : 3243, imo], ratio[0 : 3243, imo], diff[0 : 3243, imo]])) 73 210 74 211 figure() 75 212 pc = pcolor(correl_matrix) 76 213 colorbar(pc) 77 214 '''
Note: See TracChangeset
for help on using the changeset viewer.