processdata

PURPOSE ^

PROCESSDATA - process data to be plotted

SYNOPSIS ^

function [data isongrid]=processdata(md,data,options_structure);

DESCRIPTION ^

PROCESSDATA - process data to be plotted

   Usage:
      [data isongrid]=processdata(md,data,options_structure);

   See also: PLOTMODEL, PROCESSMESH

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [data isongrid]=processdata(md,data,options_structure);
0002 %PROCESSDATA - process data to be plotted
0003 %
0004 %   Usage:
0005 %      [data isongrid]=processdata(md,data,options_structure);
0006 %
0007 %   See also: PLOTMODEL, PROCESSMESH
0008 
0009 %some checks
0010 if length(data)~=md.numberofgrids & length(data)~=md.numberofelements & length(data)~=md.numberofgrids*6
0011     error('plotmodel error message: data not supproted yet')
0012 end
0013 
0014 %6*grid data
0015 if length(data)==6*md.numberofgrids
0016     %keep the only norm of data
0017     data1=data(1:6:md.numberofgrids*6);
0018     data2=data(2:6:md.numberofgrids*6);
0019     data=sqrt(data1.^2+data2.^2);
0020     %---> go to grid data
0021 end
0022 
0023 %smoothing?
0024 if ~isnan(options_structure.smooth)
0025     data=averaging(md,data,options_structure.smooth);
0026     %---> go to grid data
0027 end
0028 
0029 %element data
0030 if length(data)==md.numberofelements;
0031     isongrid=0;
0032 
0033     %ice sheet only?
0034     if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
0035         data(find(md.elementoniceshelf))=NaN;
0036     end
0037     %ice shelf only?
0038     if ~isnan(options_structure.noicesheet) & options_structure.noicesheet,
0039         data(find(~md.elementoniceshelf))=NaN;
0040     end
0041 end
0042 
0043 %grid data
0044 if length(data)==md.numberofgrids
0045     isongrid=1;
0046     %ice sheet only?
0047     if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
0048         pos=find(md.gridoniceshelf);
0049         data(pos)=NaN;
0050     end
0051     %ice shelf only?
0052     if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,
0053         pos=find(md.gridonicesheet);
0054         data(pos)=NaN;
0055     end
0056 end
0057 
0058 %layer projection?
0059 if ~isnan(options_structure.layer) & options_structure.layer>=1,
0060     data=project2d(md,data,options_structure.layer); %project onto 2d mesh
0061 end
0062 
0063

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003