1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | ########################################################################## |
---|
4 | var = ["151","146","167"] |
---|
5 | #var = ["167"] |
---|
6 | lev = ["700.","850."] |
---|
7 | tim = ["00"] |
---|
8 | date = ['10','08','2010','10','08','2010'] |
---|
9 | dataset = ["an","pl","0"] |
---|
10 | dataset = ["fc","sfc","3"] |
---|
11 | ########################################################################## |
---|
12 | proj = "cyl" #"moll" "ortho" "lcc" |
---|
13 | #proj = "ortho" |
---|
14 | area = "Europe" |
---|
15 | #area = "Central_America" |
---|
16 | #area = "Southern_Hemisphere" |
---|
17 | #area = "Northern_Hemisphere" |
---|
18 | ########################################################################## |
---|
19 | |
---|
20 | |
---|
21 | ########################################################################## |
---|
22 | import numpy as np |
---|
23 | import matplotlib.pyplot as plt |
---|
24 | import myplot as myp |
---|
25 | import myecmwf as mye |
---|
26 | ########################################################################## |
---|
27 | if dataset[1] == "sfc": lev = [9999.] |
---|
28 | [wlon,wlat] = myp.latinterv(area) |
---|
29 | nc = mye.get_ecmwf (var, dataset, wlat, wlon, lev, date, tim) |
---|
30 | ########################################################################## |
---|
31 | lat = nc.variables['lat' ][:] |
---|
32 | lon = nc.variables['lon' ][:] |
---|
33 | [lon2d,lat2d] = np.meshgrid(lon,lat) |
---|
34 | step=10. |
---|
35 | ########################################################################## |
---|
36 | ntime = 0 |
---|
37 | for i in range( np.array(var).size ): |
---|
38 | for j in range( np.array(lev).size ): |
---|
39 | for k in range( np.array(tim).size ): |
---|
40 | if dataset[1] == "pl": field = nc.variables['var'+var[i] ][k,j,:,:] |
---|
41 | if dataset[1] == "sfc": field = nc.variables['var'+var[i] ][k, :,:] |
---|
42 | m = myp.define_proj(proj,wlon,wlat) |
---|
43 | x, y = m(lon2d, lat2d) |
---|
44 | #m.drawmeridians(np.r_[wlon[0]:wlon[1]:step*2], labels=[0,0,0,1], color='grey') |
---|
45 | #m.drawparallels(np.r_[wlat[0]:wlat[1]:step ], labels=[1,0,0,0], color='grey') |
---|
46 | m.bluemarble() |
---|
47 | #m.warpimage(myp.earthmap("nice")) |
---|
48 | zeplot = m.contour(x, y, field, 20) |
---|
49 | plt.clabel(zeplot, inline=1, inline_spacing=1, fontsize=7, fmt='%0i') |
---|
50 | #plt.colorbar(fraction=0.05,pad=0.1) |
---|
51 | plt.title(mye.ecmwf_title_field(var[i])) |
---|
52 | name = str(var[i])+str(lev[j])+str(tim[k])+".png" |
---|
53 | plt.savefig(name) |
---|
54 | plt.clf() |
---|
55 | yeah = myp.display(name) |
---|