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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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:                                                   
Note: See TracChangeset for help on using the changeset viewer.