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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.