source: Roms_tools/m_map/m_gshhs.m @ 2

Last change on this file since 2 was 1, checked in by cholod, 13 years ago

import Roms_Agrif

File size: 3.1 KB
Line 
1function m_gshhs(resolution,varargin);
2% M_GSHHS Add a coastline to a given map using
3%           the Global Self-consistant Hierarchical High-resolution
4%           Shorelines, Rivers, and Borders
5%
6%         M_GSHHS(RES, (standard line option,...,...) ) draws the coastline
7%         river network, or borders as  simple lines.
8%
9%         M_GSHHS(RES,'patch' ( ,standard patch options,...,...) ) draws the
10%         coastline as a number of patches (rivers and borders are not
11%         arranged so patches can be drawn).
12%
13%         M_GSHHS(RES,'save',FILENAME) saves the extracted coastline data
14%         for the current projection in a file FILENAME. This allows
15%         speedier replotting using M_USERCOAST(FILENAME).
16%   
17%         RES: A two-char string (optionally 1)
18%         
19%         First char: resolution - one of
20%                      'c'  crude
21%                      'l'  low
22%                      'i'  intermediate
23%                      'h'  high
24%                      'f'  full
25%
26%         Second char: type - one of
27%                      'c' GSHHS coastline (default)
28%                      'b' WDB Border
29%                      'r' WDB River
30
31%         (also maintained is this optional format:
32%
33%         RES - selections resolution
34%                  1  or 'crude'       
35%                  2  or 'low'         
36%                  3  or 'intermediate' 
37%                  4  or 'high'         
38%                  5  or 'full         
39%
40%         but please don't use this).
41%
42%         See also M_PROJ, M_GRID, M_COAST, M_GSHHS_L, M_GSHHS_H, M_GSHHS_C
43%         M_USERCOAST   
44
45% Rich Pawlowicz (rich@ocgy.ubc.ca) 15/June/98
46%
47%
48% This software is provided "as is" without warranty of any kind. But
49% it's mine, so you can't sell it.
50%
51%  16/Dec/2005
52%*********************************************************************
53%  Modified after code provided by Bruce Lipphardt (brucel@udel.edu) to
54%  reduce the hierarchy of M_GSHHS_* routines to a single routine with a
55%  variable resolution input:
56% 20/Jan/2008 - added borders and rivers from gshhs v1.10
57
58% Root of directories where gshhs_X.b files live
59FILNAME='private/';
60
61
62res_list = char('c','l','i','h','f') ;
63typ_list=char('c','b','r');
64typ_names={'gshhs_','wdb_borders_','wdb_rivers_'};
65
66typ=1;
67if isstr(resolution),
68 if length(resolution)>=2,
69   typ = strmatch(lower(resolution(2)),typ_list);
70 end; 
71 resolution = strmatch(lower(resolution(1)),res_list);
72end;
73 
74 
75if isempty(resolution) | resolution<1 | resolution> length(res_list),
76  error('**Don''t recognize the specified resolution');
77end;
78if isempty(typ) | typ<1 | typ> length(res_list),
79  error('**Don''t recognize the specified type');
80end;
81 
82res_char = res_list(resolution) ;
83file     = [FILNAME,sprintf('%s%s.b',typ_names{typ},res_char)] ;
84tag_name = sprintf('%s%s',typ_names{typ},res_char) ;
85
86
87% Set current projection to geographic
88Currentmap=m_coord('set');
89m_coord('geographic');
90
91
92if length(varargin)>1 & strcmp(varargin{1},'save'),
93  [ncst,Area,k]=mu_coast(res_char,file);
94  eval(['save ' varargin{2} ' ncst k Area']);
95else
96  mu_coast(res_char,file,varargin{:},'tag',tag_name);
97end;
98
99m_coord(Currentmap.name);
100
Note: See TracBrowser for help on using the repository browser.