Ignore:
Timestamp:
Aug 30, 2011, 12:17:50 PM (13 years ago)
Author:
aslmd
Message:

MESOSCALE: python improvements for graphics. nothing essential.

Location:
trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/map_ecmwf.py

    r266 r273  
    33##########################################################################
    44var = ["151","146","167"]
    5 #var = ["167"]
     5var = ["167"]
     6var = ["78"]
     7var = ["137"]
    68lev = ["700.","850."]
    79tim = ["00"]
    810date = ['10','08','2010','10','08','2010']
     11date = ['01','09','2009','01','09','2009']
    912dataset = ["an","pl","0"]
    1013dataset = ["fc","sfc","3"]
    1114##########################################################################
    1215proj = "cyl"  #"moll" "ortho" "lcc"
    13 #proj = "ortho"
     16proj = "ortho"
     17#proj = "moll"
    1418area = "Europe"
     19area = "Africa"
    1520#area = "Central_America"
    1621#area = "Southern_Hemisphere"
    1722#area = "Northern_Hemisphere"
     23area = "Whole_No_High"
     24area = "Whole"
     25back="blue"
     26#back="bw"
    1827##########################################################################
    1928
     
    2938nc = mye.get_ecmwf (var, dataset, wlat, wlon, lev, date, tim)
    3039##########################################################################
    31 lat    = nc.variables['lat'             ][:]
    32 lon    = nc.variables['lon'             ][:]
    33 [lon2d,lat2d] = np.meshgrid(lon,lat)
     40[lon2d,lat2d] = myp.getcoord2d (nc,nlat='lat',nlon='lon',is1d=True)
    3441step=10.
    3542##########################################################################
    3643ntime = 0
    3744for 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)
     45        for z in range( np.array(lev).size ):
     46                for t in range( np.array(tim).size ):
     47
     48                    field, error = myp.reducefield( myp.getfield(nc,'var'+var[i]), d4=t, d3=z )
     49                    if not error:
     50                        ### Map projection
     51                        m = myp.define_proj(proj,wlon,wlat,back=back)
     52                        x, y = m(lon2d, lat2d)
     53                        zeplot = m.contour(x, y, field, 15)
     54                        plt.clabel(zeplot, inline=1, inline_spacing=1, fontsize=7, fmt='%0i')
     55                        #plt.colorbar(fraction=0.05,pad=0.1)
     56                        plt.title(mye.ecmwf_title_field(var[i]))
     57                        myp.makeplotres(str(var[i])+str(lev[z])+str(tim[t]),res=100.,pad_inches_value=0.35)
  • trunk/MESOSCALE_DEV/PLOT/PYTHON/mylib/myecmwf.py

    r180 r273  
    77        elif var == "130": name="Atmospheric Temperature (K)"           # ["130", "an", "0", "pl" ]
    88        elif var == "167": name="2m Atmospheric Temperature (K)"        # ["167", "fc", "3", "sfc"]
     9        elif var == "78": name="Total column liquid water (kg/kg)"
     10        elif var == "137": name="Total column water vapour (kg/m2)"
    911        return name
    1012
Note: See TracChangeset for help on using the changeset viewer.