Changeset 20511
- Timestamp:
- 04/14/16 19:12:45 (9 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/applyoptions.js
r20401 r20511 11 11 if (options.getfieldvalue('colorbar')==1) { 12 12 //Handle movie data {{{ 13 if (typeof data == 'string') {13 if (typeof data == 'string') { 14 14 //throw Error('plot error message: data of type string'); 15 15 return; … … 25 25 }) 26 26 }); 27 data = data[ node['movieFrame']].slice(0,-1);27 data = data[0].slice(0,-1); 28 28 } //}}} 29 29 //Variable options initialization {{{ 30 30 31 var caxis = options.getfieldvalue('caxis',[ArrayMin(data),ArrayMax(data)]); 32 //if (options.exist('log')) options.changefieldvalue('caxis',[ArrayMin(data),ArrayMax(data)]); 31 33 var canvassize = options.getfieldvalue('canvassize',480); 32 34 var cheight; … … 49 51 if (options.exist('log')) { 50 52 for (var i = cdivisions; i >= 0; i--) { 51 if (caxisdelta*i/cdivisions== min) {53 if (caxisdelta*i/cdivisions==caxis[0]) { 52 54 labels[i] = (caxis[0]).toPrecision(precision); 53 55 } 54 56 else { 55 labels[i] = (Math.exp(Math.log(caxisdelta)* i/cdivisions)+caxis[0]).toPrecision(precision);56 } 57 labels[i] = (Math.exp(Math.log(caxisdelta)*(cdivisions-i)/cdivisions)+caxis[0]).toPrecision(precision); 58 } 57 59 } 58 60 } else { … … 228 230 var cmap = options.getfieldvalue('cmap','jet'); 229 231 var colorbar = colorbars[cmap]; 230 for (var i = 0; i < colorbar.length; i++) { 231 color = colorbar[colorbar.length-i-1]; 232 color = [Math.round(color[0]*255),Math.round(color[1]*255),Math.round(color[2]*255)]; 233 tgradient.addColorStop(i/colorbar.length,'rgba('+color.toString()+',1.0)'); 232 if (options.exist('log')) { 233 for (var i = 0; i < colorbar.length; i++) { 234 color = colorbar[colorbar.length-i-1]; 235 color = [Math.round(color[0]*255),Math.round(color[1]*255),Math.round(color[2]*255)]; 236 tgradient.addColorStop(1.0-Math.exp(Math.log((colorbar.length-i)/colorbar.length)/Math.log(options.getfieldvalue('log',Math.E))*i/colorbar.length),'rgba('+color.toString()+',1.0)'); 237 } 238 } else { 239 for (var i = 0; i < colorbar.length; i++) { 240 color = colorbar[colorbar.length-i-1]; 241 color = [Math.round(color[0]*255),Math.round(color[1]*255),Math.round(color[2]*255)]; 242 tgradient.addColorStop(i/colorbar.length,'rgba('+color.toString()+',1.0)'); 243 } 234 244 } 235 245 -
issm/trunk-jpl/src/m/plot/plot_unit.js
r20473 r20511 96 96 else{ //triangular elements 97 97 caxis = options.getfieldvalue('caxis',[ArrayMin(data),ArrayMax(data)]); 98 if (options.exist('log')) caxis = [Math.log10(caxis[0])/Math.log10(options.getfieldvalue('log')),Math.log10(caxis[1])/Math.log10(options.getfieldvalue('log'))]; 98 99 datamin = caxis[0]; 99 100 datamax = caxis[1]; … … 196 197 }) 197 198 }); 198 199 for(var i = 0; i < data.length; i++){ 200 //Prevent evaluation of datasubarray min/max if caxis exists 201 if (options.exist('caxis')) { 202 caxis = options.getfieldvalue('caxis'); 203 } 204 else { 205 caxis = [ArrayMin(data[i]),ArrayMax(data[i].slice(0,-1))]; 206 } 199 //Prevent evaluation of datasubarray min/max if caxis exists 200 if (options.exist('caxis')) { 201 caxis = options.getfieldvalue('caxis'); 202 } 203 else { 204 caxis = [ArrayMin(data[0]),ArrayMax(data[0].slice(0,-1))]; 205 } 206 if (options.exist('log')) caxis = [Math.log10(caxis[0])/Math.log10(options.getfieldvalue('log')),Math.log10(caxis[1])/Math.log10(options.getfieldvalue('log'))]; 207 208 for(var i = 0; i < data.length; i++){ 207 209 datamin = caxis[0]; 208 210 datamax = caxis[1]; -
issm/trunk-jpl/src/m/plot/processdata.js
r19888 r20511 191 191 throw Error("Log option cannot be applied on negative values. Use caxis option (Rignot''s settings: [1.5 max(data)])"); 192 192 } 193 193 for(var i=0;i<md.mesh.numberofvertices;i++){ 194 194 data[i]=Math.log10(data[i])/Math.log10(options.getfieldvalue('log')); 195 195 } 196 196 } 197 197 } … … 200 200 if (datasize==md.mesh.numberofvertices+1){ 201 201 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 } 202 229 } 203 230
Note:
See TracChangeset
for help on using the changeset viewer.