Changeset 559 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jul 3, 2015, 5:12:25 PM (9 years ago)
Author:
lfita
Message:

Fixing not working np.where with `None' values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/read_ISD.py

    r556 r559  
    688688        basicvardef(newvar, varn, description['varLN'][ivar],                        \
    689689          description['varU'][ivar])
    690         newvar[:] = np.where(datavalues[varn] is None, fillValueF, datavalues[varn])
     690        vals = np.array(datavalues[varn])
     691        for iv in range(Ntvalues):
     692            if vals[iv] is None: vals[iv] = fillValueF
     693        newvar[:] = vals
     694#        newvar[:] = np.where(datavalues[varn] is None, fillValueF, datavalues[varn])
    691695    elif formats[ivar] == 'F':
    692696        newvar = objfile.createVariable(varn, 'f', ('time'), fill_value=fillValueF)
    693697        basicvardef(newvar, varn, description['varLN'][ivar],                        \
    694698          description['varU'][ivar])
    695         newvar[:] = np.where(datavalues[varn] is None, fillValueF, datavalues[varn])
     699        vals = np.array(datavalues[varn])
     700        for iv in range(Ntvalues):
     701            if vals[iv] is None: vals[iv] = fillValueF
     702        newvar[:] = vals
     703#        newvar[:] = np.where(datavalues[varn] is None, fillValueF, datavalues[varn])
    696704    elif formats[ivar] == 'I':
    697705        newvar = objfile.createVariable(varn, 'i', ('time'), fill_value=fillValueI)
Note: See TracChangeset for help on using the changeset viewer.