Changeset 19741
- Timestamp:
- 11/17/15 15:38:42 (9 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/checkplotoptions.js
r19721 r19741 229 229 } 230 230 } 231 232 //Log scale (LOTS of changes to be performed233 if (options.exist('log')){234 if (options.exist('caxis')){235 options.changefieldvalue('caxis',Math.log(options.getfieldvalue('caxis'))/Math.log(options.getfieldvalue('log')));236 }237 options.changefieldvalue('cutoff',Math.log(options.getfieldvalue('cutoff',1.5))/Math.log(options.getfieldvalue('log')));238 }239 231 } -
issm/trunk-jpl/src/m/plot/plot_manager.js
r19739 r19741 6 6 // 7 7 // See also: PLOTMODEL, PLOT_UNIT 8 8 9 9 10 //parse options and get a structure of options. -
issm/trunk-jpl/src/m/plot/plot_unit.js
r19739 r19741 20 20 //}}} 21 21 22 //load the shaders: 22 23 loadShaders(gl); 23 24 … … 32 33 zmin = ArrayMin(z); 33 34 zmax = ArrayMax(z); 34 datamin = ArrayMin(data); 35 datamax = ArrayMax(data); 35 caxis= options.getfieldvalue('caxis',[ArrayMin(data),ArrayMax(data)]); 36 datamin = caxis[0]; 37 datamax = caxis[1]; 36 38 37 39 //Compute scaling: … … 68 70 } 69 71 else{ //2D triangular elements 70 72 71 73 /*A=elements(pos,1); B=elements(pos,2); C=elements(pos,3); 72 74 patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', data(pos),'FaceColor','flat','EdgeColor',edgecolor);*/ -
issm/trunk-jpl/src/m/plot/plotmodel.js
r19739 r19741 6 6 //First process options 7 7 var options = new plotoptions(args.slice(1,args.length)); 8 8 9 9 10 //get number of subplots -
issm/trunk-jpl/src/m/plot/processdata.js
r19721 r19741 146 146 for(var i=0;i<md.mesh.numberofelements;i++){ 147 147 if(!IsNaN(data[i])){ 148 data[i]=Math.log (data[i])/log(options.getfieldvalue('log'));148 data[i]=Math.log10(data[i])/Math.log10(options.getfieldvalue('log')); 149 149 } 150 150 } … … 180 180 //log? 181 181 if (options.exist('log')){ 182 var bounds=options.getfieldvalue('caxis',[ArrayMin(data),ArrayMax(data)]); 183 for(var i=0;i<md.mesh.numberofvertices;i++)if(data[i]<bounds[0])data[i]=bounds[0]; 184 for(var i=0;i<md.mesh.numberofvertices;i++)if(data[i]>bounds[1])data[i]=bounds[1]; 185 for(var i=0;i<md.mesh.numberofvertices;i++)if(data[i]<=0){ 186 throw Error("Log option cannot be applied on negative values. Use caxis option (Rignot''s settings: [1.5 max(data)])"); 187 } 182 188 for(var i=0;i<md.mesh.numberofvertices;i++){ 183 data[i]=Math.log (data[i])/log(options.getfieldvalue('log'));189 data[i]=Math.log10(data[i])/Math.log10(options.getfieldvalue('log')); 184 190 } 185 191 } -
issm/trunk-jpl/src/m/plot/webgl.js
r19739 r19741 118 118 119 119 value = clamp(value, min + 1.0, max); 120 var use_log_scale = false; 121 if (use_log_scale == true) { 122 var normalizedValue = Math.log(value - min) / Math.log(max - min); 123 } 124 else { 125 var normalizedValue = (value - min) / (max - min); 126 } 120 var normalizedValue = (value - min) / (max - min); 127 121 var index = clamp(Math.round(normalizedValue * colorbar.length), 0, colorbar.length - 1); 128 122 return colorbar[index];
Note:
See TracChangeset
for help on using the changeset viewer.