1 | #mod gabi para graficar AMSUA CH2 |
---|
2 | #!/usr/bin/env python |
---|
3 | # -*- coding: utf-8 -*- |
---|
4 | import string |
---|
5 | import numpy as np |
---|
6 | import matplotlib.pyplot as plt |
---|
7 | import ffgrid2 |
---|
8 | from pylab import * |
---|
9 | from mpl_toolkits.basemap import Basemap |
---|
10 | from mpl_toolkits.basemap import shiftgrid, cm |
---|
11 | #import netCDF4 |
---|
12 | |
---|
13 | #x=monthly_lon |
---|
14 | #y=monthly_lat |
---|
15 | #z=monthly_outz |
---|
16 | |
---|
17 | zz1=zzpgrid_3n |
---|
18 | zz2=sigma_grid_3n |
---|
19 | zz3=nngrid_3n |
---|
20 | |
---|
21 | t1='amsua_ch2_tb.png' |
---|
22 | tt1='amsua_ch2 tb' |
---|
23 | t2='amsua_ch2_ecart_type.png' |
---|
24 | tt2='amsua_ch2 ecart type' |
---|
25 | t3='amsua_ch2_nom_donnes_tb.png' |
---|
26 | tt3='amsua ch2 nom donnes tb' |
---|
27 | |
---|
28 | t1='amsua_ch2_pos3_tb.png' |
---|
29 | tt1='amsua_ch2 pos3 tb' |
---|
30 | t2='amsua_ch2_pos3_ecart_type.png' |
---|
31 | tt2='amsua_ch2 pos3 ecart type' |
---|
32 | t3='amsua_ch2_pos3_nom_donnes_tb.png' |
---|
33 | tt3='amsua ch2 pos3 nom donnes tb' |
---|
34 | |
---|
35 | |
---|
36 | # on recupere les coordonnes xy de la projection orth standard |
---|
37 | m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0, |
---|
38 | resolution = 'l') |
---|
39 | |
---|
40 | xii, yii = m1(*np.meshgrid(xvec,yvec)) |
---|
41 | width = m1.urcrnrx - m1.llcrnrx |
---|
42 | height = m1.urcrnry - m1.llcrnry |
---|
43 | |
---|
44 | coef = 0.6 |
---|
45 | width = width*coef |
---|
46 | height = height*coef |
---|
47 | |
---|
48 | # on fait une nouvelle projection en zoomant sur l'antarctique |
---|
49 | |
---|
50 | map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\ |
---|
51 | |
---|
52 | llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height) |
---|
53 | xii, yii = map(*np.meshgrid(xvec,yvec)) |
---|
54 | cs=m.contourf(xii,yii,zz1) |
---|
55 | #, clevs, cmap=my_cmap) |
---|
56 | cs=map.pcolormesh(xii,yii,zz1,cmap=cm.s3pcpn_l_r) |
---|
57 | #cs=map.pcolormesh(xii,yii,zz2) |
---|
58 | #cmap=cm.s3pcpn_l_r) |
---|
59 | #sstanom) |
---|
60 | #s3pcpn_l_r) |
---|
61 | cbar =colorbar(cs) |
---|
62 | plt.title(tt1) |
---|
63 | |
---|
64 | # draw coastlines, country boundaries, fill continents. |
---|
65 | map.drawcoastlines(linewidth=1) |
---|
66 | # draw the edge of the map projection region (the projection limb) |
---|
67 | map.drawmapboundary() |
---|
68 | # draw lat/lon grid lines every 30 degrees. |
---|
69 | map.drawmeridians(np.arange(0, 360, 10)) |
---|
70 | map.drawparallels(np.arange(-90, 90, 10)) |
---|
71 | #plt.show() |
---|
72 | |
---|
73 | plt.savefig(t1) |
---|
74 | close() |
---|
75 | |
---|
76 | #carte ecart type |
---|
77 | zz21 = sigma_grid_t |
---|
78 | zz22 = sigma_grid_1n |
---|
79 | zz23 = sigma_grid_2n |
---|
80 | zz24 = sigma_grid_3n |
---|
81 | tt21='amsua ch2 t ecart type' |
---|
82 | tt22='amsua ch2 1n ecart type' |
---|
83 | tt23='amsua ch2 2n ecart type' |
---|
84 | tt24='amsua ch2 3n ecart type' |
---|
85 | t='amsua_ch2_ecart_type.png' |
---|
86 | |
---|
87 | figure(1) |
---|
88 | subplot(221) |
---|
89 | m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0, |
---|
90 | resolution = 'l') |
---|
91 | |
---|
92 | xii, yii = m1(*np.meshgrid(xvec,yvec)) |
---|
93 | width = m1.urcrnrx - m1.llcrnrx |
---|
94 | height = m1.urcrnry - m1.llcrnry |
---|
95 | |
---|
96 | coef = 0.6 |
---|
97 | width = width*coef |
---|
98 | height = height*coef |
---|
99 | |
---|
100 | # on fait une nouvelle projection en zoomant sur l'antarctique |
---|
101 | map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\ |
---|
102 | llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height) |
---|
103 | xii, yii = map(*np.meshgrid(xvec,yvec)) |
---|
104 | clevs=arange(0,40,0.1)#star, stop, step |
---|
105 | cs=map.contourf(xii,yii,zz21, clevs, cmap=cm.s3pcpn_l) |
---|
106 | #cs=map.pcolormesh(xii,yii,zz2) |
---|
107 | #cmap=cm.s3pcpn_l_r) |
---|
108 | #sstanom) |
---|
109 | #s3pcpn_l_r) |
---|
110 | cbar =colorbar(cs) |
---|
111 | plt.title(tt21) |
---|
112 | # draw coastlines, country boundaries, fill continents. |
---|
113 | map.drawcoastlines(linewidth=1) |
---|
114 | # draw the edge of the map projection region (the projection limb) |
---|
115 | map.drawmapboundary() |
---|
116 | # draw lat/lon grid lines every 30 degrees. |
---|
117 | map.drawmeridians(np.arange(0, 360, 10)) |
---|
118 | map.drawparallels(np.arange(-90, 90, 10)) |
---|
119 | |
---|
120 | subplot(222) |
---|
121 | # on fait une nouvelle projection en zoomant sur l'antarctique |
---|
122 | map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\ |
---|
123 | llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height) |
---|
124 | xii, yii = map(*np.meshgrid(xvec,yvec)) |
---|
125 | clevs=arange(0,40,0.1)#star, stop, step |
---|
126 | cs=map.contourf(xii,yii,zz22, clevs, cmap=cm.s3pcpn_l) |
---|
127 | #cs=map.pcolormesh(xii,yii,zz2) |
---|
128 | #cmap=cm.s3pcpn_l_r) |
---|
129 | #sstanom) |
---|
130 | #s3pcpn_l_r) |
---|
131 | cbar =colorbar(cs) |
---|
132 | plt.title(tt22) |
---|
133 | # draw coastlines, country boundaries, fill continents. |
---|
134 | map.drawcoastlines(linewidth=1) |
---|
135 | # draw the edge of the map projection region (the projection limb) |
---|
136 | map.drawmapboundary() |
---|
137 | # draw lat/lon grid lines every 30 degrees. |
---|
138 | map.drawmeridians(np.arange(0, 360, 10)) |
---|
139 | map.drawparallels(np.arange(-90, 90, 10)) |
---|
140 | |
---|
141 | |
---|
142 | subplot(223) |
---|
143 | # on fait une nouvelle projection en zoomant sur l'antarctique |
---|
144 | map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\ |
---|
145 | llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height) |
---|
146 | xii, yii = map(*np.meshgrid(xvec,yvec)) |
---|
147 | clevs=arange(0,40,0.1)#star, stop, step |
---|
148 | cs=map.contourf(xii,yii,zz23, clevs, cmap=cm.s3pcpn_l) |
---|
149 | #cs=map.pcolormesh(xii,yii,zz2) |
---|
150 | #cmap=cm.s3pcpn_l_r) |
---|
151 | #sstanom) |
---|
152 | #s3pcpn_l_r) |
---|
153 | cbar =colorbar(cs) |
---|
154 | plt.title(tt23) |
---|
155 | # draw coastlines, country boundaries, fill continents. |
---|
156 | map.drawcoastlines(linewidth=1) |
---|
157 | # draw the edge of the map projection region (the projection limb) |
---|
158 | map.drawmapboundary() |
---|
159 | # draw lat/lon grid lines every 30 degrees. |
---|
160 | map.drawmeridians(np.arange(0, 360, 10)) |
---|
161 | map.drawparallels(np.arange(-90, 90, 10)) |
---|
162 | |
---|
163 | |
---|
164 | subplot(224) |
---|
165 | # on fait une nouvelle projection en zoomant sur l'antarctique |
---|
166 | map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\ |
---|
167 | llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height) |
---|
168 | xii, yii = map(*np.meshgrid(xvec,yvec)) |
---|
169 | clevs=arange(0,40,0.1)#star, stop, step |
---|
170 | cs=map.contourf(xii,yii,zz24, clevs, cmap=cm.s3pcpn_l) |
---|
171 | #cs=map.pcolormesh(xii,yii,zz2) |
---|
172 | #cmap=cm.s3pcpn_l_r) |
---|
173 | #sstanom) |
---|
174 | #s3pcpn_l_r) |
---|
175 | cbar =colorbar(cs) |
---|
176 | plt.title(tt24) |
---|
177 | # draw coastlines, country boundaries, fill continents. |
---|
178 | map.drawcoastlines(linewidth=1) |
---|
179 | # draw the edge of the map projection region (the projection limb) |
---|
180 | map.drawmapboundary() |
---|
181 | # draw lat/lon grid lines every 30 degrees. |
---|
182 | map.drawmeridians(np.arange(0, 360, 10)) |
---|
183 | map.drawparallels(np.arange(-90, 90, 10)) |
---|
184 | |
---|
185 | plt.show() |
---|
186 | plt.savefig(t) |
---|
187 | close() |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | ##########################" |
---|
195 | #carte nom de donnees |
---|
196 | m1 = Basemap(projection='ortho', lat_0 = -90, lon_0 = 0, |
---|
197 | resolution = 'l') |
---|
198 | |
---|
199 | xii, yii = m1(*np.meshgrid(xvec,yvec)) |
---|
200 | width = m1.urcrnrx - m1.llcrnrx |
---|
201 | height = m1.urcrnry - m1.llcrnry |
---|
202 | |
---|
203 | coef = 0.6 |
---|
204 | width = width*coef |
---|
205 | height = height*coef |
---|
206 | |
---|
207 | # on fait une nouvelle projection en zoomant sur l'antarctique |
---|
208 | |
---|
209 | map = Basemap(projection='ortho',lon_0=0,lat_0=-90,resolution='l',\ |
---|
210 | |
---|
211 | llcrnrx=-0.5*width,llcrnry=-0.5*height,urcrnrx=0.5*width,urcrnry=0.5*height) |
---|
212 | xii, yii = map(*np.meshgrid(xvec,yvec)) |
---|
213 | |
---|
214 | evels=[300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100] |
---|
215 | cs=map.pcolormesh(xii,yii,zz3) |
---|
216 | #cmap=cm.s3pcpn_l_r) |
---|
217 | #sstanom) |
---|
218 | #s3pcpn_l_r) |
---|
219 | cbar =colorbar(cs) |
---|
220 | plt.title(tt3) |
---|
221 | |
---|
222 | # draw coastlines, country boundaries, fill continents. |
---|
223 | map.drawcoastlines(linewidth=1) |
---|
224 | # draw the edge of the map projection region (the projection limb) |
---|
225 | map.drawmapboundary() |
---|
226 | # draw lat/lon grid lines every 30 degrees. |
---|
227 | map.drawmeridians(np.arange(0, 360, 10)) |
---|
228 | map.drawparallels(np.arange(-90, 90, 10)) |
---|
229 | #plt.show() |
---|
230 | |
---|
231 | plt.savefig(t3) |
---|
232 | close() |
---|