Changeset 17696


Ignore:
Timestamp:
04/09/14 16:33:21 (11 years ago)
Author:
cborstad
Message:

BUG: create copy so that original data is not overwritten by processdata

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/m/plot/processdata.py

    r17618 r17696  
    2929                numberofelements2d=npy.nan
    3030
     31        procdata=npy.copy(data)
     32
    3133        #process patch
    3234
     
    3537
    3638        #get datasize
    37         if npy.ndim(data)==1:
    38                 datasize=npy.array([len(data),1])
     39        if npy.ndim(procdata)==1:
     40                datasize=npy.array([len(procdata),1])
    3941        else:
    40                 datasize=npy.shape(data)
     42                datasize=npy.shape(procdata)
    4143       
    4244        #process NaN's if any
    43         nanfill=options.getfieldvalue('nan',-999)
    44         if npy.any(npy.isnan(data)):
    45                 data[npy.isnan(data)]=nanfill
    46                 print "WARNING: nan's treated as -999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
     45        nanfill=options.getfieldvalue('nan',-9999)
     46        if npy.any(npy.isnan(procdata)):
     47                procdata[npy.isnan(procdata)]=nanfill
     48                print "WARNING: nan's treated as -9999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
    4749
    4850        #non-patch processing
     
    7274
    7375        #convert rank-2 array to rank-1
    74         if npy.ndim(data)==2 and npy.shape(data)[1]==1:
    75                 data=data.reshape(-1,)
     76        if npy.ndim(procdata)==2 and npy.shape(procdata)[1]==1:
     77                procdata=procdata.reshape(-1,)
    7678
    7779        #if datatype is still zero, error out
     
    7981                raise ValueError("processdata error: data provided not recognized or not supported")
    8082        else:
    81                 return data, datatype
     83                return procdata, datatype
Note: See TracChangeset for help on using the changeset viewer.