Changeset 181


Ignore:
Timestamp:
Jun 29, 2011, 7:00:20 PM (14 years ago)
Author:
aslmd
Message:

MESOSCALE:PYTHON: petites ameliorations pour rendre les scripts applicables si on n'a pas les droits dans le dossier ou se trouvent les donnees.

Location:
trunk/MESOSCALE/PLOT/PYTHON
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE/PLOT/PYTHON/map_ecmwf.py

    r180 r181  
    4242                        m = myp.define_proj(proj,wlon,wlat)
    4343                        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"))
     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"))
    4848                        zeplot = m.contour(x, y, field, 20)
    4949                        plt.clabel(zeplot, inline=1, inline_spacing=1, fontsize=7, fmt='%0i')
  • trunk/MESOSCALE/PLOT/PYTHON/mylib/myplot.py

    r180 r181  
    4747    import  matplotlib.pyplot as plt
    4848    res = int(res)
    49     if folder != '':    name = folder+'/'+filename+str(res)+".png"
    50     else:               name = filename+str(res)+".png"
     49    if folder != '':      name = folder+'/'+filename+str(res)+".png"
     50    else:                 name = filename+str(res)+".png"
    5151    plt.savefig(name,dpi=res,bbox_inches='tight',pad_inches=pad_inches_value)
    52     if disp:            display(name)           
     52    if disp:              display(name)         
    5353    return
    5454
     
    118118def display (name):
    119119        from    os                              import system
    120         system("eog "+name+" > /dev/null 2> /dev/null &")
     120        system("display "+name+" > /dev/null 2> /dev/null &")
    121121        return name
    122122
     
    138138    meanlat = 0.5*(wlat[0]+wlat[1])
    139139    h = 2000.
    140     if   char == "cyl":     m = Basemap(projection='cyl',llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])#,suppress_ticks=False)
     140    if   char == "cyl":     m = Basemap(projection='cyl',llcrnrlat=wlat[0],urcrnrlat=wlat[1],llcrnrlon=wlon[0],urcrnrlon=wlon[1])
    141141    elif char == "moll":    m = Basemap(projection='moll',lon_0=meanlon)
    142142    elif char == "ortho":   m = Basemap(projection='ortho',lon_0=meanlon,lat_0=meanlat)
  • trunk/MESOSCALE/PLOT/PYTHON/scripts/domain.py

    r180 r181  
    44
    55def usage():
    6     print 'USAGE:  plot.py file '
     6    print 'USAGE:  plot.py file (target)'
    77    print 'file  : name of input netcdf file.'
    8     print 'Example:  domain.py /tmp7/aslmd/HELLAS/wrfout_d02_2024-10-03_06:00:00'
     8    print '(target) : a directory with write rights.'
     9    print 'Example:  domain.py /d5/aslmd/LMD_MM_MARS_SIMUS/OM/OM6_TI85/wrfout_d01_2024-06-43_06:00:00 ~/'
    910
    10 def domain (namefile,proj="ortho",back="molabw"): #vishires
     11def domain (namefile,proj="ortho",back="molabw",target=None): #vishires
    1112    from netCDF4 import Dataset
    1213    from myplot import getcoord2d,define_proj,makeplotpng,simplinterv
     
    1819    x, y = m(lon2d, lat2d)
    1920    contourf(x, y, nc.variables['HGT'][0,:,:] / 1000., 50)
    20     makeplotpng(namefile+".domain",pad_inches_value=0.05)
     21    if not target:   zeplot = namefile+".domain"
     22    else:            zeplot = target+"domain"
     23    makeplotpng(zeplot,pad_inches_value=0.35)
    2124
    2225if __name__ == "__main__":
    2326    import sys
    24     domain(str(sys.argv[1]))
    25 
     27    if (len(sys.argv)) == 2:     domain( str(sys.argv[1]) )
     28    elif (len(sys.argv)) == 3:   domain( str(sys.argv[1]) , target = str(sys.argv[2]) )
  • trunk/MESOSCALE/PLOT/PYTHON/scripts/winds.py

    r180 r181  
    44
    55def usage():
    6     print 'USAGE:  winds.py ntime nvert file'
     6    print 'USAGE:  winds.py nvert file (target)'
    77    print 'file  : name of input netcdf file.'
    88    print 'nvert : vertical level.'
    9     print 'Example: winds.py 0 /d5/aslmd/LMD_MM_MARS_SIMUS/OM/OM6_TI85/wrfout_d01_2024-06-43_06:00:00_zabg'
     9    print '(target) : a directory with write rights.'
     10    print 'Example: winds.py 0 /d5/aslmd/LMD_MM_MARS_SIMUS/OM/OM6_TI85/wrfout_d01_2024-06-43_06:00:00_zabg ~/'
    1011
    11 def winds (namefile,nvert,proj="cyl",back=None):
     12def winds (namefile,nvert,proj="cyl",back=None,target=None):
    1213    from netCDF4 import Dataset
    1314    from myplot import getcoord2d,define_proj,makeplotpng,simplinterv,vectorfield,ptitle
     
    3132                      scale=20., factor=300., color='k')
    3233       sub += 1
    33     makeplotpng(namefile+".winds"+str(nvert),pad_inches_value=0.35)   
     34    if not target:   zeplot = namefile+".winds"+str(nvert)
     35    else:            zeplot = target+"winds"+str(nvert)
     36    makeplotpng(zeplot,pad_inches_value=0.35)   
    3437
    3538def getwinds (nc,charu='Um',charv='Vm'):
     
    4043if __name__ == "__main__":
    4144    import sys
    42     winds(str(sys.argv[2]),int(sys.argv[1]))
     45    if (len(sys.argv)) == 3:     winds( str(sys.argv[2]) , int(sys.argv[1]) )
     46    elif (len(sys.argv)) == 4:   winds( str(sys.argv[2]) , int(sys.argv[1]) , target=str(sys.argv[3]))
Note: See TracChangeset for help on using the changeset viewer.