source: trunk/src/scripts_Laura/diff_polarsHV_SSMIS_test.py @ 23

Last change on this file since 23 was 23, checked in by lahlod, 10 years ago

modifs

File size: 21.3 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3import string
4import numpy as np
5import matplotlib.pyplot as plt
6from pylab import *
7from mpl_toolkits.basemap import Basemap
8from mpl_toolkits.basemap import shiftgrid, cm
9from netCDF4 import Dataset
10import ffgrid2
11
12
13len_month = np.array([28, 30, 31])
14month = np.array(['FEBRUARY', 'APRIL', 'JULY'])
15################
16# CARTOGRAPHIE #
17################
18## Etude sur l'Antarctique ##
19dx = 5.
20dy = 5.
21x0, x1 = -180, 180
22y0, y1 = -90, -30
23
24
25## FEBRUARY ##
26imo = 0
27## ch12 ##
28bbemis_ch12_FEB = nonzero((emis12_FEB != -500.) & (emis12_FEB <= 1.))
29OUTZCH12_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
30outzch12_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
31lonch12_FEB = np.zeros([len(np.arange(x0, x1+1, dx))], float)
32latch12_FEB = np.zeros([len(np.arange(y0, y1+1, dy))], float)
33## ch13 ##
34bbemis_ch13_FEB = nonzero((emis13_FEB != -500.) & (emis13_FEB <= 1.))
35OUTZCH13_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
36outzch13_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
37lonch13_FEB = np.zeros([len(np.arange(x0, x1+1, dx))], float)
38latch13_FEB = np.zeros([len(np.arange(y0, y1+1, dy))], float)
39## ch17 ##
40bbemis_ch17_FEB = nonzero((emis17_FEB != -500.) & (emis17_FEB <= 1.))
41OUTZCH17_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
42outzch17_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
43lonch17_FEB = np.zeros([len(np.arange(x0, x1+1, dx))], float)
44latch17_FEB = np.zeros([len(np.arange(y0, y1+1, dy))], float)
45## ch18 ##
46bbemis_ch18_FEB = nonzero((emis18_FEB != -500.) & (emis18_FEB <= 1.))
47OUTZCH18_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
48outzch18_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
49lonch18_FEB = np.zeros([len(np.arange(x0, x1+1, dx))], float)
50latch18_FEB = np.zeros([len(np.arange(y0, y1+1, dy))], float)
51for ijr in range (0, len_month[imo]):
52    print 'jour=', ijr+1
53    ## ch17 ##
54    ind_jr17_FEB = np.where(jjr17_FEB[bbemis_ch17_FEB] == ijr+1)[0]
55    xx = lon17_FEB[bbemis_ch17_FEB][ind_jr17_FEB]
56    yy = lat17_FEB[bbemis_ch17_FEB][ind_jr17_FEB]
57    zz = emis17_FEB[bbemis_ch17_FEB][ind_jr17_FEB]
58    zz0 = min(zz)
59    zz1 = max(zz)
60    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
61    outzch17_FEB = outz
62    lonch17_FEB = outx
63    latch17_FEB = outy
64    OUTZCH17_FEB[:,:,ijr] = outzch17_FEB[:,:]
65    ## ch18 ##
66    ind_jr18_FEB = np.where(jjr18_FEB[bbemis_ch18_FEB] == ijr+1)[0]
67    xx = lon18_FEB[bbemis_ch18_FEB][ind_jr18_FEB]
68    yy = lat18_FEB[bbemis_ch18_FEB][ind_jr18_FEB]
69    zz = emis18_FEB[bbemis_ch18_FEB][ind_jr18_FEB]
70    zz0 = min(zz)
71    zz1 = max(zz)
72    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
73    outzch18_FEB = outz
74    lonch18_FEB = outx
75    latch18_FEB = outy
76    OUTZCH18_FEB[:,:,ijr] = outzch18_FEB[:,:]
77    ## ch12 ##
78    ind_jr12_FEB = np.where(jjr12_FEB[bbemis_ch12_FEB] == ijr+1)[0]
79    xx = lon12_FEB[bbemis_ch12_FEB][ind_jr12_FEB]
80    yy = lat12_FEB[bbemis_ch12_FEB][ind_jr12_FEB]
81    zz = emis12_FEB[bbemis_ch12_FEB][ind_jr12_FEB]
82    zz0 = min(zz)
83    zz1 = max(zz)
84    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
85    outzch12_FEB = outz
86    lonch12_FEB = outx
87    latch12_FEB = outy
88    OUTZCH12_FEB[:,:,ijr] = outzch12_FEB[:,:]
89    ## ch13 ##
90    ind_jr13_FEB = np.where(jjr13_FEB[bbemis_ch13_FEB] == ijr+1)[0]
91    xx = lon13_FEB[bbemis_ch13_FEB][ind_jr13_FEB]
92    yy = lat13_FEB[bbemis_ch13_FEB][ind_jr13_FEB]
93    zz = emis13_FEB[bbemis_ch13_FEB][ind_jr13_FEB]
94    zz0 = min(zz)
95    zz1 = max(zz)
96    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
97    outzch13_FEB = outz
98    lonch13_FEB = outx
99    latch13_FEB = outy
100    OUTZCH13_FEB[:,:,ijr] = outzch13_FEB[:,:]
101
102## APRIL ##
103imo = 1
104## ch12 ##
105bbemis_ch12_APR = nonzero((emis12_APR != -500.) & (emis12_APR <= 1.))
106OUTZCH12_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
107outzch12_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
108lonch12_APR = np.zeros([len(np.arange(x0, x1+1, dx))], float)
109latch12_APR = np.zeros([len(np.arange(y0, y1+1, dy))], float)
110## ch13 ##
111bbemis_ch13_APR = nonzero((emis13_APR != -500.) & (emis13_APR <= 1.))
112OUTZCH13_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
113outzch13_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
114lonch13_APR = np.zeros([len(np.arange(x0, x1+1, dx))], float)
115latch13_APR = np.zeros([len(np.arange(y0, y1+1, dy))], float)
116## ch17 ##
117bbemis_ch17_APR = nonzero((emis17_APR != -500.) & (emis17_APR <= 1.))
118OUTZCH17_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
119outzch17_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
120lonch17_APR = np.zeros([len(np.arange(x0, x1+1, dx))], float)
121latch17_APR = np.zeros([len(np.arange(y0, y1+1, dy))], float)
122## ch18 ##
123bbemis_ch18_APR = nonzero((emis18_APR != -500.) & (emis18_APR <= 1.))
124OUTZCH18_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
125outzch18_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
126lonch18_APR = np.zeros([len(np.arange(x0, x1+1, dx))], float)
127latch18_APR = np.zeros([len(np.arange(y0, y1+1, dy))], float)
128for ijr in range (0, len_month[imo]):
129    print 'jour=', ijr+1
130    ## ch17 ##
131    ind_jr17_APR = np.where(jjr17_APR[bbemis_ch17_APR] == ijr+1)[0]
132    xx = lon17_APR[bbemis_ch17_APR][ind_jr17_APR]
133    yy = lat17_APR[bbemis_ch17_APR][ind_jr17_APR]
134    zz = emis17_APR[bbemis_ch17_APR][ind_jr17_APR]
135    zz0 = min(zz)
136    zz1 = max(zz)
137    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
138    outzch17_APR = outz
139    lonch17_APR = outx
140    latch17_APR = outy
141    OUTZCH17_APR[:,:,ijr] = outzch17_APR[:,:]
142    ## ch18 ##
143    ind_jr18_APR = np.where(jjr18_APR[bbemis_ch18_APR] == ijr+1)[0]
144    xx = lon18_APR[bbemis_ch18_APR][ind_jr18_APR]
145    yy = lat18_APR[bbemis_ch18_APR][ind_jr18_APR]
146    zz = emis18_APR[bbemis_ch18_APR][ind_jr18_APR]
147    zz0 = min(zz)
148    zz1 = max(zz)
149    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
150    outzch18_APR = outz
151    lonch18_APR = outx
152    latch18_APR = outy
153    OUTZCH18_APR[:,:,ijr] = outzch18_APR[:,:]
154    ## ch12 ##
155    ind_jr12_APR = np.where(jjr12_APR[bbemis_ch12_APR] == ijr+1)[0]
156    xx = lon12_APR[bbemis_ch12_APR][ind_jr12_APR]
157    yy = lat12_APR[bbemis_ch12_APR][ind_jr12_APR]
158    zz = emis12_APR[bbemis_ch12_APR][ind_jr12_APR]
159    zz0 = min(zz)
160    zz1 = max(zz)
161    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
162    outzch12_APR = outz
163    lonch12_APR = outx
164    latch12_APR = outy
165    OUTZCH12_APR[:,:,ijr] = outzch12_APR[:,:]
166    ## ch13 ##
167    ind_jr13_APR = np.where(jjr13_APR[bbemis_ch13_APR] == ijr+1)[0]
168    xx = lon13_APR[bbemis_ch13_APR][ind_jr13_APR]
169    yy = lat13_APR[bbemis_ch13_APR][ind_jr13_APR]
170    zz = emis13_APR[bbemis_ch13_APR][ind_jr13_APR]
171    zz0 = min(zz)
172    zz1 = max(zz)
173    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
174    outzch13_APR = outz
175    lonch13_APR = outx
176    latch13_APR = outy
177    OUTZCH13_APR[:,:,ijr] = outzch13_APR[:,:]
178
179
180
181
182## JULY ##
183imo = 2
184## ch12 ##
185bbemis_ch12_JUL = nonzero((emis12_JUL != -500.) & (emis12_JUL <= 1.))
186OUTZCH12_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
187outzch12_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
188lonch12_JUL = np.zeros([len(np.arange(x0, x1+1, dx))], float)
189latch12_JUL = np.zeros([len(np.arange(y0, y1+1, dy))], float)
190## ch13 ##
191bbemis_ch13_JUL = nonzero((emis13_JUL != -500.) & (emis13_JUL <= 1.))
192OUTZCH13_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
193outzch13_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
194lonch13_JUL = np.zeros([len(np.arange(x0, x1+1, dx))], float)
195latch13_JUL = np.zeros([len(np.arange(y0, y1+1, dy))], float)
196## ch17 ##
197bbemis_ch17_JUL = nonzero((emis17_JUL != -500.) & (emis17_JUL <= 1.))
198OUTZCH17_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
199outzch17_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
200lonch17_JUL = np.zeros([len(np.arange(x0, x1+1, dx))], float)
201latch17_JUL = np.zeros([len(np.arange(y0, y1+1, dy))], float)
202## ch18 ##
203bbemis_ch18_JUL = nonzero((emis18_JUL != -500.) & (emis18_JUL <= 1.))
204OUTZCH18_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
205outzch18_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
206lonch18_JUL = np.zeros([len(np.arange(x0, x1+1, dx))], float)
207latch18_JUL = np.zeros([len(np.arange(y0, y1+1, dy))], float)
208for ijr in range (0, len_month[imo]):
209    print 'jour=', ijr+1
210    ## ch17 ##
211    ind_jr17_JUL = np.where(jjr17_JUL[bbemis_ch17_JUL] == ijr+1)[0]
212    xx = lon17_JUL[bbemis_ch17_JUL][ind_jr17_JUL]
213    yy = lat17_JUL[bbemis_ch17_JUL][ind_jr17_JUL]
214    zz = emis17_JUL[bbemis_ch17_JUL][ind_jr17_JUL]
215    zz0 = min(zz)
216    zz1 = max(zz)
217    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
218    outzch17_JUL = outz
219    lonch17_JUL = outx
220    latch17_JUL = outy
221    OUTZCH17_JUL[:,:,ijr] = outzch17_JUL[:,:]
222    ## ch18 ##
223    ind_jr18_JUL = np.where(jjr18_JUL[bbemis_ch18_JUL] == ijr+1)[0]
224    xx = lon18_JUL[bbemis_ch18_JUL][ind_jr18_JUL]
225    yy = lat18_JUL[bbemis_ch18_JUL][ind_jr18_JUL]
226    zz = emis18_JUL[bbemis_ch18_JUL][ind_jr18_JUL]
227    zz0 = min(zz)
228    zz1 = max(zz)
229    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
230    outzch18_JUL = outz
231    lonch18_JUL = outx
232    latch18_JUL = outy
233    OUTZCH18_JUL[:,:,ijr] = outzch18_JUL[:,:]
234    ## ch12 ##
235    ind_jr12_JUL = np.where(jjr12_JUL[bbemis_ch12_JUL] == ijr+1)[0]
236    xx = lon12_JUL[bbemis_ch12_JUL][ind_jr12_JUL]
237    yy = lat12_JUL[bbemis_ch12_JUL][ind_jr12_JUL]
238    zz = emis12_JUL[bbemis_ch12_JUL][ind_jr12_JUL]
239    zz0 = min(zz)
240    zz1 = max(zz)
241    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
242    outzch12_JUL = outz
243    lonch12_JUL = outx
244    latch12_JUL = outy
245    OUTZCH12_JUL[:,:,ijr] = outzch12_JUL[:,:]
246    ## ch13 ##
247    ind_jr13_JUL = np.where(jjr13_JUL[bbemis_ch13_JUL] == ijr+1)[0]
248    xx = lon13_JUL[bbemis_ch13_JUL][ind_jr13_JUL]
249    yy = lat13_JUL[bbemis_ch13_JUL][ind_jr13_JUL]
250    zz = emis13_JUL[bbemis_ch13_JUL][ind_jr13_JUL]
251    zz0 = min(zz)
252    zz1 = max(zz)
253    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
254    outzch13_JUL = outz
255    lonch13_JUL = outx
256    latch13_JUL = outy
257    OUTZCH13_JUL[:,:,ijr] = outzch13_JUL[:,:]
258
259
260################################################
261## calcul de la climatologie moyenne par mois ##
262################################################
263
264lon = lonch12_FEB = lonch12_APR = lonch12_JUL = lonch13_FEB = lonch13_APR = lonch13_JUL
265lat = latch12_FEB = latch12_APR = latch12_JUL = latch13_FEB = latch13_APR = latch13_JUL
266#lon = lonch17_FEB = lonch17_APR = lonch17_JUL = lonch18_FEB = lonch18_APR = lonch18_JUL
267#lat = latch17_FEB = latch17_APR = latch17_JUL = latch18_FEB = latch18_APR = latch18_JUL
268
269## FEBRUARY ##
270## ch12 ##
271mean_outzch12_FEB = np.zeros([len(lat), len(lon)], float)
272for ilon in range (0, len(lon)):
273    for ilat in range (0, len(lat)):
274        mean_outzch12_FEB[ilat, ilon] = mean(OUTZCH12_FEB[ilat, ilon, :])
275
276## ch13 ##
277mean_outzch13_FEB = np.zeros([len(lat), len(lon)], float)
278for ilon in range (0, len(lon)):
279    for ilat in range (0, len(lat)):
280        mean_outzch13_FEB[ilat, ilon] = mean(OUTZCH13_FEB[ilat, ilon, :])
281
282## ch17 ##
283mean_outzch17_FEB = np.zeros([len(lat), len(lon)], float)
284for ilon in range (0, len(lon)):
285    for ilat in range (0, len(lat)):
286        mean_outzch17_FEB[ilat, ilon] = mean(OUTZCH17_FEB[ilat, ilon, :])
287
288## ch18 ##
289mean_outzch18_FEB = np.zeros([len(lat), len(lon)], float)
290for ilon in range (0, len(lon)):
291    for ilat in range (0, len(lat)):
292        mean_outzch18_FEB[ilat, ilon] = mean(OUTZCH18_FEB[ilat, ilon, :])
293
294
295## APRIL ##
296## ch12 ##
297mean_outzch12_APR = np.zeros([len(lat), len(lon)], float)
298for ilon in range (0, len(lon)):
299    for ilat in range (0, len(lat)):
300        mean_outzch12_APR[ilat, ilon] = mean(OUTZCH12_APR[ilat, ilon, :][nonzero(isnan(OUTZCH12_APR[ilat, ilon, :]) == False)])
301
302## ch13 ##
303mean_outzch13_APR = np.zeros([len(lat), len(lon)], float)
304for ilon in range (0, len(lon)):
305    for ilat in range (0, len(lat)):
306        mean_outzch13_APR[ilat, ilon] = mean(OUTZCH13_APR[ilat, ilon, :][nonzero(isnan(OUTZCH13_APR[ilat, ilon, :]) == False)])
307
308## ch17 ##
309mean_outzch17_APR = np.zeros([len(lat), len(lon)], float)
310for ilon in range (0, len(lon)):
311    for ilat in range (0, len(lat)):
312        mean_outzch17_APR[ilat, ilon] = mean(OUTZCH17_APR[ilat, ilon, :][nonzero(isnan(OUTZCH17_APR[ilat, ilon, :]) == False)])
313
314## ch18 ##
315mean_outzch18_APR = np.zeros([len(lat), len(lon)], float)
316for ilon in range (0, len(lon)):
317    for ilat in range (0, len(lat)):
318        mean_outzch18_APR[ilat, ilon] = mean(OUTZCH18_APR[ilat, ilon, :][nonzero(isnan(OUTZCH18_APR[ilat, ilon, :]) == False)])
319
320
321
322## JULY ##
323## ch12 ##
324mean_outzch12_JUL = np.zeros([len(lat), len(lon)], float)
325for ilon in range (0, len(lon)):
326    for ilat in range (0, len(lat)):
327        mean_outzch12_JUL[ilat, ilon] = mean(OUTZCH12_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH12_JUL[ilat, ilon, :]) == False)])
328
329## ch13 ##
330mean_outzch13_JUL = np.zeros([len(lat), len(lon)], float)
331for ilon in range (0, len(lon)):
332    for ilat in range (0, len(lat)):
333        mean_outzch13_JUL[ilat, ilon] = mean(OUTZCH13_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH13_JUL[ilat, ilon, :]) == False)])
334
335## ch17 ##
336mean_outzch17_JUL = np.zeros([len(lat), len(lon)], float)
337for ilon in range (0, len(lon)):
338    for ilat in range (0, len(lat)):
339        mean_outzch17_JUL[ilat, ilon] = mean(OUTZCH17_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH17_JUL[ilat, ilon, :]) == False)])
340
341## ch18 ##
342mean_outzch18_JUL = np.zeros([len(lat), len(lon)], float)
343for ilon in range (0, len(lon)):
344    for ilat in range (0, len(lat)):
345        mean_outzch18_JUL[ilat, ilon] = mean(OUTZCH18_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH18_JUL[ilat, ilon, :]) == False)])
346
347
348
349######################
350## calculs de stats ##
351######################
352
353### VARIANCE - COVARIANCE ##
354
355## FEBRUARY ##
356imo = 0
357## ch12 ##
358varF12 = np.zeros([len(lat), len(lon)], float)
359for ilon in range (0, len(lon)):
360    for ilat in range (0, len(lat)):
361        varF12[ilat, ilon] = np.sum((OUTZCH12_FEB[ilat, ilon, :] - mean_outzch12_FEB[ilat, ilon])**2)
362
363var_FEB_12 = varF12 / len_month[imo]
364
365## ch13 ##
366varF13 = np.zeros([len(lat), len(lon)], float)
367for ilon in range (0, len(lon)):
368    for ilat in range (0, len(lat)):
369        varF13[ilat, ilon] = np.sum((OUTZCH13_FEB[ilat, ilon, :] - mean_outzch13_FEB[ilat, ilon])**2)
370
371var_FEB_13 = varF13 / len_month[imo]
372
373## ch12-ch13 ##
374cov_FEB = np.zeros([len(lat), len(lon)], float)
375for ilon in range (0, len(lon)):
376    for ilat in range (0, len(lat)):
377        cov_FEB[ilat, ilon] = np.sum((OUTZCH12_FEB[ilat, ilon, :] - mean_outzch12_FEB[ilat, ilon])*(OUTZCH13_FEB[ilat, ilon, :] - mean_outzch13_FEB[ilat, ilon]))
378
379cov_FEB_1213 = cov_FEB / len_month[imo]
380
381## ch17 ##
382varF17 = np.zeros([len(lat), len(lon)], float)
383for ilon in range (0, len(lon)):
384    for ilat in range (0, len(lat)):
385        varF17[ilat, ilon] = np.sum((OUTZCH17_FEB[ilat, ilon, :] - mean_outzch17_FEB[ilat, ilon])**2)
386
387var_FEB_17 = varF17 / len_month[imo]
388
389## ch18 ##
390varF18 = np.zeros([len(lat), len(lon)], float)
391for ilon in range (0, len(lon)):
392    for ilat in range (0, len(lat)):
393        varF18[ilat, ilon] = np.sum((OUTZCH18_FEB[ilat, ilon, :] - mean_outzch18_FEB[ilat, ilon])**2)
394
395var_FEB_18 = varF18 / len_month[imo]
396
397## ch17-ch18 ##
398cov_FEB = np.zeros([len(lat), len(lon)], float)
399for ilon in range (0, len(lon)):
400    for ilat in range (0, len(lat)):
401        cov_FEB[ilat, ilon] = np.sum((OUTZCH17_FEB[ilat, ilon, :] - mean_outzch17_FEB[ilat, ilon])*(OUTZCH18_FEB[ilat, ilon, :] - mean_outzch18_FEB[ilat, ilon]))
402
403cov_FEB_1718 = cov_FEB / len_month[imo]
404
405## ch13-ch17 ##
406cov_FEB = np.zeros([len(lat), len(lon)], float)
407for ilon in range (0, len(lon)):
408    for ilat in range (0, len(lat)):
409        cov_FEB[ilat, ilon] = np.sum((OUTZCH13_FEB[ilat, ilon, :] - mean_outzch13_FEB[ilat, ilon])*(OUTZCH17_FEB[ilat, ilon, :] - mean_outzch17_FEB[ilat, ilon]))
410
411cov_FEB_1317 = cov_FEB / len_month[imo]
412
413## ch12-ch18 ##
414cov_FEB = np.zeros([len(lat), len(lon)], float)
415for ilon in range (0, len(lon)):
416    for ilat in range (0, len(lat)):
417        cov_FEB[ilat, ilon] = np.sum((OUTZCH12_FEB[ilat, ilon, :] - mean_outzch12_FEB[ilat, ilon])*(OUTZCH18_FEB[ilat, ilon, :] - mean_outzch18_FEB[ilat, ilon]))
418
419cov_FEB_1218 = cov_FEB / len_month[imo]
420
421
422## APRIL ##
423imo = 1
424## ch12 ##
425varA12 = np.zeros([len(lat), len(lon)], float)
426for ilon in range (0, len(lon)):
427    for ilat in range (0, len(lat)):
428        varA12[ilat, ilon] = np.sum((OUTZCH12_APR[ilat, ilon, :] - mean_outzch12_APR[ilat, ilon])**2)
429
430var_APR_12 = varA12 / len_month[imo]
431
432## ch13 ##
433varA13 = np.zeros([len(lat), len(lon)], float)
434for ilon in range (0, len(lon)):
435    for ilat in range (0, len(lat)):
436        varA13[ilat, ilon] = np.sum((OUTZCH13_APR[ilat, ilon, :] - mean_outzch13_APR[ilat, ilon])**2)
437
438var_APR_13 = varA13 / len_month[imo]
439
440## ch17 ##
441varA17 = np.zeros([len(lat), len(lon)], float)
442for ilon in range (0, len(lon)):
443    for ilat in range (0, len(lat)):
444        varA17[ilat, ilon] = np.sum((OUTZCH17_APR[ilat, ilon, :] - mean_outzch17_APR[ilat, ilon])**2)
445
446var_APR_17 = varA17 / len_month[imo]
447
448## ch18 ##
449varA18 = np.zeros([len(lat), len(lon)], float)
450for ilon in range (0, len(lon)):
451    for ilat in range (0, len(lat)):
452        varA18[ilat, ilon] = np.sum((OUTZCH18_APR[ilat, ilon, :] - mean_outzch18_APR[ilat, ilon])**2)
453
454var_APR_18 = varA18 / len_month[imo]
455
456## ch17-ch18 ##
457cov_APR = np.zeros([len(lat), len(lon)], float)
458for ilon in range (0, len(lon)):
459    for ilat in range (0, len(lat)):
460        cov_APR[ilat, ilon] = np.sum((OUTZCH17_APR[ilat, ilon, :] - mean_outzch17_APR[ilat, ilon])*(OUTZCH18_APR[ilat, ilon, :] - mean_outzch18_APR[ilat, ilon]))
461
462cov_APR_1718 = cov_APR / len_month[imo]
463
464## ch12-ch18 ##
465cov_APR = np.zeros([len(lat), len(lon)], float)
466for ilon in range (0, len(lon)):
467    for ilat in range (0, len(lat)):
468        cov_APR[ilat, ilon] = np.sum((OUTZCH12_APR[ilat, ilon, :] - mean_outzch12_APR[ilat, ilon])*(OUTZCH18_APR[ilat, ilon, :] - mean_outzch18_APR[ilat, ilon]))
469
470cov_APR_1218 = cov_APR / len_month[imo]
471
472
473
474## JULY ##
475imo = 2
476## ch17 ##
477varJ17 = np.zeros([len(lat), len(lon)], float)
478for ilon in range (0, len(lon)):
479    for ilat in range (0, len(lat)):
480        varJ17[ilat, ilon] = np.sum((OUTZCH17_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH17_JUL[ilat, ilon, :]) == False)] - mean_outzch17_JUL[ilat, ilon])**2)
481
482var_JUL_17 = varJ17 / len_month[imo]
483
484## ch18 ##
485varJ18 = np.zeros([len(lat), len(lon)], float)
486for ilon in range (0, len(lon)):
487    for ilat in range (0, len(lat)):
488        varJ18[ilat, ilon] = np.sum((OUTZCH18_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH18_JUL[ilat, ilon, :]) == False)] - mean_outzch18_JUL[ilat, ilon])**2)
489
490var_JUL_18 = varJ18 / len_month[imo]
491
492## ch17-ch18 ##
493cov_JUL = np.zeros([len(lat), len(lon)], float)
494for ilon in range (0, len(lon)):
495    for ilat in range (0, len(lat)):
496        cov_JUL[ilat, ilon] = np.sum((OUTZCH17_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH17_JUL[ilat, ilon, :]) == False)] - mean_outzch17_JUL[ilat, ilon]) * (OUTZCH18_JUL[ilat, ilon, :][nonzero(isnan(OUTZCH18_JUL[ilat, ilon, :]) == False)] - mean_outzch18_JUL[ilat, ilon]))
497
498cov_JUL_1718 = cov_JUL / len_month[imo]
499
500
501plt.ion()
502figure()
503m = Basemap(llcrnrlon=-180, urcrnrlon=180, llcrnrlat=-90, urcrnrlat=-30, projection='cyl', resolution='c', fix_aspect=True)
504m.drawcoastlines(linewidth = 1)
505m.drawparallels(np.arange(-90., -30., 20))
506m.drawmeridians(np.arange(-180., 180., 20))
507xii,yii = m(*np.meshgrid(lon, lat))
508clevs = arange(0., 0.0035, 0.00001)
509cs = m.contourf(xii, yii, cov_JUL_1718, clevs, cmap=cm.s3pcpn_l_r)
510cbar = colorbar(cs)
511cbar.set_label('covar(emis) JUL [CH17-CH18] - SSMIS')
512xticks(arange(-180, 200, 20), rotation = 45)
513yticks(arange(-90, -10, 20))
514
515
516## BIAIS ##
517
518## FEBRUARY ##
519biais_FEB_polar1 = mean_outzch12_FEB - mean_outzch13_FEB
520biais_FEB_polar2 = mean_outzch17_FEB - mean_outzch18_FEB
521biais_FEB_freq1 = mean_outzch12_FEB - mean_outzch18_FEB
522biais_FEB_freq2 = mean_outzch13_FEB - mean_outzch17_FEB
523
524## APRIL ##
525biais_APR_polar1 = mean_outzch12_APR - mean_outzch13_APR
526biais_APR_polar2 = mean_outzch17_APR - mean_outzch18_APR
527
528## JULY ##
529biais_JUL_polar1 = mean_outzch12_JUL - mean_outzch13_JUL
530biais_JUL_polar2 = mean_outzch17_JUL - mean_outzch18_JUL
531
532
533
534figure()
535m = Basemap(llcrnrlon=-180, urcrnrlon=180, llcrnrlat=-90, urcrnrlat=-30, projection='cyl', resolution='c', fix_aspect=True)
536m.drawcoastlines(linewidth = 1)
537m.drawparallels(np.arange(-90., -30., 20))
538m.drawmeridians(np.arange(-180., 180., 20))
539xii,yii = m(*np.meshgrid(lon, lat))
540clevs = arange(-0.24, 0.32, 0.001)
541cs = m.contourf(xii, yii, biais_FEB_freq2, clevs, cmap=cm.s3pcpn_l_r)
542cbar = colorbar(cs)
543cbar.set_label('biais(emis) FEB [CH13-CH17] - SSMIS')
544xticks(arange(-180, 200, 20), rotation = 45)
545yticks(arange(-90, -10, 20))
Note: See TracBrowser for help on using the repository browser.