Changeset 311 in lmdz_wrf for trunk/tools/nc_var_tools.py


Ignore:
Timestamp:
Feb 26, 2015, 11:34:12 AM (10 years ago)
Author:
lfita
Message:

Final version of the operation 'ncstepdiff'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r310 r311  
    26482648            if not searchInlist(attvar, 'units'):
    26492649                print warnmsg
    2650                 print '    cls_time_information: time variable "', tname,            \
     2650                print '    cls_time_information: time variable "' + tname +          \
    26512651                  '" does not have attribute: "units"'
    26522652                units = None
     
    1345213452    return
    1345313453
    13454 def ncstediffp(values, ncfile, varn):
     13454def ncstepdiff(values, ncfile, varn):
    1345513455    """ Function to compute differencies between time-steps (deacumulate) a netCDF file
    1345613456      new variables labelled [varn] + 'de'will be added to the file
     
    1346013460      ncfile= netCDF file to replace something
    1346113461      varn= ',' list of variables to deaccumulate ('all' for all)
    13462       ncstediffp('Time,Times', '/home/lluis/PY/wrfout_d01_2001-11-11_00:00:00.tests', 'Q2')
     13462      ncstepdiff('Time,Times', '/home/lluis/PY/wrfout_d01_2001-11-11_00:00:00.tests', 'Q2')
    1346313463    """
    13464     fname = 'ncstediffp'
     13464    fname = 'ncstepdiff'
    1346513465
    1346613466    if values == 'h':
    1346713467        print fname + '_____________________________________________________________'
    13468         print ncstediffp.__doc__
     13468        print ncstepdiff.__doc__
    1346913469        quit()
    1347013470
     
    1348013480    if varn.find(',') != -1:
    1348113481        if varn != 'all':
    13482             varns = varn.slipt(',')
     13482            varns = varn.split(',')
    1348313483        else:
    1348413484            varns = onc.variables
     
    1352613526            else:
    1352713527                print warnmsg
    13528                 print '  ' + fname + ": variable '" + vn + "de' already exist!!"
    13529                 print '    replacing values'
     13528                print '  ' + fname + ": variable '" + vn + "de' already exist " +    \
     13529                  'replacing values !!'
    1353013530                newvar = onc.variables[vn + 'de']
    1353113531
     
    1354713547
    1354813548    return
    13549 ncstediffp('Time,Times', '/home/lluis/PY/wrfout_d01_2001-11-11_00:00:00.tests', 'Q2')
    13550 quit()
     13549#ncstepdiff('Time,Times', '/home/lluis/PY/wrfout_d01_2001-11-11_00:00:00.tests', 'Q2,T2')
    1355113550
    1355213551#quit()
Note: See TracChangeset for help on using the changeset viewer.