source: trunk/src/python_script/draw_map_tr_amsuach2.py @ 6

Last change on this file since 6 was 6, checked in by gaclod, 12 years ago

add GC python scripts

  • Property svn:executable set to *
File size: 16.2 KB
Line 
1#mod gabi para graficar AMSUA CH2
2#!/usr/bin/env python
3# -*- coding: utf-8 -*-
4import string
5import numpy as np
6import matplotlib.pyplot as plt
7from pylab import *
8from mpl_toolkits.basemap import Basemap
9from mpl_toolkits.basemap import shiftgrid, cm
10
11#trans t
12
13
14zz1=trpgrid_t
15tt1='trans amusa ch2'
16t1='trans_amsua_ch2.png'
17
18# on recupere les coordonnes xy de la projection orth standard
19m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0,
20resolution = 'l')
21
22xii, yii = m1(*np.meshgrid(xvec,yvec))
23width = m1.urcrnrx - m1.llcrnrx
24height = m1.urcrnry - m1.llcrnry
25
26coef = 0.6
27width = width*coef
28height = height*coef
29
30# on fait une nouvelle projection en zoomant sur l'antarctique
31
32map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
33
34llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
35xii, yii = map(*np.meshgrid(xvec,yvec))
36#, clevs, cmap=my_cmap)
37clevs=arange(0,1,0.001)#star, stop, step
38cs=map.contourf(xii,yii,zz1, clevs, cmap=cm.s3pcpn_l_r)
39#cmap=cm.s3pcpn_l_r)
40#sstanom)
41#s3pcpn_l_r)
42cbar =colorbar(cs)
43plt.title(tt1)
44
45# draw coastlines, country boundaries, fill continents.
46map.drawcoastlines(linewidth=1)
47# draw the edge of the map projection region (the projection limb)
48map.drawmapboundary()
49# draw lat/lon grid lines every 30 degrees.
50map.drawmeridians(np.arange(0, 360, 10))
51map.drawparallels(np.arange(-90, 90, 10))
52#plt.show()
53
54plt.savefig(t1)
55close()
56
57#########################################################################
58####emis t 1pos 2pos 3pos
59zz21 = trpgrid_t
60zz22 = trpgrid_1n
61zz23 = trpgrid_2n
62zz24 = trpgrid_3n
63tt21='trans amsua ch2 t'
64tt22='trans amsua ch2 1n'
65tt23='trans amsua ch2 2n'
66tt24='trans amsua ch2 3n'
67t='trans_amsua_ch2_t123.png'
68
69figure(1)
70subplot(221)
71m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0,
72resolution = 'l')
73
74xii, yii = m1(*np.meshgrid(xvec,yvec))
75width = m1.urcrnrx - m1.llcrnrx
76height = m1.urcrnry - m1.llcrnry
77
78coef = 0.6
79width = width*coef
80height = height*coef
81
82# on fait une nouvelle projection en zoomant sur l'antarctique
83map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
84llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
85xii, yii = map(*np.meshgrid(xvec,yvec))
86clevs=arange(0.9,1,0.001)#star, stop, step
87cs=map.contourf(xii,yii,zz21, clevs, cmap=cm.s3pcpn_l_r)
88#cs=map.pcolormesh(xii,yii,zz2)
89#cmap=cm.s3pcpn_l_r)
90#sstanom)
91#s3pcpn_l_r)
92cbar =colorbar(cs)
93plt.title(tt21)
94# draw coastlines, country boundaries, fill continents.
95map.drawcoastlines(linewidth=1)
96# draw the edge of the map projection region (the projection limb)
97map.drawmapboundary()
98# draw lat/lon grid lines every 30 degrees.
99map.drawmeridians(np.arange(0, 360, 10))
100map.drawparallels(np.arange(-90, 90, 10))
101
102subplot(222)
103# on fait une nouvelle projection en zoomant sur l'antarctique
104map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
105llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
106xii, yii = map(*np.meshgrid(xvec,yvec))
107clevs=arange(0.9,1,0.001)#star, stop, step
108cs=map.contourf(xii,yii,zz22, clevs, cmap=cm.s3pcpn_l_r)
109#cs=map.pcolormesh(xii,yii,zz2)
110#cmap=cm.s3pcpn_l_r)
111#sstanom)
112#s3pcpn_l_r)
113cbar =colorbar(cs)
114plt.title(tt22)
115# draw coastlines, country boundaries, fill continents.
116map.drawcoastlines(linewidth=1)
117# draw the edge of the map projection region (the projection limb)
118map.drawmapboundary()
119# draw lat/lon grid lines every 30 degrees.
120map.drawmeridians(np.arange(0, 360, 10))
121map.drawparallels(np.arange(-90, 90, 10))
122
123
124subplot(223)
125# on fait une nouvelle projection en zoomant sur l'antarctique
126map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
127llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
128xii, yii = map(*np.meshgrid(xvec,yvec))
129clevs=arange(0.9,1,0.001)#star, stop, step
130cs=map.contourf(xii,yii,zz23, clevs, cmap=cm.s3pcpn_l_r)
131#cs=map.pcolormesh(xii,yii,zz2)
132#cmap=cm.s3pcpn_l_r)
133#sstanom)
134#s3pcpn_l_r)
135cbar =colorbar(cs)
136plt.title(tt23)
137# draw coastlines, country boundaries, fill continents.
138map.drawcoastlines(linewidth=1)
139# draw the edge of the map projection region (the projection limb)
140map.drawmapboundary()
141# draw lat/lon grid lines every 30 degrees.
142map.drawmeridians(np.arange(0, 360, 10))
143map.drawparallels(np.arange(-90, 90, 10))
144
145
146subplot(224)
147# on fait une nouvelle projection en zoomant sur l'antarctique
148map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
149llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
150xii, yii = map(*np.meshgrid(xvec,yvec))
151clevs=arange(0.9,1,0.001)#star, stop, step
152cs=map.contourf(xii,yii,zz24, clevs, cmap=cm.s3pcpn_l_r)
153#cs=map.pcolormesh(xii,yii,zz2)
154#cmap=cm.s3pcpn_l_r)
155#sstanom)
156#s3pcpn_l_r)
157cbar =colorbar(cs)
158plt.title(tt24)
159# draw coastlines, country boundaries, fill continents.
160map.drawcoastlines(linewidth=1)
161# draw the edge of the map projection region (the projection limb)
162map.drawmapboundary()
163# draw lat/lon grid lines every 30 degrees.
164map.drawmeridians(np.arange(0, 360, 10))
165map.drawparallels(np.arange(-90, 90, 10))
166#plt.show()
167
168plt.savefig(t)
169close()
170
171#########################################################################
172#### ecart type emis t 1pos 2pos 3pos
173zz21 = trsigma_grid_t
174zz22 = trsigma_grid_1n
175zz23 = trsigma_grid_2n
176zz24 = trsigma_grid_3n
177tt21='ecart type trans amsua ch2 t'
178tt22='ecart type trans amsua ch2 1n'
179tt23='ecart type trans amsua ch2 2n'
180tt24='ecart type trans amsua ch2 3n'
181t='ecart_type_trans_amsua_ch2_t123.png'
182
183figure(1)
184subplot(221)
185m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0,
186resolution = 'l')
187
188xii, yii = m1(*np.meshgrid(xvec,yvec))
189width = m1.urcrnrx - m1.llcrnrx
190height = m1.urcrnry - m1.llcrnry
191
192coef = 0.6
193width = width*coef
194height = height*coef
195
196# on fait une nouvelle projection en zoomant sur l'antarctique
197map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
198llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
199xii, yii = map(*np.meshgrid(xvec,yvec))
200clevs=arange(0,0.03,0.0001)#star, stop, step
201cs=map.contourf(xii,yii,zz21, clevs, cmap=cm.s3pcpn_l_r)
202#cs=map.pcolormesh(xii,yii,zz2)
203#cmap=cm.s3pcpn_l_r)
204#sstanom)
205#s3pcpn_l_r)
206cbar =colorbar(cs)
207plt.title(tt21)
208# draw coastlines, country boundaries, fill continents.
209map.drawcoastlines(linewidth=1)
210# draw the edge of the map projection region (the projection limb)
211map.drawmapboundary()
212# draw lat/lon grid lines every 30 degrees.
213map.drawmeridians(np.arange(0, 360, 10))
214map.drawparallels(np.arange(-90, 90, 10))
215
216subplot(222)
217# on fait une nouvelle projection en zoomant sur l'antarctique
218map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
219llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
220xii, yii = map(*np.meshgrid(xvec,yvec))
221clevs=arange(0,0.03,0.0001)#star, stop, step
222cs=map.contourf(xii,yii,zz22, clevs, cmap=cm.s3pcpn_l_r)
223#cs=map.pcolormesh(xii,yii,zz2)
224#cmap=cm.s3pcpn_l_r)
225#sstanom)
226#s3pcpn_l_r)
227cbar =colorbar(cs)
228plt.title(tt22)
229# draw coastlines, country boundaries, fill continents.
230map.drawcoastlines(linewidth=1)
231# draw the edge of the map projection region (the projection limb)
232map.drawmapboundary()
233# draw lat/lon grid lines every 30 degrees.
234map.drawmeridians(np.arange(0, 360, 10))
235map.drawparallels(np.arange(-90, 90, 10))
236
237
238subplot(223)
239# on fait une nouvelle projection en zoomant sur l'antarctique
240map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
241llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
242xii, yii = map(*np.meshgrid(xvec,yvec))
243clevs=arange(0,0.03,0.0001)#star, stop, step
244cs=map.contourf(xii,yii,zz23, clevs, cmap=cm.s3pcpn_l_r)
245#cs=map.pcolormesh(xii,yii,zz2)
246#cmap=cm.s3pcpn_l_r)
247#sstanom)
248#s3pcpn_l_r)
249cbar =colorbar(cs)
250plt.title(tt23)
251# draw coastlines, country boundaries, fill continents.
252map.drawcoastlines(linewidth=1)
253# draw the edge of the map projection region (the projection limb)
254map.drawmapboundary()
255# draw lat/lon grid lines every 30 degrees.
256map.drawmeridians(np.arange(0, 360, 10))
257map.drawparallels(np.arange(-90, 90, 10))
258
259
260subplot(224)
261# on fait une nouvelle projection en zoomant sur l'antarctique
262map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
263llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
264xii, yii = map(*np.meshgrid(xvec,yvec))
265clevs=arange(0,0.03,0.0001)#star, stop, step
266cs=map.contourf(xii,yii,zz24, clevs, cmap=cm.s3pcpn_l_r)
267#cs=map.pcolormesh(xii,yii,zz2)
268#cmap=cm.s3pcpn_l_r)
269#sstanom)
270#s3pcpn_l_r)
271cbar =colorbar(cs)
272plt.title(tt24)
273# draw coastlines, country boundaries, fill continents.
274map.drawcoastlines(linewidth=1)
275# draw the edge of the map projection region (the projection limb)
276map.drawmapboundary()
277# draw lat/lon grid lines every 30 degrees.
278map.drawmeridians(np.arange(0, 360, 10))
279map.drawparallels(np.arange(-90, 90, 10))
280#plt.show()
281
282plt.savefig(t)
283close()
284
285#########################################################################
286#### nom données emis t 1pos 2pos 3pos
287zz21 = trnngrid_t
288zz22 = trnngrid_1n
289zz23 = trnngrid_2n
290zz24 = trnngrid_3n
291tt21='nom donnees trans amsua ch2 t'
292tt22='nom donnees trans amsua ch2 1n'
293tt23='nom donnees trans amsua ch2 2n'
294tt24='nom donnees trans amsua ch2 3n'
295t='nom_donnees_trans_amsua_ch2_t123.png'
296
2970,0.1,0.0001figure(1)
298subplot(221)
299m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0,
300resolution = 'l')
301
302xii, yii = m1(*np.meshgrid(xvec,yvec))
303width = m1.urcrnrx - m1.llcrnrx
304height = m1.urcrnry - m1.llcrnry
305
306coef = 0.6
307width = width*coef
308height = height*coef
309
310# on fait une nouvelle projection en zoomant sur l'antarctique
311map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
312llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
313xii, yii = map(*np.meshgrid(xvec,yvec))
314clevs=arange(0,1000,10)#star, stop, step
315cs=map.contourf(xii,yii,zz21, clevs)
316#cs=map.pcolormesh(xii,yii,zz2)
317#cmap=cm.s3pcpn_l_r)
318#sstanom)
319#s3pcpn_l_r)
320cbar =colorbar(cs)
321plt.title(tt21)
322# draw coastlines, country boundaries, fill continents.
323map.drawcoastlines(linewidth=1)
324# draw the edge of the map projection region (the projection limb)
325map.drawmapboundary()
326# draw lat/lon grid lines every 30 degrees.
327map.drawmeridians(np.arange(0, 360, 10))
328map.drawparallels(np.arange(-90, 90, 10))
329
330subplot(222)
331# on fait une nouvelle projection en zoomant sur l'antarctique
332map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
333llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
334xii, yii = map(*np.meshgrid(xvec,yvec))
335clevs=arange(0,1000,10)#star, stop, step
336cs=map.contourf(xii,yii,zz22, clevs)
337#cs=map.pcolormesh(xii,yii,zz2)
338#cmap=cm.s3pcpn_l_r)
339#sstanom)
340#s3pcpn_l_r)
341cbar =colorbar(cs)
342plt.title(tt22)
343# draw coastlines, country boundaries, fill continents.
344map.drawcoastlines(linewidth=1)
345# draw the edge of the map projection region (the projection limb)
346map.drawmapboundary()
347# draw lat/lon grid lines every 30 degrees.
348map.drawmeridians(np.arange(0, 360, 10))
349map.drawparallels(np.arange(-90, 90, 10))
350
351
352subplot(223)
353# on fait une nouvelle projection en zoomant sur l'antarctique
354map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
355llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
356xii, yii = map(*np.meshgrid(xvec,yvec))
357clevs=arange(0,1000,10)#star, stop, step
358cs=map.contourf(xii,yii,zz23, clevs)
359#cs=map.pcolormesh(xii,yii,zz2)
360#cmap=cm.s3pcpn_l_r)
361#sstanom)
362#s3pcpn_l_r)
363cbar =colorbar(cs)
364plt.title(tt23)
365# draw coastlines, country boundaries, fill continents.
366map.drawcoastlines(linewidth=1)
367# draw the edge of the map projection region (the projection limb)
368map.drawmapboundary()
369# draw lat/lon grid lines every 30 degrees.
370map.drawmeridians(np.arange(0, 360, 10))
371map.drawparallels(np.arange(-90, 90, 10))
372
373
374subplot(224)
375# on fait une nouvelle projection en zoomant sur l'antarctique
376map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
377llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
378xii, yii = map(*np.meshgrid(xvec,yvec))
379clevs=arange(0,1000,10)#star, stop, step
380cs=map.contourf(xii,yii,zz24, clevs)
381#cs=map.pcolormesh(xii,yii,zz2)
382#cmap=cm.s3pcpn_l_r)
383#sstanom)
384#s3pcpn_l_r)
385cbar =colorbar(cs)
386plt.title(tt24)
387# draw coastlines, country boundaries, fill continents.
388map.drawcoastlines(linewidth=1)
389# draw the edge of the map projection region (the projection limb)
390map.drawmapboundary()
391# draw lat/lon grid lines every 30 degrees.
392map.drawmeridians(np.arange(0, 360, 10))
393map.drawparallels(np.arange(-90, 90, 10))
394#plt.show()
395
396plt.savefig(t)
397close()
398
399
400#########################################################################
401#### dif emis t 1pos 2pos 3pos
402zz21 = edif_t1
403zz22 = edif_t2
404zz23 = edif_t3
405zz24 = edif_13
406tt21='dif emis t pos1 amsua ch2'
407tt22='dif emis t pos2 amsua ch2'
408tt23='dif emis t pos3 amsua ch2'
409tt24='dif emis pos1 pos2 amsua ch2'
410t='dif_emis_amsua_ch2.png'
411
412figure(1)
413subplot(221)
414m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0,
415resolution = 'l')
416
417xii, yii = m1(*np.meshgrid(xvec,yvec))
418width = m1.urcrnrx - m1.llcrnrx
419height = m1.urcrnry - m1.llcrnry
420
421coef = 0.6
422width = width*coef
423height = height*coef
424
425# on fait une nouvelle projection en zoomant sur l'antarctique
426map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
427llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
428xii, yii = map(*np.meshgrid(xvec,yvec))
429clevs=arange(-0.05,0.05,0.0001)#star, stop, step
430cs=map.contourf(xii,yii,zz21, clevs, cmap=cm.s3pcpn_l_r)
431#cs=map.pcolormesh(xii,yii,zz2)
432#cmap=cm.s3pcpn_l_r)
433#sstanom)
434#s3pcpn_l_r)
435cbar =colorbar(cs)
436plt.title(tt21)
437# draw coastlines, country boundaries, fill continents.
438map.drawcoastlines(linewidth=1)
439# draw the edge of the map projection region (the projection limb)
440map.drawmapboundary()
441# draw lat/lon grid lines every 30 degrees.
442map.drawmeridians(np.arange(0, 360, 10))
443map.drawparallels(np.arange(-90, 90, 10))
444
445subplot(222)
446# on fait une nouvelle projection en zoomant sur l'antarctique
447map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
448llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
449xii, yii = map(*np.meshgrid(xvec,yvec))
450clevs=arange(-0.05,0.05,0.0001)#star, stop, step
451cs=map.contourf(xii,yii,zz22, clevs, cmap=cm.s3pcpn_l_r)
452#cs=map.pcolormesh(xii,yii,zz2)
453#cmap=cm.s3pcpn_l_r)
454#sstanom)
455#s3pcpn_l_r)
456cbar =colorbar(cs)
457plt.title(tt22)
458# draw coastlines, country boundaries, fill continents.
459map.drawcoastlines(linewidth=1)
460# draw the edge of the map projection region (the projection limb)
461map.drawmapboundary()
462# draw lat/lon grid lines every 30 degrees.
463map.drawmeridians(np.arange(0, 360, 10))
464map.drawparallels(np.arange(-90, 90, 10))
465
466
467subplot(223)
468# on fait une nouvelle projection en zoomant sur l'antarctique
469map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
470llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
471xii, yii = map(*np.meshgrid(xvec,yvec))
472clevs=arange(-0.05,0.05,0.0001)#star, stop, step
473cs=map.contourf(xii,yii,zz23, clevs, cmap=cm.s3pcpn_l_r)
474#cs=map.pcolormesh(xii,yii,zz2)
475#cmap=cm.s3pcpn_l_r)
476#sstanom)
477#s3pcpn_l_r)
478cbar =colorbar(cs)
479plt.title(tt23)
480# draw coastlines, country boundaries, fill continents.
481map.drawcoastlines(linewidth=1)
482# draw the edge of the map projection region (the projection limb)
483map.drawmapboundary()
484# draw lat/lon grid lines every 30 degrees.
485map.drawmeridians(np.arange(0, 360, 10))
486map.drawparallels(np.arange(-90, 90, 10))
487
488
489subplot(224)
490# on fait une nouvelle projection en zoomant sur l'antarctique
491map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\
492llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height)
493xii, yii = map(*np.meshgrid(xvec,yvec))
494clevs=arange(-0.05,0.05,0.0001)#star, stop, step
495cs=map.contourf(xii,yii,zz24, clevs, cmap=cm.s3pcpn_l_r)
496#cs=map.pcolormesh(xii,yii,zz2)
497#cmap=cm.s3pcpn_l_r)
498#sstanom)
499#s3pcpn_l_r)
500cbar =colorbar(cs)
501plt.title(tt24)
502# draw coastlines, country boundaries, fill continents.
503map.drawcoastlines(linewidth=1)
504# draw the edge of the map projection region (the projection limb)
505map.drawmapboundary()
506# draw lat/lon grid lines every 30 degrees.
507map.drawmeridians(np.arange(0, 360, 10))
508map.drawparallels(np.arange(-90, 90, 10))
509#plt.show()
510
511plt.savefig(t)
512close()
513
514################################################
515#histograma
516
517bins=arange(0.4,1,0.002)
518plt.hist(zz, bins=bins,histtype='step', label='hist',normed='True',color='black')
519plt.show()
520plt.savefig('hist_emis_amsua_ch2.png')
521close()
Note: See TracBrowser for help on using the repository browser.