Changeset 17953


Ignore:
Timestamp:
05/06/14 17:19:40 (11 years ago)
Author:
cborstad
Message:

CHG: better handling of clim when nan's are present or when data is constant, so that color norm is better suited for plotting in python

Location:
issm/trunk-jpl/src/m/plot
Files:
2 edited

Legend:

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

    r17915 r17953  
    4242           lims=options.getfieldvalue('caxis',[min(data),max(data)])
    4343        else:
    44            lims=[min(data),max(data)]
     44                if min(data)==max(data):
     45                        lims=[min(data)-0.5,max(data)+0.5]
     46                else:
     47                        lims=[min(data),max(data)]
    4548        norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
    4649        if datatype==1:
  • issm/trunk-jpl/src/m/plot/processdata.py

    r17893 r17953  
    4545        nanfill=options.getfieldvalue('nan',-9999)
    4646        if npy.any(npy.isnan(procdata)):
     47                lb=npy.min(data[~npy.isnan(data)])
     48                ub=npy.max(data[~npy.isnan(data)])
     49                if lb==ub:
     50                        lb=lb-0.5
     51                        ub=ub+0.5
     52                        nanfill=lb-1
    4753                procdata[npy.isnan(procdata)]=nanfill
     54                options.addfielddefault('clim',[lb,ub])
    4855                options.addfielddefault('cmap_set_under','1')
    49                 options.addfielddefault('clim',[npy.min(data[~npy.isnan(data)]),npy.max(data[~npy.isnan(data)])])
    50                 print "WARNING: nan's treated as -9999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
     56                print "WARNING: nan's treated as", nanfill, "by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
    5157
    5258        #non-patch processing
Note: See TracChangeset for help on using the changeset viewer.