Changeset 1928 in lmdz_wrf for trunk


Ignore:
Timestamp:
Jul 13, 2018, 3:20:51 PM (6 years ago)
Author:
lfita
Message:

Enhancing `varrm' by adding possibility of ',' separated list of variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r1923 r1928  
    16901690  """ Removing a variable from a file
    16911691  ncfile = netCDF object file
    1692   var = variable name to remove
     1692  var = ',' separated list of variables' name to remove
    16931693  """
    16941694  import shutil as shu
     
    17041704  ncf.close()
    17051705
    1706   if not gen.searchInlist(ncvars, var):
    1707       print '  ' + fname + ": File '" + ncfile + "' does not have variable: '" +     \
    1708         var + "' !!"
    1709       print '  variables:', ncvars
    1710       quit(-1)
     1706  varns = gen.str_list(var, ',')
     1707
     1708  for var in varns:
     1709      if not gen.searchInlist(ncvars, var):
     1710          print '  ' + fname + ": File '" + ncfile + "' does not have variable: '" + \
     1711            var + "' !!"
     1712          print '  variables:', ncvars
     1713          quit(-1)
    17111714
    17121715  tmpncf = NetCDFFile('tmp_py.nc' , 'w')
Note: See TracChangeset for help on using the changeset viewer.