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