[12679] | 1 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_manager.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_manager.m (revision 12373)
|
---|
| 4 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_manager.m (revision 12374)
|
---|
| 5 | @@ -167,6 +167,12 @@
|
---|
| 6 | return;
|
---|
| 7 | end
|
---|
| 8 |
|
---|
| 9 | +%Figure out if this is a Profile plot
|
---|
| 10 | +if exist(options,'profile')
|
---|
| 11 | + plot_profile(md,data,options,nlines,ncols,i);
|
---|
| 12 | + return;
|
---|
| 13 | +end
|
---|
| 14 | +
|
---|
| 15 | %process data and model
|
---|
| 16 | [x y z elements is2d isplanet]=processmesh(md,data,options);
|
---|
| 17 | [data2 datatype]=processdata(md,data,options);
|
---|
| 18 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_profile.m
|
---|
| 19 | ===================================================================
|
---|
| 20 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_profile.m (revision 0)
|
---|
| 21 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plot_profile.m (revision 12374)
|
---|
| 22 | @@ -0,0 +1,47 @@
|
---|
| 23 | +function plot_profile(md,data,options,nlines,ncols,i)
|
---|
| 24 | +%PLOT_SECTION - plot a given field on a profile
|
---|
| 25 | +%
|
---|
| 26 | +% Usage:
|
---|
| 27 | +% plot_profile(md,data,options,nlines,ncols,i)
|
---|
| 28 | +%
|
---|
| 29 | +% See also: PLOTMODEL
|
---|
| 30 | +
|
---|
| 31 | +%process model
|
---|
| 32 | +[x_m y_m z_m elements_m is2d isplanet]=processmesh(md,[],options);
|
---|
| 33 | +if ~is2d, error('only 3d model supported'); end
|
---|
| 34 | +
|
---|
| 35 | +%Get number of curves and generate random colors
|
---|
| 36 | +numcurves=size(data,2);
|
---|
| 37 | +colorm=getfieldvalue(options,'colormap','lines');
|
---|
| 38 | +color=eval([ colorm '(numcurves);']);
|
---|
| 39 | +options=removefield(options,'colormap',0); %back to default colormap
|
---|
| 40 | +
|
---|
| 41 | +%Loop over number of curves
|
---|
| 42 | +for i=1:numcurves,
|
---|
| 43 | +
|
---|
| 44 | + %Process data
|
---|
| 45 | + [datai datatype]=processdata(md,data(:,i),options);
|
---|
| 46 | +
|
---|
| 47 | + %resolution
|
---|
| 48 | + if exist(options,'resolution'),
|
---|
| 49 | + resolution=getfieldvalue(options,'resolution');
|
---|
| 50 | + else %Default resolution
|
---|
| 51 | + resolution=[100];
|
---|
| 52 | + disp(['plot_profile warning: no resolution specified, use default resolution: [horizontal_resolution vertical_resolution]=[' num2str(resolution) ']']);
|
---|
| 53 | + end
|
---|
| 54 | +
|
---|
| 55 | + %Compute profile value
|
---|
| 56 | + [z,data_interp]=ProfileValues(md,data,xprof,yprof,resolution)
|
---|
| 57 | +
|
---|
| 58 | + %plot profile
|
---|
| 59 | + subplot(nlines,ncols,i)
|
---|
| 60 | + A=elements(:,1); B=elements(:,2); C=elements(:,3); D=elements(:,4);
|
---|
| 61 | + plot(data_interp,z,'color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1));
|
---|
| 62 | + hold on;
|
---|
| 63 | +end
|
---|
| 64 | +
|
---|
| 65 | +%apply options
|
---|
| 66 | +options=addfielddefault(options,'title','Profile');
|
---|
| 67 | +options=addfielddefault(options,'colorbar',0);
|
---|
| 68 | +options=addfielddefault(options,'ylabel','z');
|
---|
| 69 | +applyoptions(md,[],options);
|
---|
| 70 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plotdoc.m
|
---|
| 71 | ===================================================================
|
---|
| 72 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plotdoc.m (revision 12373)
|
---|
| 73 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/plot/plotdoc.m (revision 12374)
|
---|
| 74 | @@ -93,6 +93,7 @@
|
---|
| 75 | disp(' horizontal_resolution must be in meter, and vertical_resolution a number of layers');
|
---|
| 76 | disp(' ''showsection'': show section used by ''sectionvalue'' (string ''on'' or a number of labels)');
|
---|
| 77 | disp(' ''sectionvalue'': give the value of data on a profile given by an Argus file (string ''Argusfile_name.exp'')');
|
---|
| 78 | +disp(' ''profile'': give the value of data along a vertical profile ([xlocation ylocation])');
|
---|
| 79 | disp(' ''smooth'': smooth element data (string ''yes'' or integer)');
|
---|
| 80 | disp(' ''title'': same as standard matlab option');
|
---|
| 81 | disp(' ''view'': same as standard matlab option (ex: 2, 3 or [90 180]');
|
---|
| 82 | Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/ProfileValues.m
|
---|
| 83 | ===================================================================
|
---|
| 84 | --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/ProfileValues.m (revision 0)
|
---|
| 85 | +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/m/model/ProfileValues.m (revision 12374)
|
---|
| 86 | @@ -0,0 +1,21 @@
|
---|
| 87 | +function [Z,data_interp]=ProfileValues(md,data,xprof,yprof,resolution)
|
---|
| 88 | +%PROFILEVALUES - compute the value of a field on a vertical profile
|
---|
| 89 | +%
|
---|
| 90 | +% This routine gets the value of a given field of the model on points
|
---|
| 91 | +% given by filname (Argus type file)
|
---|
| 92 | +%
|
---|
| 93 | +% Usage:
|
---|
| 94 | +% [z,data]=ProfileValues(md,data,filename,resolution)
|
---|
| 95 | +% [z,data]=ProfileValues(md,data,profile_structure,resolution)
|
---|
| 96 | +
|
---|
| 97 | +%Get bed and surface for each 2d point, offset to make sure that it is inside the glacier system
|
---|
| 98 | +offset=10^-3;
|
---|
| 99 | +bed=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.bed,1),xprof,yprof)+offset;
|
---|
| 100 | +surface=InterpFromMeshToMesh2d(md.mesh.elements2d,md.mesh.x2d,md.mesh.y2d,project2d(md,md.geometry.surface,1),xprof,yprof)-offset;
|
---|
| 101 | +
|
---|
| 102 | +%Some useful parameters
|
---|
| 103 | +layers=ceil(mean(md.geometry.thickness)/res_v);
|
---|
| 104 | +Z=bed:resolution:surface;
|
---|
| 105 | +X=xprof*ones(size(Z));
|
---|
| 106 | +Y=yprof*ones(size(Z));
|
---|
| 107 | +data_interp=InterpFromMeshToMesh3d(md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.z,data,X,Y,Z,NaN);
|
---|