source: issm/oecreview/Archive/12321-12677/ISSM-12373-12374.diff@ 12679

Last change on this file since 12679 was 12679, checked in by Mathieu Morlighem, 13 years ago

Added 12321-12677

File size: 4.9 KB
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_manager.m

     
    167167        return;
    168168end
    169169
     170%Figure out if this is a Profile plot
     171if exist(options,'profile')
     172        plot_profile(md,data,options,nlines,ncols,i);
     173        return;
     174end
     175
    170176%process data and model
    171177[x y z elements is2d isplanet]=processmesh(md,data,options);
    172178[data2 datatype]=processdata(md,data,options);
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_profile.m

     
     1function plot_profile(md,data,options,nlines,ncols,i)
     2%PLOT_SECTION - plot a given field on a profile
     3%
     4%   Usage:
     5%      plot_profile(md,data,options,nlines,ncols,i)
     6%
     7%   See also: PLOTMODEL
     8
     9%process model
     10[x_m y_m z_m elements_m is2d isplanet]=processmesh(md,[],options);
     11if ~is2d, error('only 3d model supported'); end
     12
     13%Get number of curves and generate random colors
     14numcurves=size(data,2);
     15colorm=getfieldvalue(options,'colormap','lines');
     16color=eval([ colorm '(numcurves);']);
     17options=removefield(options,'colormap',0); %back to default colormap
     18
     19%Loop over number of curves
     20for i=1:numcurves,
     21
     22        %Process data
     23        [datai datatype]=processdata(md,data(:,i),options);
     24
     25        %resolution
     26        if exist(options,'resolution'),
     27                resolution=getfieldvalue(options,'resolution');
     28        else %Default resolution
     29                resolution=[100];
     30                disp(['plot_profile warning: no resolution specified, use default resolution: [horizontal_resolution vertical_resolution]=[' num2str(resolution)  ']']);
     31        end
     32
     33        %Compute profile value
     34        [z,data_interp]=ProfileValues(md,data,xprof,yprof,resolution)
     35
     36        %plot profile
     37        subplot(nlines,ncols,i)
     38        A=elements(:,1); B=elements(:,2); C=elements(:,3);  D=elements(:,4);
     39        plot(data_interp,z,'color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1));
     40        hold on;
     41end
     42
     43%apply options
     44options=addfielddefault(options,'title','Profile');
     45options=addfielddefault(options,'colorbar',0);
     46options=addfielddefault(options,'ylabel','z');
     47applyoptions(md,[],options);
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plotdoc.m

     
    9393disp('                       horizontal_resolution must be in meter, and vertical_resolution a number of layers');
    9494disp('       ''showsection'': show section used by ''sectionvalue'' (string ''on'' or a number of labels)');
    9595disp('       ''sectionvalue'': give the value of data on a profile given by an Argus file (string ''Argusfile_name.exp'')');
     96disp('       ''profile'': give the value of data along a vertical profile ([xlocation ylocation])');
    9697disp('       ''smooth'': smooth element data (string ''yes'' or integer)');
    9798disp('       ''title'': same as standard matlab option');
    9899disp('       ''view'': same as standard matlab option (ex: 2, 3 or [90 180]');
  • u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/ProfileValues.m

     
     1function [Z,data_interp]=ProfileValues(md,data,xprof,yprof,resolution)
     2%PROFILEVALUES - compute the value of a field on a vertical profile
     3%
     4%   This routine gets the value of a given field of the model on points
     5%   given by filname (Argus type file)
     6%
     7%   Usage:
     8%      [z,data]=ProfileValues(md,data,filename,resolution)
     9%      [z,data]=ProfileValues(md,data,profile_structure,resolution)
     10
     11%Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system
     12offset=10^-3;
     13bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.bed,1),xprof,yprof)+offset;
     14surface=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.surface,1),xprof,yprof)-offset;
     15
     16%Some useful parameters
     17layers=ceil(mean(md.geometry.thickness)/res_v);
     18Z=bed:resolution:surface;
     19X=xprof*ones(size(Z));
     20Y=yprof*ones(size(Z));
     21data_interp=InterpFromMeshToMesh3d(md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.z,data,X,Y,Z,NaN);
Note: See TracBrowser for help on using the repository browser.