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 netCDF4 import Dataset |
---|
8 | #import arctic_map # function to regrid coast limits |
---|
9 | #import cartesian_grid_test # function to convert grid from polar to cartesian |
---|
10 | from matplotlib.font_manager import FontProperties |
---|
11 | #import map_cartesian_grid |
---|
12 | import ice_class_delimit_AMSU_data |
---|
13 | |
---|
14 | |
---|
15 | |
---|
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 | ''' |
---|
159 | frequ = 30 |
---|
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) |
---|
161 | spec_30 = emis_spec_f |
---|
162 | lamb_30 = emis_lamb_f |
---|
163 | ratio_30 = emis_ratio_f |
---|
164 | diff_30 = emis_diff_f |
---|
165 | L_spec_30 = L_spec |
---|
166 | X_30 = X |
---|
167 | Y_30 = Y |
---|
168 | |
---|
169 | frequ = 50 |
---|
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) |
---|
171 | spec_50 = emis_spec_f |
---|
172 | lamb_50 = emis_lamb_f |
---|
173 | ratio_50 = emis_ratio_f |
---|
174 | diff_50 = emis_diff_f |
---|
175 | L_spec_50 = L_spec |
---|
176 | X_50 = X |
---|
177 | Y_50 = Y |
---|
178 | |
---|
179 | frequ = 89 |
---|
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) |
---|
181 | spec_89 = emis_spec_f |
---|
182 | lamb_89 = emis_lamb_f |
---|
183 | ratio_89 = emis_ratio_f |
---|
184 | diff_89 = emis_diff_f |
---|
185 | L_spec_89 = L_spec |
---|
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 | |
---|
198 | |
---|
199 | a1 = np.zeros([M], float) |
---|
200 | a2 = np.zeros([M], float) |
---|
201 | a3 = np.zeros([M], float) |
---|
202 | a4 = np.zeros([M], float) |
---|
203 | for imo in range (0, M): |
---|
204 | a1[imo] = corrcoef(spec_89[0 : 3243, imo], lamb_89[0 : 3243, imo])[0][1] |
---|
205 | a2[imo] = corrcoef(spec_89[0 : 3243, imo], ratio_89[0 : 3243, imo])[0][1] |
---|
206 | a3[imo] = corrcoef(spec_89[0 : 3243, imo], diff_89[0 : 3243, imo])[0][1] |
---|
207 | a4[imo] = corrcoef(spec_89[0 : 3243, imo], diff_89[0 : 3243, imo])[0][1] |
---|
208 | |
---|
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]])) |
---|
210 | |
---|
211 | figure() |
---|
212 | pc = pcolor(correl_matrix) |
---|
213 | colorbar(pc) |
---|
214 | ''' |
---|