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 | # time period characteristics # |
---|
22 | ############################### |
---|
23 | MONTH = np.array(['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']) |
---|
24 | month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER']) |
---|
25 | month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) |
---|
26 | M = len(month) |
---|
27 | |
---|
28 | |
---|
29 | ######################## |
---|
30 | # grid characteristics # |
---|
31 | ######################## |
---|
32 | x0 = -3000. # min limit of grid |
---|
33 | x1 = 2500. # max limit of grid |
---|
34 | dx = 40. |
---|
35 | xvec = np.arange(x0, x1+dx, dx) |
---|
36 | nx = len(xvec) |
---|
37 | y0 = -3000. # min limit of grid |
---|
38 | y1 = 3000. # max limit of grid |
---|
39 | dy = 40. |
---|
40 | yvec = np.arange(y0, y1+dy, dy) |
---|
41 | ny = len(yvec) |
---|
42 | |
---|
43 | |
---|
44 | ################################################################################################################## |
---|
45 | # We devide the loop in two steps : |
---|
46 | # - first loop concerns JANUARY, FEBRUARY, MARCH, APRIL, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER - use of AMSUA23GHz SPEC emissivity to seperate ice from no-ice zones |
---|
47 | # - second loop concerns MAY, JUNE, JULY, AUGUST - use of AMSUA89GHz SPEC emissivity to seperate ice from no_ice zones |
---|
48 | ################################################################################################################## |
---|
49 | frequ = 89 # apply threshold on this frequency |
---|
50 | ''' |
---|
51 | #open .dat file to stack data (see end of loop) |
---|
52 | data_classif = open ('/net/argos/data/parvati/lahlod/ARCTIC/AMSUA_ice_class/sub_classification/AMSUA'+str(frequ)+'_data_classification_parameters_ice_no-ice_with_AMSUA23-and-30-spec_2009.dat', 'a') |
---|
53 | bin = 50 |
---|
54 | ''' |
---|
55 | |
---|
56 | |
---|
57 | # daily parameter (2D-array) on ARCTIC area |
---|
58 | emis_spec = np.zeros([M, ny, nx, 31], float) |
---|
59 | emis_lamb = np.zeros([M, ny, nx, 31], float) |
---|
60 | emis_diff = np.zeros([M, ny, nx, 31], float) |
---|
61 | emis_ratio = np.zeros([M, ny, nx, 31], float) |
---|
62 | |
---|
63 | # daily parameter (2D-array) on ARCTIC SEA ICE area |
---|
64 | daily_spec_ice = np.zeros([M, ny, nx, 31], float) |
---|
65 | daily_lamb_ice = np.zeros([M, ny, nx, 31], float) |
---|
66 | daily_diff_ice = np.zeros([M, ny, nx, 31], float) |
---|
67 | daily_ratio_ice = np.zeros([M, ny, nx, 31], float) |
---|
68 | |
---|
69 | ''' |
---|
70 | # monthly mean parameter (1D-array) on ARCTIC SEA ICE area transformed into vector |
---|
71 | spec_vec = np.zeros([M, ny * nx], float) |
---|
72 | lamb_vec = np.zeros([M, ny * nx], float) |
---|
73 | diff_vec = np.zeros([M, ny * nx], float) |
---|
74 | ratio_vec = np.zeros([M, ny * nx], float) |
---|
75 | |
---|
76 | # histogram distribution (intensity of occurence) of parameter in SEA ICE area (1D-array, bins = 200) |
---|
77 | hist_vals_spec = np.zeros([M, bin], float) |
---|
78 | hist_vals_lamb = np.zeros([M, bin], float) |
---|
79 | hist_vals_diff = np.zeros([M, bin], float) |
---|
80 | hist_vals_ratio = np.zeros([M, bin], float) |
---|
81 | |
---|
82 | # histogram distribution (emissivity value) of parameter in SEA ICE area (1D-array, bins = 200) |
---|
83 | corresp_emis_spec = np.zeros([M, bin], float) |
---|
84 | corresp_emis_lamb = np.zeros([M, bin], float) |
---|
85 | corresp_emis_diff = np.zeros([M, bin], float) |
---|
86 | corresp_emis_ratio = np.zeros([M, bin], float) |
---|
87 | ''' |
---|
88 | months1 = np.array([0, 1, 2, 3, 8, 9, 10, 11]) # use AMSUA 23GHz to delimit ice/no_ice for JANUARY, FEBRUARY, MARCH, APRIL, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER |
---|
89 | for imo in months1: |
---|
90 | print 'month ' + month[imo] |
---|
91 | ################################################################################## |
---|
92 | # choice of AMSUA 23GHz delimitation ice/no_ice for the sub_classification study # |
---|
93 | ################################################################################## |
---|
94 | print 'open threshold file' |
---|
95 | fichier_emis = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSUA_ice_class/cartesian_grid_map_ice_no-ice_' + str(month[imo]) + '2009_AMSUA23_spec_lamb_thresholds.nc', 'r', format='NETCDF3_CLASSIC') |
---|
96 | spec_lim = fichier_emis.variables['spec_ice_area'][:] |
---|
97 | #lamb_lim = fichier_emis.variables['lamb_ice_area'][:] |
---|
98 | fichier_emis.close() |
---|
99 | ######################################################### |
---|
100 | # application of AMSUA 23GHz delimitation to other data # |
---|
101 | ######################################################### |
---|
102 | print 'open emissivity to sub_classify file' |
---|
103 | ## data of emis SPEC, LAMB, DIFF(SPEC-LAMB) |
---|
104 | fichier_e = 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') |
---|
105 | day = fichier_e.variables['days'][:] |
---|
106 | emis_spec[imo, :, :, 0 : month_day[imo]] = fichier_e.variables['e_spec'][:] |
---|
107 | emis_lamb[imo, :, :, 0 : month_day[imo]] = fichier_e.variables['e_lamb'][:] |
---|
108 | emis_diff[imo, :, :, 0 : month_day[imo]] = fichier_e.variables['e_spec_lamb'][:] |
---|
109 | fichier_e.close() |
---|
110 | # calculate emis ratio daily |
---|
111 | for ijr in range (0, month_day[imo]): |
---|
112 | for ilon in range (0, nx): |
---|
113 | for ilat in range (0, ny): |
---|
114 | emis_ratio[imo, ilat, ilon, ijr] = ((emis_lamb[imo, ilat, ilon, ijr] - emis_spec[imo, ilat, ilon, ijr]) / emis_spec[imo, ilat, ilon, ijr]) * 100. |
---|
115 | if (isnan(spec_lim[ilat, ilon]) == True): |
---|
116 | daily_spec_ice[imo, ilat, ilon, ijr] = NaN |
---|
117 | daily_lamb_ice[imo, ilat, ilon, ijr] = NaN |
---|
118 | daily_diff_ice[imo, ilat, ilon, ijr] = NaN |
---|
119 | daily_ratio_ice[imo, ilat, ilon, ijr] = NaN |
---|
120 | else: |
---|
121 | daily_spec_ice[imo, ilat, ilon, ijr] = emis_spec[imo, ilat, ilon, ijr] |
---|
122 | daily_lamb_ice[imo, ilat, ilon, ijr] = emis_lamb[imo, ilat, ilon, ijr] |
---|
123 | daily_diff_ice[imo, ilat, ilon, ijr] = emis_diff[imo, ilat, ilon, ijr] |
---|
124 | daily_ratio_ice[imo, ilat, ilon, ijr] = emis_ratio[imo, ilat, ilon, ijr] |
---|
125 | ''' |
---|
126 | # ATTENTION : previous part of script has been modified ==> cannot be applied directly to this following part of script (modification of arrays and names.... |
---|
127 | print 'compute SPEC distribution' |
---|
128 | ######## |
---|
129 | # SPEC # |
---|
130 | ######## |
---|
131 | cs = reshape(spec_ice[imo, :, :], size(spec_ice[imo, :, :]))[nonzero(isnan(reshape(spec_ice[imo, :, :], size(spec_ice[imo, :, :]))) == False)] |
---|
132 | spec_vec[imo, 0 : len(cs)] = cs |
---|
133 | hist_vals_spec[imo, :] = hist(spec_vec[imo, 0 : len(cs)], bins = bin, normed = True, histtype='step')[0] |
---|
134 | for ibin in range (0, bin): |
---|
135 | corresp_emis_spec[imo, ibin] = mean(hist(spec_vec[imo, 0 : len(cs)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
136 | print 'compute LAMB distribution' |
---|
137 | ######## |
---|
138 | # LAMB # |
---|
139 | ######## |
---|
140 | cl = reshape(lamb_ice[imo, :, :], size(lamb_ice[imo, :, :]))[nonzero(isnan(reshape(lamb_ice[imo, :, :], size(lamb_ice[imo, :, :]))) == False)] |
---|
141 | lamb_vec[imo, 0 : len(cl)] = cl |
---|
142 | hist_vals_lamb[imo, :] = hist(lamb_vec[imo, 0 : len(cl)], bins = bin, normed = True, histtype='step')[0] |
---|
143 | for ibin in range (0, bin): |
---|
144 | corresp_emis_lamb[imo, ibin] = mean(hist(lamb_vec[imo, 0 : len(cl)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
145 | print 'compute DIFF distribution' |
---|
146 | ######## |
---|
147 | # DIFF # |
---|
148 | ######## |
---|
149 | cd = reshape(diff_ice[imo, :, :], size(diff_ice[imo, :, :]))[nonzero(isnan(reshape(diff_ice[imo, :, :], size(diff_ice[imo, :, :]))) == False)] |
---|
150 | diff_vec[imo, 0 : len(cd)] = cd |
---|
151 | hist_vals_diff[imo, :] = hist(diff_vec[imo, 0 : len(cd)], bins = bin, normed = True, histtype='step')[0] |
---|
152 | for ibin in range (0, bin): |
---|
153 | corresp_emis_diff[imo, ibin] = mean(hist(diff_vec[imo, 0 : len(cd)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
154 | print 'compute RATIO distribution' |
---|
155 | ######### |
---|
156 | # RATIO # |
---|
157 | ######### |
---|
158 | cr = reshape(ratio_ice[imo, :, :], size(ratio_ice[imo, :, :]))[nonzero(isnan(reshape(ratio_ice[imo, :, :], size(ratio_ice[imo, :, :]))) == False)] |
---|
159 | ratio_vec[imo, 0 : len(cr)] = cr |
---|
160 | hist_vals_ratio[imo, :] = hist(ratio_vec[imo, 0 : len(cr)], bins = bin, normed = True, histtype='step')[0] |
---|
161 | for ibin in range (0, bin): |
---|
162 | corresp_emis_ratio[imo, ibin] = mean(hist(ratio_vec[imo, 0 : len(cr)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
163 | ###################### |
---|
164 | # stack in .dat file # |
---|
165 | ###################### |
---|
166 | print 'start stacking in .dat file' |
---|
167 | #data_classif = open ('/net/argos/data/parvati/lahlod/ARCTIC/AMSUB_ice_class/sub_classification/AMSUB'+str(frequ)+'_data_classification_parameters_ice_no-ice_with_AMSUA23-spec_2009.dat', 'a') |
---|
168 | for ii in range (0, bin): |
---|
169 | 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_diff)10.5f %(corresp_emis_diff)10.5f %(hist_vals_rate)10.5f %(corresp_emis_rate)10.5f \n' % { |
---|
170 | 'months':month[imo], |
---|
171 | 'hist_vals_spec':hist_vals_spec[imo, ii], |
---|
172 | 'corresp_emis_spec':corresp_emis_spec[imo, ii], |
---|
173 | 'hist_vals_lamb':hist_vals_lamb[imo, ii], |
---|
174 | 'corresp_emis_lamb':corresp_emis_lamb[imo, ii], |
---|
175 | 'hist_vals_diff':hist_vals_diff[imo, ii], |
---|
176 | 'corresp_emis_diff':corresp_emis_diff[imo, ii], |
---|
177 | 'hist_vals_rate':hist_vals_ratio[imo, ii], |
---|
178 | 'corresp_emis_rate':corresp_emis_ratio[imo, ii], |
---|
179 | })) |
---|
180 | ''' |
---|
181 | ######################## |
---|
182 | # stack in netcdf file # |
---|
183 | ######################## |
---|
184 | print 'stack in file month ' + str(month[imo]) |
---|
185 | rootgrp = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSUB_ice_class/sub_classification/cartesian_grid_map_sea_ice_extent_with-AMSUA23-and-89_' + month[imo] + '2009_AMSUB' + str(frequ) + '_spec_thresholds.nc', 'w', format='NETCDF3_CLASSIC') |
---|
186 | rootgrp.createDimension('longitude', nx) |
---|
187 | rootgrp.createDimension('latitude', ny) |
---|
188 | rootgrp.createDimension('days', month_day[imo]) |
---|
189 | nc_lon = rootgrp.createVariable('longitude', 'f', ('longitude',)) |
---|
190 | nc_lat = rootgrp.createVariable('latitude', 'f', ('latitude',)) |
---|
191 | nc_days = rootgrp.createVariable('days', 'f', ('days',)) |
---|
192 | nc_ice_spec = rootgrp.createVariable('spec_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
193 | nc_ice_lamb = rootgrp.createVariable('lamb_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
194 | nc_ice_diff = rootgrp.createVariable('diff_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
195 | nc_ice_ratio = rootgrp.createVariable('ratio_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
196 | nc_lon[:] = xvec |
---|
197 | nc_lat[:] = yvec |
---|
198 | nc_days[:] = np.arange(0, month_day[imo]) |
---|
199 | nc_ice_spec[:] = daily_spec_ice[imo, :, :, 0 : month_day[imo]] |
---|
200 | nc_ice_lamb[:] = daily_lamb_ice[imo, :, :, 0 : month_day[imo]] |
---|
201 | nc_ice_diff[:] = daily_diff_ice[imo, :, :, 0 : month_day[imo]] |
---|
202 | nc_ice_ratio[:] = daily_ratio_ice[imo, :, :, 0 : month_day[imo]] |
---|
203 | rootgrp.close() |
---|
204 | |
---|
205 | |
---|
206 | |
---|
207 | |
---|
208 | months2 = np.array([4, 5, 6, 7])# use AMSUA 89GHz to delimit ice/no_ice for MAY, JUNE, JULY, AUGUST |
---|
209 | for imo in months2: |
---|
210 | print 'month ' + month[imo] |
---|
211 | ################################################################################## |
---|
212 | # choice of AMSUA 23GHz delimitation ice/no_ice for the sub_classification study # |
---|
213 | ################################################################################## |
---|
214 | print 'open threshold file' |
---|
215 | fichier_emis = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSUA_ice_class/cartesian_grid_map_ice_no-ice_' + str(month[imo]) + '2009_AMSUA89_spec_lamb_thresholds.nc', 'r', format='NETCDF3_CLASSIC') |
---|
216 | spec_lim = fichier_emis.variables['spec_ice_area'][:] |
---|
217 | #lamb_lim = fichier_emis.variables['lamb_ice_area'][:] |
---|
218 | fichier_emis.close() |
---|
219 | ######################################################### |
---|
220 | # application of AMSUA 23GHz delimitation to other data # |
---|
221 | ######################################################### |
---|
222 | print 'open emissivity to sub_classify file' |
---|
223 | ## data of emis SPEC, LAMB, DIFF(SPEC-LAMB) |
---|
224 | fichier_e = 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') |
---|
225 | day = fichier_e.variables['days'][:] |
---|
226 | emis_spec[imo, :, :, 0 : month_day[imo]] = fichier_e.variables['e_spec'][:] |
---|
227 | emis_lamb[imo, :, :, 0 : month_day[imo]] = fichier_e.variables['e_lamb'][:] |
---|
228 | emis_diff[imo, :, :, 0 : month_day[imo]] = fichier_e.variables['e_spec_lamb'][:] |
---|
229 | fichier_e.close() |
---|
230 | # calculate emis ratio daily |
---|
231 | for ijr in range (0, month_day[imo]): |
---|
232 | for ilon in range (0, nx): |
---|
233 | for ilat in range (0, ny): |
---|
234 | emis_ratio[imo, ilat, ilon, ijr] = ((emis_lamb[imo, ilat, ilon, ijr] - emis_spec[imo, ilat, ilon, ijr]) / emis_spec[imo, ilat, ilon, ijr]) * 100. |
---|
235 | if (isnan(spec_lim[ilat, ilon]) == True): |
---|
236 | daily_spec_ice[imo, ilat, ilon, ijr] = NaN |
---|
237 | daily_lamb_ice[imo, ilat, ilon, ijr] = NaN |
---|
238 | daily_diff_ice[imo, ilat, ilon, ijr] = NaN |
---|
239 | daily_ratio_ice[imo, ilat, ilon, ijr] = NaN |
---|
240 | else: |
---|
241 | daily_spec_ice[imo, ilat, ilon, ijr] = emis_spec[imo, ilat, ilon, ijr] |
---|
242 | daily_lamb_ice[imo, ilat, ilon, ijr] = emis_lamb[imo, ilat, ilon, ijr] |
---|
243 | daily_diff_ice[imo, ilat, ilon, ijr] = emis_diff[imo, ilat, ilon, ijr] |
---|
244 | daily_ratio_ice[imo, ilat, ilon, ijr] = emis_ratio[imo, ilat, ilon, ijr] |
---|
245 | ''' |
---|
246 | # ATTENTION : previous part of script has been modified ==> cannot be applied directly to this following part of script (modification of arrays and names.... |
---|
247 | print 'compute SPEC distribution' |
---|
248 | ######## |
---|
249 | # SPEC # |
---|
250 | ######## |
---|
251 | cs = reshape(spec_ice[imo, :, :], size(spec_ice[imo, :, :]))[nonzero(isnan(reshape(spec_ice[imo, :, :], size(spec_ice[imo, :, :]))) == False)] |
---|
252 | spec_vec[imo, 0 : len(cs)] = cs |
---|
253 | hist_vals_spec[imo, :] = hist(spec_vec[imo, 0 : len(cs)], bins = bin, normed = True, histtype='step')[0] |
---|
254 | for ibin in range (0, bin): |
---|
255 | corresp_emis_spec[imo, ibin] = mean(hist(spec_vec[imo, 0 : len(cs)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
256 | print 'compute LAMB distribution' |
---|
257 | ######## |
---|
258 | # LAMB # |
---|
259 | ######## |
---|
260 | cl = reshape(lamb_ice[imo, :, :], size(lamb_ice[imo, :, :]))[nonzero(isnan(reshape(lamb_ice[imo, :, :], size(lamb_ice[imo, :, :]))) == False)] |
---|
261 | lamb_vec[imo, 0 : len(cl)] = cl |
---|
262 | hist_vals_lamb[imo, :] = hist(lamb_vec[imo, 0 : len(cl)], bins = bin, normed = True, histtype='step')[0] |
---|
263 | for ibin in range (0, bin): |
---|
264 | corresp_emis_lamb[imo, ibin] = mean(hist(lamb_vec[imo, 0 : len(cl)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
265 | print 'compute DIFF distribution' |
---|
266 | ######## |
---|
267 | # DIFF # |
---|
268 | ######## |
---|
269 | cd = reshape(diff_ice[imo, :, :], size(diff_ice[imo, :, :]))[nonzero(isnan(reshape(diff_ice[imo, :, :], size(diff_ice[imo, :, :]))) == False)] |
---|
270 | diff_vec[imo, 0 : len(cd)] = cd |
---|
271 | hist_vals_diff[imo, :] = hist(diff_vec[imo, 0 : len(cd)], bins = bin, normed = True, histtype='step')[0] |
---|
272 | for ibin in range (0, bin): |
---|
273 | corresp_emis_diff[imo, ibin] = mean(hist(diff_vec[imo, 0 : len(cd)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
274 | print 'compute RATIO distribution' |
---|
275 | ######### |
---|
276 | # RATIO # |
---|
277 | ######### |
---|
278 | cr = reshape(ratio_ice[imo, :, :], size(ratio_ice[imo, :, :]))[nonzero(isnan(reshape(ratio_ice[imo, :, :], size(ratio_ice[imo, :, :]))) == False)] |
---|
279 | ratio_vec[imo, 0 : len(cr)] = cr |
---|
280 | hist_vals_ratio[imo, :] = hist(ratio_vec[imo, 0 : len(cr)], bins = bin, normed = True, histtype='step')[0] |
---|
281 | for ibin in range (0, bin): |
---|
282 | corresp_emis_ratio[imo, ibin] = mean(hist(ratio_vec[imo, 0 : len(cr)], bins = bin, normed = True, histtype='step')[1][ibin : ibin + 2]) |
---|
283 | ###################### |
---|
284 | # stack in .dat file # |
---|
285 | ###################### |
---|
286 | print 'start stacking in .dat file' |
---|
287 | #data_classif = open ('/net/argos/data/parvati/lahlod/ARCTIC/AMSUB_ice_class/sub_classification/AMSUB'+str(frequ)+'_data_classification_parameters_ice_no-ice_with_AMSUA23-spec_2009.dat', 'a') |
---|
288 | for ii in range (0, bin): |
---|
289 | 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_diff)10.5f %(corresp_emis_diff)10.5f %(hist_vals_rate)10.5f %(corresp_emis_rate)10.5f \n' % { |
---|
290 | 'months':month[imo], |
---|
291 | 'hist_vals_spec':hist_vals_spec[imo, ii], |
---|
292 | 'corresp_emis_spec':corresp_emis_spec[imo, ii], |
---|
293 | 'hist_vals_lamb':hist_vals_lamb[imo, ii], |
---|
294 | 'corresp_emis_lamb':corresp_emis_lamb[imo, ii], |
---|
295 | 'hist_vals_diff':hist_vals_diff[imo, ii], |
---|
296 | 'corresp_emis_diff':corresp_emis_diff[imo, ii], |
---|
297 | 'hist_vals_rate':hist_vals_ratio[imo, ii], |
---|
298 | 'corresp_emis_rate':corresp_emis_ratio[imo, ii], |
---|
299 | })) |
---|
300 | ''' |
---|
301 | ######################## |
---|
302 | # stack in netcdf file # |
---|
303 | ######################## |
---|
304 | print 'stack in file month ' + str(month[imo]) |
---|
305 | rootgrp = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSUB_ice_class/sub_classification/cartesian_grid_map_sea_ice_extent_with-AMSUA23-and-89_' + month[imo] + '2009_AMSUB' + str(frequ) + '_spec_thresholds.nc', 'w', format='NETCDF3_CLASSIC') |
---|
306 | rootgrp.createDimension('longitude', nx) |
---|
307 | rootgrp.createDimension('latitude', ny) |
---|
308 | rootgrp.createDimension('days', month_day[imo]) |
---|
309 | nc_lon = rootgrp.createVariable('longitude', 'f', ('longitude',)) |
---|
310 | nc_lat = rootgrp.createVariable('latitude', 'f', ('latitude',)) |
---|
311 | nc_days = rootgrp.createVariable('days', 'f', ('days',)) |
---|
312 | nc_ice_spec = rootgrp.createVariable('spec_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
313 | nc_ice_lamb = rootgrp.createVariable('lamb_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
314 | nc_ice_diff = rootgrp.createVariable('diff_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
315 | nc_ice_ratio = rootgrp.createVariable('ratio_ice_area', 'f', ('latitude', 'longitude', 'days')) |
---|
316 | nc_lon[:] = xvec |
---|
317 | nc_lat[:] = yvec |
---|
318 | nc_days[:] = np.arange(0, month_day[imo]) |
---|
319 | nc_ice_spec[:] = daily_spec_ice[imo, :, :, 0 : month_day[imo]] |
---|
320 | nc_ice_lamb[:] = daily_lamb_ice[imo, :, :, 0 : month_day[imo]] |
---|
321 | nc_ice_diff[:] = daily_diff_ice[imo, :, :, 0 : month_day[imo]] |
---|
322 | nc_ice_ratio[:] = daily_ratio_ice[imo, :, :, 0 : month_day[imo]] |
---|
323 | rootgrp.close() |
---|
324 | |
---|
325 | ''' |
---|
326 | data_classif.close() |
---|
327 | ''' |
---|
328 | |
---|
329 | |
---|
330 | ''' |
---|
331 | fichier = Dataset('/net/argos/data/parvati/lahlod/ARCTIC/AMSUA_ice_class/sub_classification/cartesian_grid_map_sea_ice_extent_with-AMSUA23-and-89_' + month[imo] + '2009_AMSUA' + str(frequ) + '_spec_thresholds.nc', 'r', format='NETCDF3_CLASSIC') |
---|
332 | ice_spec = fichier.variables['spec_ice_area'][:] |
---|
333 | ice_lamb = fichier.variables['lamb_ice_area'][:] |
---|
334 | ice_ratio = fichier.variables['ratio_ice_area'][:] |
---|
335 | fichier.close() |
---|
336 | mean_ratio = np.zeros([ny, nx], float) |
---|
337 | for ilon in range (0, nx): |
---|
338 | for ilat in range (0, ny): |
---|
339 | mean_ratio[ilat, ilon] = mean(ice_ratio[ilat, ilon, 0 : month_day[imo]][nonzero(isnan(ice_ratio[ilat, ilon, 0 : month_day[imo]]) == False)]) |
---|
340 | |
---|
341 | |
---|
342 | ion() |
---|
343 | x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() |
---|
344 | x_coast = x_ind |
---|
345 | y_coast = y_ind |
---|
346 | z_coast = z_ind |
---|
347 | map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, mean_ratio[:, :], -3., 5., 0.1, cm.s3pcpn_l_r, 'test') |
---|
348 | |
---|
349 | |
---|
350 | |
---|
351 | |
---|
352 | # test: |
---|
353 | ion() |
---|
354 | x_ind, y_ind, z_ind, volume = arctic_map.arctic_map_lat50() |
---|
355 | x_coast = x_ind |
---|
356 | y_coast = y_ind |
---|
357 | z_coast = z_ind |
---|
358 | for imo in range (0, M): |
---|
359 | map_cartesian_grid.draw_map_cartes_l(x_coast, y_coast, z_coast, volume, xvec, yvec, ratio_ice[imo, :, :], 0., 4., 0.01, cm.s3pcpn_l_r, 'Sea ice extent - emissivity RATIO') |
---|
360 | title('AMSUA ' + str(frequ) + ' - ' + str(month[imo]) + ' 2009') |
---|
361 | plt.savefig('/usr/home/lahlod/twice_d/fig_output_ARCTIC/fig_output_sea_ice_study/ice_class_AMSUA/sub_classification/maps_sea_ice_extent/emiss_ratio_map_AMSUA'+str(frequ)+'_with_AMSUA23-and-30-spec_'+str(month[imo])+'_2009.png') |
---|
362 | ''' |
---|
363 | |
---|
364 | |
---|