📄 getbathymetry.m
字号:
function theResult = getbathymetry(self, theBathymetryFile)% seagrid/getbathymetry -- Load and plot a bathymetry file.% getbathymetry(self, 'theBathymetryFile') loads and plots% the given bathymetry file on behalf of self, a "seagrid"% object. If no filename is given, the current bathymetry% filename in self is used. If a Mat-file, the variables% are expected to be "xbathy" (latitude), "ybathy" (longitude),% "zbathy" (arbitrary units, positive downwards). If an% ascii file with three columns, the arrangement is expected% to be [xbathy ybathy zbathy]. % Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.% All Rights Reserved.% Disclosure without explicit written consent from the% copyright owner does not constitute publication. % Version of 27-Apr-1999 08:48:25.% Updated 11-Dec-2000 15:11:15.if nargout > 0, theResult = self; endif nargin < 1, help(mfilename), return, endif nargin < 2 theBathymetryFile = psget(self, 'itsBathymetryFile');endif ~isempty(theBathymetryFile) & ~any(theBathymetryFile == filesep) theBathymetryFile = which(theBathymetryFile);endpsset(self, 'itsBathymetryFile', theBathymetryFile)if isempty(theBathymetryFile), return, endokay = 0;xbathy = [];ybathy = [];zbathy = [];s = load(theBathymetryFile);switch class(s)case 'double' if size(s, 2) == 3 % Three columns. xbathy = s(:, 1); ybathy = s(:, 2); zbathy = s(:, 3); okay = 1; endcase 'struct' try xbathy = s.xbathy; ybathy = s.ybathy; zbathy = s.zbathy; okay = 1; catch endendif ~okay disp([' ## Not a valid bathymetry file: ' theBathymetryFile]) returnendtheBathymetryColor = psget(self, 'itsBathymetryColor');theButtonDownFcn = get(gca, 'ButtonDownFcn');h = findobj('Type', 'line', 'Tag', 'bathymetry');if any(h), delete(h), endtheProjection = psget(self, 'itsProjection');switch theProjectioncase {'none', 'Geographic'} theProjection = 'Geographic'; x = xbathy; y = ybathy;otherwise sg_proj(theProjection) [x, y] = sg_ll2xy(xbathy, ybathy);endhold onz = -zbathy;h = plot3(x, y, z, '.', 'Color', theBathymetryColor, ... 'MarkerSize', 10, 'Tag', 'bathymetry');hold offview(2)zoomsafe 0set([gca h], 'ButtonDownFcn', theButtonDownFcn)self = doupdate(self);if nargout > 0, theResult = self; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -