Ignore:
Timestamp:
01/19/22 06:58:30 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added handy output for contourlevelzero

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/exp/contourlevelzero.m

    r26221 r26792  
    1 function contours=contourlevelzero(md,mask,level)
     1function contours=contourlevelzero(md,mask,level,varargin)
    22%CONTOURLEVELZERO - figure out the zero level (or offset thereof, specified by the level value)
    33%                   of a vectorial mask, and vectorialize it into an exp or shp compatible
     
    77%      contours=contourlevelzero(md,mask,level)
    88%
     9%   Example:
     10%      contours=contourlevelzero(md, md.results.TransientSolution(end).MaskOceanLevelset,0);
     11%      contours=contourlevelzero(md, md.results.TransientSolution(end).MaskOceanLevelset,0,'output','vector');
     12%
     13%   Supported options:
     14%      'output': either 'matrix' (with NaN delimiters) or 'struct' (default)
     15%
    916%   See also: PLOT_CONTOUR
     17
     18%Process options
     19options = pairoptions(varargin{:});
    1020
    1121%process data
     
    228238
    229239end
     240
     241%process output
     242if strcmp(getfieldvalue(options,'output',1),'matrix')
     243        x = cell2mat(cellfun(@(x) [x;NaN],{contours(:).x},'UniformOutput',0)');
     244        y = cell2mat(cellfun(@(x) [x;NaN],{contours(:).y},'UniformOutput',0)');
     245
     246        contours = [x y];
     247end
Note: See TracChangeset for help on using the changeset viewer.