Changeset 47


Ignore:
Timestamp:
07/30/14 18:21:31 (10 years ago)
Author:
lahlod
Message:

new_scripts

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  
    146146xlim(-1, M) 
    147147grid() 
    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') 
     148plt.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') 
    149149 
    150150 
     
    153153# calculation of bias and std # 
    154154############################### 
     155a = np.zeros([M], float) 
     156b = np.zeros([M], float) 
     157c = np.zeros([M], float) 
     158d = np.zeros([M], float) 
     159e = np.zeros([M], float) 
     160f = np.zeros([M], float) 
     161g = np.zeros([M], float) 
     162h = np.zeros([M], float) 
     163i = np.zeros([M], float) 
     164j = np.zeros([M], float) 
     165for 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 
    155178figure() 
    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') 
     179plot(a, 'c', label = 'AMSUA spec 23GHz') 
     180plot(b, 'c--', label = 'AMSUA lamb 23GHz') 
     181plot(c, 'r', label = 'AMSUA spec 30GHz') 
     182plot(d, 'r--', label = 'AMSUA lamb 30GHz') 
     183plot(e, 'm', label = 'AMSUA spec 50GHz') 
     184plot(f, 'm--', label = 'AMSUA lamb 50GHz') 
     185plot(g, 'g', label = 'AMSUA spec 89GHz') 
     186plot(h, 'g--', label = 'AMSUA lamb 89GHz') 
     187plot(i, 'b', label = 'AMSUB spec 89GHz') 
     188plot(j, 'b--', label = 'AMSUB lamb 89GHz') 
     189plot(np.arange(0, M, 1), np.zeros([M], float), 'k') 
    159190fontP = FontProperties() 
    160191fontP.set_size('small') 
    161192legend(loc = 3, prop = fontP) 
    162 ylabel('bias of total ice area (%)') 
    163 yticks(np.arange(0, M, 1), month, rotation = 25) 
     193ylabel('bias of total ice area') 
    164194xticks(np.arange(0, M, 1), month, rotation = 25) 
    165195xlim(-1, M) 
    166196grid() 
    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  
     197plt.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  
    8585    emis_ratio = np.zeros([ny, nx, M], float) 
    8686    for imo in range (0, M): 
    87         #print 'month ' + month[imo] 
     87        print 'month ' + month[imo] 
    8888        ############## 
    8989        # emissivity # 
    9090        ############## 
    91         #print 'read file for emiss' 
     91        print 'read file for emiss' 
    9292        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') 
    9393        xdist = fichier_emis.variables['longitude'][:] 
     
    9797        emis_lamb = fichier_emis.variables['e_lamb'][:] 
    9898        fichier_emis.close() 
    99         #print 'calculation of monthly mean' 
     99        print 'calculation of monthly mean' 
    100100        for ilon in range (0, nx): 
    101101            for ilat in range (0, ny): 
    102102                emis_spec_moy[ilat, ilon, imo] = mean(emis_spec[ilat, ilon, :][nonzero(isnan(emis_spec[ilat, ilon, :]) == False)]) 
    103103                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' 
    105105        emis_diff[:, :, imo] = emis_lamb_moy[:, :, imo] - emis_spec_moy[:, :, imo] 
    106106        ######### 
    107107        # ratio # 
    108108        ######### 
    109         #print 'read file for ratio' 
     109        print 'read file for ratio' 
    110110        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') 
    111111        xdist = fichier_ratio.variables['longitude'][:] 
     
    119119    # emissivity distribution after filtering # 
    120120    ########################################### 
    121     ''' 
    122121    hist_val_spec = np.zeros([50, M], float) 
    123122    hist_val_lamb = np.zeros([50, M], float) 
     
    127126    corresp_val_lamb = np.zeros([50, M], float) 
    128127    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)    
    131129    emis_spec_f = np.zeros([7000, M], float) 
    132130    emis_lamb_f = np.zeros([7000, M], float) 
    133131    emis_ratio_f = np.zeros([7000, M], float) 
    134132    emis_diff_f = np.zeros([7000, M], float) 
     133    X = np.zeros([7000, M], float) 
     134    Y = np.zeros([7000, M], float) 
    135135    L_spec = np.zeros([M], int) 
    136136    for imo in range (0, M): 
    137         #print 'month ' + month[imo] 
     137        print 'month ' + month[imo] 
    138138        # 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 
    139139        y_index_spec = np.where(emis_spec_moy[:, :, imo] >= lim_spec[imo])[0]  
     140        Y[0 : len(y_index_spec), imo] = y_index_spec[:] 
    140141        x_index_spec = np.where(emis_spec_moy[:, :, imo] >= lim_spec[imo])[1] 
     142        X[0 : len(x_index_spec), imo] = x_index_spec[:] 
    141143        L_spec[imo] = len(x_index_spec) # = len(y_index) 
    142144        #print 'length of x and y index ', L_spec[imo] 
    143145        # 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' 
    144147        for ii in range (0, L_spec[imo]): 
    145148            emis_spec_f[ii, imo] = emis_spec_moy[y_index_spec[ii], x_index_spec[ii], imo] 
     
    147150            emis_ratio_f[ii, imo] = emis_ratio[y_index_spec[ii], x_index_spec[ii], imo] 
    148151            emis_diff_f[ii, imo] = emis_diff[y_index_spec[ii], x_index_spec[ii], imo] 
    149         ''' 
     152        print 'calculation of histogram distribution' 
    150153        # 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] 
    155160        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]) 
    161165 
    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)       
    163168 
    164169 
  • trunk/src/scripts_Laura/ARCTIC/Travail_CEN/ice_delimit_AMSUB_data.py

    r46 r47  
    4141 
    4242 
     43frequ = 89 
    4344 
    4445##################### 
     
    5657    ### emissivity ### 
    5758    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_AMSUA30_' + 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') 
    5960    xdist = fichier_emis.variables['longitude'][:] 
    6061    ydist = fichier_emis.variables['latitude'][:] 
     
    7071    ### monthly emissivity ratio ### 
    7172    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_AMSUA30_' + 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') 
    7374    xdist = fichier_ratio.variables['longitude'][:] 
    7475    ydist = fichier_ratio.variables['latitude'][:] 
     
    9495 
    9596c = 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 
     100fontP = FontProperties() 
     101fontP.set_size('small') 
    99102print 'distribution of emissivity values' 
    100103################################### 
     
    119122xlabel('emissivity SPEC') 
    120123ylabel('frequency of occurence') 
    121 fontP = FontProperties() 
    122 fontP.set_size('small') 
    123124legend(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') 
    125126## plot six following months of spec emissivity histograms ## 
    126127figure() 
     
    133134ylabel('frequency of occurence') 
    134135legend(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') 
    136137 
    137138# find the emissivity value corresponding to the threshold of ice/no_ice limit 
     
    139140for imo in range (0, M): 
    140141    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 FREQUENCY 
    142     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 emissivity 
    143     cc = np.where(hist_vals_spec[imo, bb] == max(hist_vals_spec[imo, bb]))[0] # which emissivity index corresponds to peak emissivity 
    144     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] 
    146147 
    147148# plot monthly evolution of emissivity spec threshold used for delimitation 
     
    153154legend(loc = 2) 
    154155xlim(-1, M) 
    155 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emis_lim_frequ_SPEC_AMSUA30_2009.png') 
     156plt.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') 
    156157 
    157158 
     
    177178ylabel('frequency of occurence') 
    178179legend(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') 
    180181## plot six following months of spec emissivity histograms ## 
    181182figure() 
     
    188189ylabel('frequency of occurence') 
    189190legend(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') 
    191192 
    192193# find the emissivity value corresponding to the threshold of ice/no_ice limit 
     
    194195for imo in range (0, M): 
    195196    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 FREQUENCY 
    197     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 emissivity 
    198     cc = np.where(hist_vals_lamb[imo, bb] == max(hist_vals_lamb[imo, bb]))[0] # which emissivity index corresponds to peak emissivity 
    199     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] 
    201202 
    202203# plot monthly evolution of emissivity spec threshold used for delimitation 
     
    208209legend(loc = 2) 
    209210xlim(-1, M) 
    210 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emis_lim_frequ_LAMB_AMSUA30_2009.png') 
     211plt.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') 
    211212 
    212213 
     
    233234ylabel('frequency of occurence') 
    234235legend(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') 
    236237## plot six following months of spec emissivity histograms ## 
    237238figure() 
     
    244245ylabel('frequency of occurence') 
    245246legend(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') 
    247248 
    248249# no definition of threshold for ICE / NO_ICE delimitation because no apparent distinction signal // use of this signal for internal ice classification 
     
    280281legend(loc = 2, prop = fontP) 
    281282xlim(-1, M) 
    282 plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/emis_lim_frequ_spec_and_lamb_AMSUA30_2009.png') 
     283plt.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') 
    283284 
    284285 
     
    304305            else: 
    305306                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 
    307308                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/AMSUA30_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') 
    312313 
    313314#### LAMB emiss #### 
     
    322323            else: 
    323324                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 
    325326                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/AMSUA30_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') 
    330331 
    331332 
     
    343344for imo in range (0, M): 
    344345    ice_spec = reshape(ice_zone_spec[imo, :, :], size(ice_zone_spec[imo, :, :])) 
    345     nb_pix_spec[imo] = len(np.where(ice_spec == 1.)[0]) 
     346    nb_pix_spec[imo] = len(np.where(isnan(ice_spec) == False)[0]) 
    346347    total_ice_area_spec[imo] = (pix_area * nb_pix_spec[imo]) + (926. * pix_area) 
    347348 
     
    353354for imo in range (0, M): 
    354355    ice_lamb = reshape(ice_zone_lamb[imo, :, :], size(ice_zone_lamb[imo, :, :])) 
    355     nb_pix_lamb[imo] = len(np.where(ice_lamb == 1.)[0]) 
     356    nb_pix_lamb[imo] = len(np.where(isnan(ice_lamb) == False)[0]) 
    356357    total_ice_area_lamb[imo] = (pix_area * nb_pix_lamb[imo]) + (926. * pix_area) 
    357358 
     
    364365###################### 
    365366print 'start stacking in .dat file' 
    366 data_classif = open ('/net/argos/data/parvati/lahlod/ARCTIC/AMSUA_ice_class/AMSUA30_data_classification_parameters_ice_no-ice_2009.dat', 'a') 
     367data_classif = open ('/net/argos/data/parvati/lahlod/ARCTIC/AMSUB_ice_class/AMSUB'+str(frequ)+'_data_classification_parameters_ice_no-ice_2009.dat', 'a') 
    367368for imo in range (0, M): 
    368369    for ii in range (0, 50): 
     
    391392for imo in range (0, M): 
    392393    print 'stack in file month ' + str(month[imo]) 
    393     rootgrp = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSUA_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') 
    394395    rootgrp.createDimension('longitude', len(xdist)) 
    395396    rootgrp.createDimension('latitude', len(ydist)) 
  • trunk/src/scripts_Laura/ARCTIC/Travail_CEN/import_ice_class_delimit_AMSU_data.py

    r46 r47  
    55import matplotlib.pyplot as plt 
    66from pylab import * 
    7 from mpl_toolkits.basemap import Basemap 
    8 from mpl_toolkits.basemap import shiftgrid, cm 
    97from 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 
    1510from matplotlib.font_manager import FontProperties 
    16 import map_cartesian_grid 
     11#import map_cartesian_grid 
    1712import ice_class_delimit_AMSU_data 
    1813 
    1914 
    2015 
    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 
     17MONTH = np.array(['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']) 
     18month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER']) 
     19month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) 
     20M = len(month) 
     21 
     22 
     23 
     24frequ = 89 
     25 
     26################################################################################ 
     27# compute filtered points of emissivity SPEC, LAMB, rate, difference LAMB-SPEC # 
     28################################################################################ 
     29emis_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) 
     30spec = emis_spec_f 
     31lamb = emis_lamb_f 
     32ratio = emis_ratio_f 
     33diff = emis_diff_f 
     34L_spec = L_spec 
     35X = X 
     36Y = Y 
     37hist_spec = hist_val_spec 
     38hist_lamb = hist_val_lamb 
     39hist_ratio = hist_val_ratio 
     40hist_diff = hist_val_diff 
     41corresp_spec = corresp_val_spec 
     42corresp_lamb = corresp_val_lamb 
     43corresp_ratio = corresp_val_ratio 
     44corresp_diff = corresp_val_diff 
     45 
     46 
     47 
     48######## 
     49# plot # 
     50######## 
     51ion() 
     52c = np.array(['r', 'b', 'c', 'm', 'y', 'g']) 
     53fontP = FontProperties() 
     54fontP.set_size('small') 
     55#### SPEC #### 
     56figure() 
     57for imo in range (0, 6): 
     58    plot(corresp_spec[:, imo], hist_spec[:, imo], c = str(c[imo]), label = str(month[imo])) 
     59 
     60grid() 
     61xlim(corresp_spec.min() - 0.02, corresp_spec.max() + 0.02) 
     62xlabel('emissivity spec') 
     63ylabel('frequency of occurence') 
     64legend(prop = fontP, loc = 2) 
     65plt.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 ## 
     67figure() 
     68for imo in range (6, M): 
     69    plot(corresp_spec[:, imo], hist_spec[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 
     70 
     71grid() 
     72xlim(corresp_spec.min() - 0.02, corresp_spec.max() + 0.02) 
     73xlabel('emissivity spec') 
     74ylabel('frequency of occurence') 
     75legend(loc = 1, prop = fontP) 
     76plt.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 #### 
     81figure() 
     82for imo in range (0, 6): 
     83    plot(corresp_lamb[:, imo], hist_lamb[:, imo], c = str(c[imo]), label = str(month[imo])) 
     84 
     85grid() 
     86xlim(corresp_lamb.min() - 0.02, corresp_lamb.max() + 0.02) 
     87xlabel('emissivity lamb') 
     88ylabel('frequency of occurence') 
     89fontP = FontProperties() 
     90fontP.set_size('small') 
     91legend(prop = fontP, loc = 2) 
     92plt.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 ## 
     94figure() 
     95for imo in range (6, M): 
     96    plot(corresp_lamb[:, imo], hist_lamb[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 
     97 
     98grid() 
     99xlim(corresp_lamb.min() - 0.02, corresp_lamb.max() + 0.02) 
     100xlabel('emissivity lamb') 
     101ylabel('frequency of occurence') 
     102legend(loc = 1, prop = fontP) 
     103plt.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 #### 
     106figure() 
     107for imo in range (0, 6): 
     108    plot(corresp_ratio[:, imo], hist_ratio[:, imo], c = str(c[imo]), label = str(month[imo])) 
     109 
     110grid() 
     111xlim(corresp_ratio.min() - 0.02, corresp_ratio.max() + 0.02) 
     112xlabel('emissivity ratio') 
     113ylabel('frequency of occurence') 
     114fontP = FontProperties() 
     115fontP.set_size('small') 
     116legend(prop = fontP, loc = 1) 
     117plt.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 ## 
     119figure() 
     120for imo in range (6, M): 
     121    plot(corresp_ratio[:, imo], hist_ratio[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 
     122 
     123grid() 
     124xlim(corresp_ratio.min() - 0.02, corresp_ratio.max() + 0.02) 
     125xlabel('emissivity ratio') 
     126ylabel('frequency of occurence') 
     127legend(loc = 1, prop = fontP) 
     128plt.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 #### 
     131figure() 
     132for imo in range (0, 6): 
     133    plot(corresp_diff[:, imo], hist_diff[:, imo], c = str(c[imo]), label = str(month[imo])) 
     134 
     135grid() 
     136xlim(corresp_diff.min() - 0.002, corresp_diff.max() + 0.002) 
     137xlabel('emissivity diff') 
     138ylabel('frequency of occurence') 
     139fontP = FontProperties() 
     140fontP.set_size('small') 
     141legend(prop = fontP, loc = 1) 
     142plt.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 ## 
     144figure() 
     145for imo in range (6, M): 
     146    plot(corresp_diff[:, imo], hist_diff[:, imo], c = str(c[imo - 6]), label = str(month[imo])) 
     147 
     148grid() 
     149xlim(corresp_diff.min() - 0.002, corresp_diff.max() + 0.002) 
     150xlabel('emissivity diff') 
     151ylabel('frequency of occurence') 
     152legend(loc = 1, prop = fontP) 
     153plt.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''' 
    29159frequ = 30 
    30 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec = ice_class_delimit_AMSU_data.filtering(frequ) 
     160emis_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) 
    31161spec_30 = emis_spec_f 
    32162lamb_30 = emis_lamb_f 
     
    34164diff_30 = emis_diff_f 
    35165L_spec_30 = L_spec 
     166X_30 = X 
     167Y_30 = Y 
    36168 
    37169frequ = 50 
    38 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec = ice_class_delimit_AMSU_data.filtering(frequ) 
     170emis_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) 
    39171spec_50 = emis_spec_f 
    40172lamb_50 = emis_lamb_f 
     
    42174diff_50 = emis_diff_f 
    43175L_spec_50 = L_spec 
     176X_50 = X 
     177Y_50 = Y 
    44178 
    45179frequ = 89 
    46 emis_spec_f, emis_lamb_f, emis_ratio_f, emis_diff_f, L_spec = ice_class_delimit_AMSU_data.filtering(frequ) 
     180emis_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) 
    47181spec_89 = emis_spec_f 
    48182lamb_89 = emis_lamb_f 
     
    50184diff_89 = emis_diff_f 
    51185L_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) 
     186X_89 = X 
     187Y_89 = Y 
     188 
     189 
     190XX = X_89[:, 0][nonzero(X_89[:, 0] != 0.)] 
     191YY = Y_89[:, 0][nonzero(Y_89[:, 0] != 0.)] 
     192L = len(XX) 
     193for ii in range (0, L): 
     194    emis_spec_moy[YY[ii], XX[ii]] 
     195 
     196 
     197 
    61198 
    62199a1 = np.zeros([M], float) 
     
    70207    a4[imo] = corrcoef(spec_89[0 : 3243, imo], diff_89[0 : 3243, imo])[0][1] 
    71208 
    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]])) 
     209params = 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]])) 
    73210 
    74211figure() 
    75212pc = pcolor(correl_matrix) 
    76213colorbar(pc) 
    77  
     214''' 
Note: See TracChangeset for help on using the changeset viewer.