source: trunk/UTIL/PYTHON/examples/map_ecmwf.py @ 796

Last change on this file since 796 was 558, checked in by aslmd, 13 years ago

UTIL PYTHON: moved corrected ECMWF stuff for simple use in the main PYTHON directory. corrected planetoplot so that output files from ECMWF can be used. added a more general treatment of lat/lon prescription.

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/usr/bin/env python
2
3##########################################################################
4var = ["151","146","167"]
5var = ["167"]
6var = ["78"]
7var = ["137"]
8#var = ["174"] albedo marche pas.
9lev = ["700.","850."]
10tim = ["00"]
11date = ['10','08','2010','10','08','2010']
12date = ['01','09','2009','01','09','2009']
13#date = ['01','09','2010','01','09','2010']
14dataset = ["an","pl","0"]
15dataset = ["fc","sfc","3"]
16##########################################################################
17proj = "cyl"  #"moll" "ortho" "lcc"
18#proj = "ortho"
19#proj = "moll"
20area = "Europe"
21area = "Africa"
22area = "Central_America"
23#area = "Southern_Hemisphere"
24#area = "Northern_Hemisphere"
25#area = "Whole_No_High"
26area = "Whole"
27back="blue"
28#back="bw"
29#back="moc"
30##########################################################################
31
32
33##########################################################################
34import  numpy                           as np
35import  matplotlib.pyplot               as plt
36import  myplot                          as myp
37import  myecmwf                         as mye
38##########################################################################
39if dataset[1] == "sfc": lev = [9999.]
40[wlon,wlat] = myp.latinterv(area)
41nc = mye.get_ecmwf (var, dataset, wlat, wlon, lev, date, tim) 
42##########################################################################
43[lon2d,lat2d] = myp.getcoord2d (nc,nlat='lat',nlon='lon',is1d=True)
44step=10.
45##########################################################################
46ntime = 0
47for i in range( np.array(var).size ):
48        for z in range( np.array(lev).size ):
49                for t in range( np.array(tim).size ):
50
51                    field, error = myp.reducefield( myp.getfield(nc,'var'+var[i]), d4=t, d3=z )
52                    if not error:
53                        ### Map projection
54                        m = myp.define_proj(proj,wlon,wlat,back=back)
55                        x, y = m(lon2d, lat2d)
56                        zeplot = m.contour(x, y, field, 10) #15
57                        plt.clabel(zeplot, inline=1, inline_spacing=1, fontsize=7, fmt='%0i')
58                        #plt.colorbar(fraction=0.05,pad=0.1)
59                        plt.title(mye.ecmwf_title_field(var[i]))
60                        myp.makeplotres(str(var[i])+str(lev[z])+str(tim[t]),res=100.,pad_inches_value=0.35)
Note: See TracBrowser for help on using the repository browser.