Changeset 507 for trunk/UTIL


Ignore:
Timestamp:
Jan 25, 2012, 6:41:35 PM (13 years ago)
Author:
aslmd
Message:

UTIL PYTHON: added an option --seevar to see the list of variables in file. also if there is only one variable and the name is not right the script figure it out.

Location:
trunk/UTIL/PYTHON
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/myscript.py

    r502 r507  
    33    ### I/O
    44    parser.add_option('-f', '--file',   action='append',dest='file',     type="string",  default=None,  help='[NEEDED] filename. Append: different figures. Comma-separated: same figure (+ possible --operation). Regex OK: use -f "foo*" DONT FORGET QUOTES "" !!!!')
     5    parser.add_option('--seevar',       action='store_true',dest='seevar',               default=False, help='display the list of variables in the file')
    56    parser.add_option('-t', '--target', action='store',dest='tgt',       type="string",  default=None,  help='destination folder')
    67    parser.add_option('-S', '--save',   action='store',dest='save',      type="string",  default="gui", help='save mode (gui,png,eps,svg,pdf,txt,html,avi) [gui]')
  • trunk/UTIL/PYTHON/planetoplot.py

    r502 r507  
    6060           axtime=None,\
    6161           redope=None,\
     62           seevar=False,\
    6263           xlab=None,\
    6364           ylab=None):
    64 
    6565
    6666    ####################################################################################################################
     
    119119      namefile = namefiles[nnn]
    120120      nc  = Dataset(namefile)
     121      varinfile = nc.variables.keys()
     122      if seevar: print varinfile ; exit()
    121123
    122124      ##################################
    123125      ### Initial checks and definitions
    124126      ### ... TYPEFILE
    125       typefile = whatkindfile(nc)                                 
     127      typefile = whatkindfile(nc)
    126128      if typefile in ['mesoideal']:   mapmode=0;winds=False
    127129      elif typefile in ['gcm'] and len(nc.variables["longitude"][:]) is 1 and len(nc.variables["latitude"][:]) is 1:       mapmode=0;winds=False
     
    137139      elif typefile != typefile0:   errormess("Not the same kind of files !", [typefile0, typefile])
    138140      ### ... VAR
    139       varname=var[vvv]
    140       if varname not in nc.variables: varname = False
     141      varname=var[vvv]
     142      if varname not in nc.variables:
     143          if len(varinfile) == 1:   varname = varinfile[0]
     144          else:                     varname = False
    141145      ### ... WINDS
    142146      if winds:                                                   
  • trunk/UTIL/PYTHON/pp.py

    r502 r507  
    157157                blat=opt.blat,blon=opt.blon,tsat=opt.tsat,flagnolow=opt.nolow,\
    158158                mrate=opt.rate,mquality=opt.quality,trans=opt.trans,zarea=opt.area,axtime=opt.axtime,\
    159                 redope=opt.redope,xlab=opt.xlab,ylab=opt.ylab)
     159                redope=opt.redope,seevar=opt.seevar,xlab=opt.xlab,ylab=opt.ylab)
    160160        print 'DONE: '+name
    161161        system("rm -f to_be_erased")
Note: See TracChangeset for help on using the changeset viewer.