Changeset 2830 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Apr 29, 2020, 3:49:07 PM (5 years ago)
Author:
lfita
Message:

Adding checking for variable type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r2829 r2830  
    87468746        var1  = varns1[iv]
    87478747        var2  = varns2[iv]
    8748         print var1 + ' ...'
    87498748
    87508749        objvar1 = objnc1.variables[var1]
    87518750        objvar2 = objnc2.variables[var2]
     8751        if objvar1.dtype == type('Str') or objvar1.dtype == type(chr(48)) or objvar1.dtype == '|S1':
     8752            print warnmsg
     8753            print '  ' + fname + ": can not compare variable '" + var1 + "' of type",\
     8754              objvar1.dtype
     8755            continue
     8756        print var1 + ' ...', objvar1.dtype
    87528757
    87538758        Ndim1 = len(objvar1.shape)
     
    88328837            # Statistical variables
    88338838            typvar = objvar1.dtype
    8834             if typvar == type(int(1)):
     8839            if typvar == type(int(1)) or typvar == type(np.int32(1)):
    88358840                fillValue = gen.fillValueI
    88368841            elif typvar == type((1.)) or typvar == type(np.float(1.)) or            \
Note: See TracChangeset for help on using the changeset viewer.