- 积分
- 70
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-3-16
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2019-6-1 19:59:30
|
显示全部楼层
本帖最后由 Isakting 于 2019-6-1 20:02 编辑
这个是我的m_gshhs.m 脚本文件,其中我认为需要修改的地方已经加粗标红
- function h=m_gshhs(resolution,varargin)
- % M_GSHHS Add a coastline to a given map using
- % the Global Self-consistant Hierarchical High-resolution
- % Shorelines, Rivers, and Borders
- %
- % M_GSHHS(RES, (standard line option,...,...) ) draws the coastline
- % river network, or borders as simple lines.
- %
- % M_GSHHS(RES,'patch' ( ,standard patch options,...,...) ) draws the
- % coastline as a number of patches (rivers and borders are not
- % arranged so patches can be drawn).
- %
- % M_GSHHS(RES,'save',FILENAME) saves the extracted coastline data
- % for the current projection in a file FILENAME. This allows
- % speedier replotting using M_USERCOAST(FILENAME).
- %
- % RES: A one-char string (optionally 2 or 3)
- %
- % First char: resolution - one of
- % 'c' crude
- % 'l' low
- % 'i' intermediate
- % 'h' high
- % 'f' full
- %
- % Second char: type - one of
- % 'c' GSHHS coastline (default)
- % 'b' WDB Border
- % 'r' WDB River
- %
- % Third char - if 2nd char is 'b':
- % '1' Country borders
- % '2' State/Province and Country borders
- % - if 2nd char is 'r': '1','2','3','4'
- % add successively more tributaries
- %
- % (also maintained is this optional format:
- %
- % RES - selections resolution
- % 1 or 'crude'
- % 2 or 'low'
- % 3 or 'intermediate'
- % 4 or 'high'
- % 5 or 'full
- %
- % but please don't use this).
- %
- % See also M_PROJ, M_GRID, M_COAST, M_GSHHS_L, M_GSHHS_H, M_GSHHS_C
- % M_USERCOAST
- % Rich Pawlowicz (rich@ocgy.ubc.ca) 15/June/98
- %
- %
- % This software is provided "as is" without warranty of any kind. But
- % it's mine, so you can't sell it.
- %
- % 16/Dec/2005
- %*********************************************************************
- % Modified after code provided by Bruce Lipphardt (brucel@udel.edu) to
- % reduce the hierarchy of M_GSHHS_* routines to a single routine with a
- % variable resolution input:
- % 20/Jan/2008 - added borders and rivers from gshhs v1.10
- % 4/DEc/11 - isstr to ischar
- % Sep/14 - added hierarchy to borders
- % Aug/18 - fixed error that occurred when called m_gshhs_X with 'save'
- % option (Thanks to H. Grant for pointing this out).
- % Root of directories where all the gshhs_X.b, wdb_borders-X.b and wdb_rivers_X.b
- % files live
- <font color="#ff0000"><b>FILNAME='private/';</b></font>
- %-------------don't change below here----------------------------
- res_list = {'c','l','i','h','f'};
- typ_list={'c','b','r'};
- typ_names={'gshhs_','wdb_borders_','wdb_rivers_'};
- typ=1;
- flaglim='9';
- if ischar(resolution)
- if length(resolution)>=2
- typ = find(strcmpi(resolution(2),typ_list));
- end
- if length(resolution)>=3
- flaglim = resolution(3);
- end
- resolution = find(strcmpi(resolution(1),res_list));
- end
-
-
- if isempty(resolution) || resolution<1 || resolution> length(res_list)
- error('**Don''t recognize the specified resolution');
- end
- if isempty(typ) || typ<1 || typ> length(res_list)
- error('**Don''t recognize the specified type');
- end
-
- res_char = res_list{resolution} ;
- file = [FILNAME,sprintf('%s%s.b',typ_names{typ},res_char)] ;
- tag_name = sprintf('m_%s%s',typ_names{typ},res_char) ;
- % Set current projection to geographic
- Currentmap=m_coord('set');
- m_coord('geographic');
- if length(varargin)>1 && strcmp(varargin{1},'save')
- [ncst,Area,k]=mu_coast(res_char,file);
- save(varargin{2},'ncst','k','Area');
- h=varargin{2}; % Error if you call m_gshhs_i with 'save' option - thanks HG, Aug/1/2018
- else
- h=mu_coast([res_char flaglim],file,varargin{:},'tag',tag_name);
- end
- m_coord(Currentmap.name);
- if nargout==0
- clear h
- end
复制代码
这个是我的m_gshhs_i.m脚本文件- function h=m_gshhs_i(varargin)
- % M_GSHHS_I Add a coastline to a given map using the 'intermediate' resolution of
- % the Global Self-consistant Hierarchical High-resolution
- % Shorelines.
- %
- % M_GSHHS_I( (standard line option,...,...) ) draws the coastline
- % as a simple line.
- % M_GSHHS_I('patch' ( ,standard patch options,...,...) ) draws the
- % coastline as a number of patches.
- %
- % M_GSHHS_I('save',FILENAME) saves the extracted coastline data
- % for the current projection in a file FILENAME. This allows
- % speedier replotting using M_USERCOAST(FILENAME).
- %
- % See also M_PROJ, M_GRID, M_COAST, M_GSHHS_L, M_GSHHS_H, M_GSHHS_C
- % M_USERCOAST
- % Rich Pawlowicz (rich@ocgy.ubc.ca) 15/June/98
- %
- %
- % This software is provided "as is" without warranty of any kind. But
- % it's mine, so you can't sell it.
- % Changes
- % Nov/2017 - changed this into a stub calling gshhs.m (kept
- % for backwards compatability)
- h=m_gshhs('ic',varargin{:});
复制代码
m_gshhs_*.m 其他分辨率的gshhs脚本也和第二个类似,应该是m_gshhs.m来调用对应分辨率的脚本吧?
|
|