Ignore:
Timestamp:
04/14/16 19:12:45 (9 years ago)
Author:
dlcheng
Message:

CHG (javascript): Updating unit plots to handle log scaling. processdata now handle node transients with log scaling.

File:
1 edited

Legend:

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

    r19888 r20511  
    191191                                throw Error("Log option cannot be applied on negative values. Use caxis option (Rignot''s settings: [1.5 max(data)])");
    192192                        }
    193                    for(var i=0;i<md.mesh.numberofvertices;i++){
     193                        for(var i=0;i<md.mesh.numberofvertices;i++){
    194194                           data[i]=Math.log10(data[i])/Math.log10(options.getfieldvalue('log'));
    195                    }
     195                        }
    196196                }
    197197        }
     
    200200    if (datasize==md.mesh.numberofvertices+1){
    201201        datatype=5;
     202               
     203                //log? 
     204                if (options.exist('log')){
     205                        var bounds=options.getfieldvalue('caxis',[ArrayMin(data),ArrayMax(data)]);
     206                        for(var i=0;i<md.mesh.numberofvertices;i++) {
     207                                for(var j=0;j<data[i].length;j++) {
     208                                        if(data[i][j]<bounds[0])data[i][j]=bounds[0];
     209                                }
     210                        }
     211                        for(var i=0;i<md.mesh.numberofvertices;i++) {
     212                                for(var j=0;j<data[i].length;j++) {
     213                                        if(data[i][j]>bounds[1])data[i][j]=bounds[1];
     214                                }
     215                        }
     216                        for(var i=0;i<md.mesh.numberofvertices;i++) {
     217                                for(var j=0;j<data[i].length;j++) {
     218                                        if(data[i][j]<=0) {
     219                                                throw Error("Log option cannot be applied on negative values. Use caxis option (Rignot''s settings: [1.5 max(data)])");
     220                                        }
     221                                }
     222                        }
     223                        for(var i=0;i<md.mesh.numberofvertices;i++){
     224                                for(var j=0;j<data[i].length;j++) {
     225                                        data[i][j]=Math.log10(data[i][j])/Math.log10(options.getfieldvalue('log'));
     226                                }
     227                        }
     228                }
    202229    }
    203230       
Note: See TracChangeset for help on using the changeset viewer.