1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | import string |
---|
4 | import numpy as np |
---|
5 | import matplotlib.pyplot as plt |
---|
6 | from pylab import * |
---|
7 | from mpl_toolkits.basemap import Basemap |
---|
8 | from mpl_toolkits.basemap import shiftgrid, cm |
---|
9 | 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 |
---|
15 | from matplotlib import colors |
---|
16 | from matplotlib.font_manager import FontProperties |
---|
17 | import map_cartesian_grid |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | MONTH = np.array(['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']) |
---|
23 | month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER']) |
---|
24 | month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) |
---|
25 | M = len(month) |
---|
26 | |
---|
27 | |
---|
28 | ######################## |
---|
29 | # grid characteristics # |
---|
30 | ######################## |
---|
31 | x0 = -3000. # min limit of grid |
---|
32 | x1 = 2500. # max limit of grid |
---|
33 | dx = 40. |
---|
34 | xvec = np.arange(x0, x1+dx, dx) |
---|
35 | nx = len(xvec) |
---|
36 | y0 = -3000. # min limit of grid |
---|
37 | y1 = 3000. # max limit of grid |
---|
38 | dy = 40. |
---|
39 | yvec = np.arange(y0, y1+dy, dy) |
---|
40 | ny = len(yvec) |
---|
41 | |
---|
42 | |
---|
43 | frequ = 89 |
---|
44 | |
---|
45 | ##################### |
---|
46 | # read NETCDF files # |
---|
47 | ##################### |
---|
48 | emis_spec_month = np.zeros([M, ny, nx], float) |
---|
49 | emis_lamb_month = np.zeros([M, ny, nx], float) |
---|
50 | ratio_emis = np.zeros([M, ny, nx], float) |
---|
51 | ratio_emis_vec = np.zeros([M, ny * nx], float) |
---|
52 | spec_emis_vec = np.zeros([M, ny * nx], float) |
---|
53 | lamb_emis_vec = np.zeros([M, ny * nx], float) |
---|
54 | print 'read data from files' |
---|
55 | for imo in range (0, M): |
---|
56 | print 'month: ' + month[imo] |
---|
57 | ### emissivity ### |
---|
58 | print 'open emissivity file' |
---|
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') |
---|
60 | xdist = fichier_emis.variables['longitude'][:] |
---|
61 | ydist = fichier_emis.variables['latitude'][:] |
---|
62 | day = fichier_emis.variables['days'][:] |
---|
63 | emis_spec = fichier_emis.variables['e_spec'][:] |
---|
64 | emis_lamb = fichier_emis.variables['e_lamb'][:] |
---|
65 | fichier_emis.close() |
---|
66 | ##### calculate monthly mean of emis ##### |
---|
67 | for ilat in range(0, len(ydist)): |
---|
68 | for ilon in range (0, len(xdist)): |
---|
69 | emis_spec_month[imo, ilat, ilon] = mean(emis_spec[ilat, ilon, 0 : month_day[imo]][nonzero(isnan(emis_spec[ilat, ilon, 0 : month_day[imo]]) == False)]) |
---|
70 | emis_lamb_month[imo, ilat, ilon] = mean(emis_lamb[ilat, ilon, 0 : month_day[imo]][nonzero(isnan(emis_lamb[ilat, ilon, 0 : month_day[imo]]) == False)]) |
---|
71 | ### monthly emissivity ratio ### |
---|
72 | print 'open emissivity ratio file' |
---|
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') |
---|
74 | xdist = fichier_ratio.variables['longitude'][:] |
---|
75 | ydist = fichier_ratio.variables['latitude'][:] |
---|
76 | ratio_emis[imo, :, :] = fichier_ratio.variables['emis_ratio'][:] |
---|
77 | fichier_ratio.close() |
---|
78 | ### reshape in monthly vectors all data in 2D arrays ### |
---|
79 | print 'reshape data' |
---|
80 | ratio_emis_vec[imo, :] = reshape(ratio_emis[imo, :, :], size(ratio_emis[imo, :, :])) |
---|
81 | spec_emis_vec[imo, :] = reshape(emis_spec_month[imo, :, :], size(emis_spec_month[imo, :, :])) |
---|
82 | lamb_emis_vec[imo, :] = reshape(emis_lamb_month[imo, :, :], size(emis_lamb_month[imo, :, :])) |
---|
83 | |
---|
84 | |
---|
85 | ''' |
---|
86 | # test: |
---|
87 | ion() |
---|
88 | x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() |
---|
89 | x_coast = x_ind |
---|
90 | y_coast = y_ind |
---|
91 | z_coast = z_ind |
---|
92 | map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xdist, ydist, emis_spec_month[0, :, :], 0.45, 1.02, 0.01, cm.s3pcpn_l_r, 'test') |
---|
93 | ''' |
---|
94 | |
---|
95 | |
---|
96 | c = np.array(['r', 'b', 'c', 'm', 'y', 'g']) |
---|
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') |
---|
102 | print 'distribution of emissivity values' |
---|
103 | ################################### |
---|
104 | # distribution of SPEC emissivity # |
---|
105 | ################################### |
---|
106 | print 'spec' |
---|
107 | hist_vals_spec = np.zeros([M, 50], float) |
---|
108 | corresp_emis_spec = np.zeros([M, 50], float) |
---|
109 | for imo in range (0, M): |
---|
110 | hist_vals_spec[imo, :] = hist(spec_emis_vec[imo, :][nonzero(isnan(spec_emis_vec[imo,:]) == False)], bins = 50, normed = True, histtype='step')[0] |
---|
111 | for ibin in range (0, 50): |
---|
112 | corresp_emis_spec[imo, ibin] = mean(hist(spec_emis_vec[imo, :][nonzero(isnan(spec_emis_vec[imo,:]) == False)], bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
113 | |
---|
114 | ## plot first six months of spec emissivity histograms ## |
---|
115 | ion() |
---|
116 | figure() |
---|
117 | for imo in range (0, 6): |
---|
118 | plot(corresp_emis_spec[imo], hist_vals_spec[imo], c = str(c[imo]), label = str(month[imo])) |
---|
119 | |
---|
120 | grid() |
---|
121 | xlim(corresp_emis_spec.min() - 0.02, 1.02) |
---|
122 | xlabel('emissivity SPEC') |
---|
123 | ylabel('frequency of occurence') |
---|
124 | legend(loc = 2, prop = fontP) |
---|
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') |
---|
126 | ## plot six following months of spec emissivity histograms ## |
---|
127 | figure() |
---|
128 | for imo in range (6, M): |
---|
129 | plot(corresp_emis_spec[imo], hist_vals_spec[imo], c = str(c[imo - 6]), label = str(month[imo])) |
---|
130 | |
---|
131 | grid() |
---|
132 | xlim(corresp_emis_spec.min() - 0.02, 1.02) |
---|
133 | xlabel('emissivity SPEC') |
---|
134 | ylabel('frequency of occurence') |
---|
135 | legend(loc = 9, prop = fontP) |
---|
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') |
---|
137 | |
---|
138 | # find the emissivity value corresponding to the threshold of ice/no_ice limit |
---|
139 | emis_lim_spec = np.zeros([M], float) |
---|
140 | for imo in range (0, M): |
---|
141 | print 'month ' + str(month[imo]) |
---|
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] |
---|
147 | |
---|
148 | # plot monthly evolution of emissivity spec threshold used for delimitation |
---|
149 | figure() |
---|
150 | plot(np.arange(0, M, 1), emis_lim_spec, 'b-+', label = 'emis SPEC') |
---|
151 | ylabel('emissivity SPEC threshold') |
---|
152 | grid() |
---|
153 | xticks(np.arange(0, M, 1), month, rotation = 25) |
---|
154 | legend(loc = 2) |
---|
155 | xlim(-1, M) |
---|
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') |
---|
157 | |
---|
158 | |
---|
159 | ################################### |
---|
160 | # distribution of LAMB emissivity # |
---|
161 | ################################### |
---|
162 | print 'lamb' |
---|
163 | hist_vals_lamb = np.zeros([M, 50], float) |
---|
164 | corresp_emis_lamb = np.zeros([M, 50], float) |
---|
165 | for imo in range (0, M): |
---|
166 | hist_vals_lamb[imo, :] = hist(lamb_emis_vec[imo, :][nonzero(isnan(lamb_emis_vec[imo,:]) == False)], bins = 50, normed = True, histtype='step')[0] |
---|
167 | for ibin in range (0, 50): |
---|
168 | corresp_emis_lamb[imo, ibin] = mean(hist(lamb_emis_vec[imo, :][nonzero(isnan(lamb_emis_vec[imo,:]) == False)], bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
169 | |
---|
170 | ## plot first six months of spec emissivity histograms ## |
---|
171 | figure() |
---|
172 | for imo in range (0, 6): |
---|
173 | plot(corresp_emis_lamb[imo], hist_vals_lamb[imo], c = str(c[imo]), label = str(month[imo])) |
---|
174 | |
---|
175 | grid() |
---|
176 | xlim(corresp_emis_lamb.min() - 0.02, 1.02) |
---|
177 | xlabel('emissivity LAMB') |
---|
178 | ylabel('frequency of occurence') |
---|
179 | legend(loc = 2, prop = fontP) |
---|
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') |
---|
181 | ## plot six following months of spec emissivity histograms ## |
---|
182 | figure() |
---|
183 | for imo in range (6, M): |
---|
184 | plot(corresp_emis_lamb[imo], hist_vals_lamb[imo], c = str(c[imo - 6]), label = str(month[imo])) |
---|
185 | |
---|
186 | grid() |
---|
187 | xlim(corresp_emis_lamb.min() - 0.02, 1.02) |
---|
188 | xlabel('emissivity LAMB') |
---|
189 | ylabel('frequency of occurence') |
---|
190 | legend(loc = 9, prop = fontP) |
---|
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') |
---|
192 | |
---|
193 | # find the emissivity value corresponding to the threshold of ice/no_ice limit |
---|
194 | emis_lim_lamb = np.zeros([M], float) |
---|
195 | for imo in range (0, M): |
---|
196 | print 'month ' + str(month[imo]) |
---|
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] |
---|
202 | |
---|
203 | # plot monthly evolution of emissivity spec threshold used for delimitation |
---|
204 | figure() |
---|
205 | plot(np.arange(0, M, 1), emis_lim_lamb, 'b-+', label = 'emis LAMB') |
---|
206 | ylabel('emissivity LAMB threshold') |
---|
207 | grid() |
---|
208 | xticks(np.arange(0, M, 1), month, rotation = 25) |
---|
209 | legend(loc = 2) |
---|
210 | xlim(-1, M) |
---|
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') |
---|
212 | |
---|
213 | |
---|
214 | |
---|
215 | ################################### |
---|
216 | # distribution of emissivity rate # |
---|
217 | ################################### |
---|
218 | print 'rate' |
---|
219 | hist_vals_rate = np.zeros([M, 50], float) |
---|
220 | corresp_emis_rate = np.zeros([M, 50], float) |
---|
221 | for imo in range (0, M): |
---|
222 | hist_vals_rate[imo, :] = hist(ratio_emis_vec[imo, :][nonzero(isnan(ratio_emis_vec[imo,:]) == False)], bins = 50, normed = True, histtype='step')[0] |
---|
223 | for ibin in range (0, 50): |
---|
224 | corresp_emis_rate[imo, ibin] = mean(hist(ratio_emis_vec[imo, :][nonzero(isnan(ratio_emis_vec[imo,:]) == False)], bins = 50, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
225 | |
---|
226 | ## plot first six months of spec emissivity histograms ## |
---|
227 | figure() |
---|
228 | for imo in range (0, 6): |
---|
229 | plot(corresp_emis_rate[imo], hist_vals_rate[imo], c = str(c[imo]), label = str(month[imo])) |
---|
230 | |
---|
231 | grid() |
---|
232 | xlim(corresp_emis_rate.min() - 0.02, corresp_emis_rate.max() + 0.02) |
---|
233 | xlabel('emissivity rate (%)') |
---|
234 | ylabel('frequency of occurence') |
---|
235 | legend(prop = fontP) |
---|
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') |
---|
237 | ## plot six following months of spec emissivity histograms ## |
---|
238 | figure() |
---|
239 | for imo in range (6, M): |
---|
240 | plot(corresp_emis_rate[imo], hist_vals_rate[imo], c = str(c[imo - 6]), label = str(month[imo])) |
---|
241 | |
---|
242 | grid() |
---|
243 | xlim(corresp_emis_rate.min() - 0.02, corresp_emis_rate.max() + 0.02) |
---|
244 | xlabel('emissivity rate (%)') |
---|
245 | ylabel('frequency of occurence') |
---|
246 | legend(loc = 9, prop = fontP) |
---|
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') |
---|
248 | |
---|
249 | # no definition of threshold for ICE / NO_ICE delimitation because no apparent distinction signal // use of this signal for internal ice classification |
---|
250 | ''' |
---|
251 | # find the emissivity value corresponding to the threshold of ice/no_ice limit |
---|
252 | emis_lim_rate = np.zeros([M], float) |
---|
253 | for imo in range (0, M): |
---|
254 | bb = np.where((corresp_emis_rate[imo, :] < 0.6))[0] # only consider low emissivity values (open sea) // CHANGE EMISSIVITY VALUE ACCORDING TO FREQUENCY |
---|
255 | aa = np.where(hist_vals_rate[imo, bb] < max(hist_vals_rate[imo, bb]) / 4.)[0] # of these latter values, only consider emissivity values lower than 1/4*peak emissivity |
---|
256 | cc = np.where(hist_vals_rate[imo, bb] == max(hist_vals_rate[imo, bb]))[0] # which emissivity index corresponds to peak emissivity |
---|
257 | dd = np.where(aa > cc[0])[0] |
---|
258 | emis_lim_rate[imo] = corresp_emis_rate[imo, bb][aa][dd[0]] |
---|
259 | |
---|
260 | # plot monthly evolution of emissivity spec threshold used for delimitation |
---|
261 | figure() |
---|
262 | plot(np.arange(0, M, 1), emis_lim_rate, 'b-+', label = 'emis LAMB') |
---|
263 | ylabel('emissivity rate threshold - AMSUB 89GHz') |
---|
264 | grid() |
---|
265 | xticks(np.arange(0, M, 1), month, rotation = 25) |
---|
266 | legend(loc = 2) |
---|
267 | xlim(-1, M) |
---|
268 | plt.savefig('/usr/home/lahlod/twice_d/figure_output_ARCTIC/figure_output_CEN/ice_class_AMSUA/emis_lim_frequ_rate_AMSUA89_2009.png') |
---|
269 | ''' |
---|
270 | |
---|
271 | |
---|
272 | ############################################################################## |
---|
273 | # plot comparison of emissivity thresholds between spec and lamb assumptions # |
---|
274 | ############################################################################## |
---|
275 | figure() |
---|
276 | plot(np.arange(0, M, 1), emis_lim_spec, 'b-+', label = 'emis SPEC') |
---|
277 | plot(np.arange(0, M, 1), emis_lim_lamb, 'g-+', label = 'emis LAMB') |
---|
278 | ylabel('emissivity threshold') |
---|
279 | grid() |
---|
280 | xticks(np.arange(0, M, 1), month, rotation = 25) |
---|
281 | legend(loc = 2, prop = fontP) |
---|
282 | xlim(-1, M) |
---|
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') |
---|
284 | |
---|
285 | |
---|
286 | |
---|
287 | |
---|
288 | ################################################################ |
---|
289 | # delimitation ice - no_ice with emissivity or ratio threshold # |
---|
290 | ################################################################ |
---|
291 | print 'definition of ice extent' |
---|
292 | x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() |
---|
293 | x_coast = x_ind |
---|
294 | y_coast = y_ind |
---|
295 | z_coast = z_ind |
---|
296 | #### SPEC emiss #### |
---|
297 | print 'spec' |
---|
298 | ice_zone_spec = np.zeros([M, 151, 139], float) |
---|
299 | for imo in range (0, M): |
---|
300 | print 'month: ' + str(month[imo]) |
---|
301 | for ilat in range (0, 151): |
---|
302 | for ilon in range (0, 139): |
---|
303 | if (isnan(emis_spec_month[imo, ilat, ilon]) == True): |
---|
304 | ice_zone_spec[imo, ilat, ilon] = NaN |
---|
305 | else: |
---|
306 | if (emis_spec_month[imo, ilat, ilon] <= emis_lim_spec[imo]): # use the monthly SPEC emissivity threshold |
---|
307 | ice_zone_spec[imo, ilat, ilon] = NaN |
---|
308 | else: |
---|
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') |
---|
313 | |
---|
314 | #### LAMB emiss #### |
---|
315 | print 'lamb' |
---|
316 | ice_zone_lamb = np.zeros([M, 151, 139], float) |
---|
317 | for imo in range (0, M): |
---|
318 | print 'month: ' + str(month[imo]) |
---|
319 | for ilat in range (0, 151): |
---|
320 | for ilon in range (0, 139): |
---|
321 | if (isnan(emis_lamb_month[imo, ilat, ilon]) == True): |
---|
322 | ice_zone_lamb[imo, ilat, ilon] = NaN |
---|
323 | else: |
---|
324 | if (emis_lamb_month[imo, ilat, ilon] <= emis_lim_lamb[imo]): # use the monthly SPEC emissivity threshold |
---|
325 | ice_zone_lamb[imo, ilat, ilon] = NaN |
---|
326 | else: |
---|
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[imo, :, :], 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') |
---|
331 | |
---|
332 | |
---|
333 | |
---|
334 | ########################### |
---|
335 | # calculation of ice area # |
---|
336 | ########################### |
---|
337 | # nb of pixels near pole = 926 |
---|
338 | print 'calculation of ice area' |
---|
339 | pix_area = 40. * 40. |
---|
340 | #### SPEC #### |
---|
341 | print 'spec' |
---|
342 | nb_pix_spec = np.zeros([M], float) |
---|
343 | total_ice_area_spec = np.zeros([M], float) |
---|
344 | for imo in range (0, M): |
---|
345 | ice_spec = reshape(ice_zone_spec[imo, :, :], size(ice_zone_spec[imo, :, :])) |
---|
346 | nb_pix_spec[imo] = len(np.where(isnan(ice_spec) == False)[0]) |
---|
347 | total_ice_area_spec[imo] = (pix_area * nb_pix_spec[imo]) + (926. * pix_area) |
---|
348 | |
---|
349 | |
---|
350 | #### LAMB #### |
---|
351 | print 'lamb' |
---|
352 | nb_pix_lamb = np.zeros([M], float) |
---|
353 | total_ice_area_lamb = np.zeros([M], float) |
---|
354 | for imo in range (0, M): |
---|
355 | ice_lamb = reshape(ice_zone_lamb[imo, :, :], size(ice_zone_lamb[imo, :, :])) |
---|
356 | nb_pix_lamb[imo] = len(np.where(isnan(ice_lamb) == False)[0]) |
---|
357 | total_ice_area_lamb[imo] = (pix_area * nb_pix_lamb[imo]) + (926. * pix_area) |
---|
358 | |
---|
359 | |
---|
360 | |
---|
361 | ########################################## STACK DATA ################################################### |
---|
362 | |
---|
363 | ###################### |
---|
364 | # stack in .dat file # |
---|
365 | ###################### |
---|
366 | print 'start stacking in .dat file' |
---|
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') |
---|
368 | for imo in range (0, M): |
---|
369 | for ii in range (0, 50): |
---|
370 | data_classif.write(('%(months)10s %(hist_vals_spec)10.5f %(corresp_emis_spec)10.5f %(hist_vals_lamb)10.5f %(corresp_emis_lamb)10.5f %(hist_vals_rate)10.5f %(corresp_emis_rate)10.5f %(emis_lim_spec)10.5f %(emis_lim_lamb)10.5f %(spec_ice_area)10.5f %(lamb_ice_area)10.5f \n' % { |
---|
371 | 'months':month[imo], |
---|
372 | 'hist_vals_spec':hist_vals_spec[imo, ii], |
---|
373 | 'corresp_emis_spec':corresp_emis_spec[imo, ii], |
---|
374 | 'hist_vals_lamb':hist_vals_lamb[imo, ii], |
---|
375 | 'corresp_emis_lamb':corresp_emis_lamb[imo, ii], |
---|
376 | 'hist_vals_rate':hist_vals_rate[imo, ii], |
---|
377 | 'corresp_emis_rate':corresp_emis_rate[imo, ii], |
---|
378 | 'emis_lim_spec':emis_lim_spec[imo], |
---|
379 | 'emis_lim_lamb':emis_lim_lamb[imo], |
---|
380 | 'spec_ice_area':total_ice_area_spec[imo], |
---|
381 | 'lamb_ice_area':total_ice_area_lamb[imo], |
---|
382 | })) |
---|
383 | |
---|
384 | data_classif.close() |
---|
385 | |
---|
386 | |
---|
387 | |
---|
388 | ######################## |
---|
389 | # stack in netcdf file # |
---|
390 | ######################## |
---|
391 | print 'start stacking' |
---|
392 | for imo in range (0, M): |
---|
393 | print 'stack in file month ' + str(month[imo]) |
---|
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') |
---|
395 | rootgrp.createDimension('longitude', len(xdist)) |
---|
396 | rootgrp.createDimension('latitude', len(ydist)) |
---|
397 | nc_lon = rootgrp.createVariable('longitude', 'f', ('longitude',)) |
---|
398 | nc_lat = rootgrp.createVariable('latitude', 'f', ('latitude',)) |
---|
399 | nc_ice_spec = rootgrp.createVariable('spec_ice_area', 'f', ('latitude', 'longitude')) |
---|
400 | nc_ice_lamb = rootgrp.createVariable('lamb_ice_area', 'f', ('latitude', 'longitude')) |
---|
401 | nc_lon[:] = xdist |
---|
402 | nc_lat[:] = ydist |
---|
403 | nc_ice_spec[:] = ice_zone_spec[imo, :, :] |
---|
404 | nc_ice_lamb[:] = ice_zone_lamb[imo, :, :] |
---|
405 | rootgrp.close() |
---|
406 | |
---|
407 | |
---|
408 | |
---|
409 | |
---|
410 | |
---|
411 | ''' |
---|
412 | ################################### |
---|
413 | # plot time evolution of ice area # |
---|
414 | ################################### |
---|
415 | figure() |
---|
416 | plot(total_ice_area, '-+b', label = 'AMSUB SPEC') |
---|
417 | plot(total_ice_area_osi, '-^r', label = 'OSISAF') |
---|
418 | plot(total_ice_area_l, '-og', label = 'AMSUB LAMB') |
---|
419 | legend(loc = 3) |
---|
420 | xlim(-1, M) |
---|
421 | ylim(0.2*1e7, 1.3*1e7) |
---|
422 | xticks(np.arange(0, M, 1), month, rotation = 25) |
---|
423 | ylabel('totale ice area (square km)') |
---|
424 | grid() |
---|
425 | plt.savefig('/usr/home/lahlod/twice_d/figure_output_ARCTIC/figure_output_CEN/ice_pix_area/total_ice_area_AMSUB_SPEC_LAMB_OSISAF_2009.png') |
---|
426 | ''' |
---|
427 | |
---|
428 | |
---|
429 | |
---|
430 | |
---|
431 | |
---|
432 | |
---|
433 | |
---|