-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathmap.html
595 lines (591 loc) · 30.8 KB
/
map.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR"
content="Mozilla/4.05 [en] (X11; I; Linux 2.0.34 i686) [Netscape]">
<title>M_Map: A Mapping package for Matlab</title>
</head>
<body bgcolor="#fff5ee">
<center>
<h1> M_Map: A mapping package for <a href="http://www.mathworks.com">Matlab</a></h1>
</center>
<hr>
<center><img src="./private/mlogo.gif" nosave="" height="216"
width="216"> </center>
<p> </p>
<hr>
<p>You have collected your data, loaded it into <a
href="http://www.mathworks.com">Matlab </a>, analyzed everything to
death, and now you want to make a simple map showing how it relates to
the world. </p>
<p>But you can't. </p>
<p>Instead you have to figure out how to save all your data, and then
read it into another program (like, for example <a
href="http://gmt.soest.hawaii.edu">GMT </a>), and then spend all that
extra
time figuring out why it doesn't give you what you expected it
would...or
you can invest in Matlab's own mapping toolbox (with a similarly steep
learning
curve)... or not! </p>
<p></p>
<hr ,="" width="5">
<center>
<h4> Announcing M_Map v1.4f! (updated Dec/2011)</h4>
</center>
<table align="center" border="1" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td align="center" valign="middle"><a href="#1._M_Map_Logo"><img
src="private/thumb_mlogo.gif" alt="" height="108" width="108"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#2._Lambert_Conformal_Conic_projection_of"><img
src="private/thumb_exlamber.gif" alt="" height="73" width="119"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#3._Stereographic_projection_of_North"><img
src="private/thumb_exster.gif" alt="" height="99" width="100"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#4._Two_Interrupted_Projections_of_the"><img
src="private/thumb_exsinus.gif" alt="" height="125" width="121"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#5._Oblique_Mercator_Projection_with"><img
src="private/thumb_exquiv.gif" alt="" height="78" width="124"> </a><br>
</td>
</tr>
<tr>
<td align="center" valign="middle"><a
href="#6._Miller_Projection_with_Great_Circle"><img
src="private/thumb_exmiller.gif" alt="" height="77" width="124"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#7._Lambert_Conformal_Projection_with_Med"><img
src="private/thumb_extbase.gif" alt="" height="79" width="124"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#8._Demonstration_of_fancy_vectors"><img
src="private/thumb_exvec.gif" alt="" height="126" width="99"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#9._Zoom_in_on_Prince_Edward_Island_to_co"><img
src="private/thumb_exgshhs.gif" alt="" height="108" width="144"> </a><br>
</td>
<td align="center" valign="middle"><a
href="#10._Tracklines_and_UTM_projection"><img
src="private/thumb_track1.gif" alt="" height="137" width="135"> </a><br>
</td>
</tr>
<tr>
<td align="center" valign="middle"><a href="#11._Range_rings"><img
src="private/thumb_rring.gif" alt="" height="64" width="113"> </a><br>
</td>
<td align="center" valign="middle"><a href="#12._Speckle"><img
src="private/thumb_extspeckle.gif" alt="" height="64" width="113"> </a><img
src="./private/new.gif"><br>
</td>
<td align="center" valign="middle"><a href="#13._Blueocean"><img
src="private/thumb_extblueocean.gif" alt="" height="64" width="113"> </a><img
src="./private/new.gif"><br>
</td>
<td align="center" valign="middle"><br>
</td>
<td align="center" valign="middle"><br>
</td>
</tr>
<tr>
<td align="center" valign="middle"><a
href="map.html#1._Global_SST"><img src="private/thumb_ex_sst.gif"
alt="" height="94" width="138"></a><br>
<a href="map.html#1._Global_SST"> </a></td>
<td align="center" valign="middle"> <a
href="map.html#2._SSMI_Ice_cover"><img src="private/thumb_ex_ssmi.gif"
alt="" height="103" width="130"></a><br>
<a href="map.html#2._SSMI_Ice_cover"> </a></td>
<td align="center" valign="middle"><a
href="map.html#3._Aerial_photos"><img src="private/thumb_ex_terra.gif"
alt="" height="100" width="135"></a><a href="map.html#3._Aerial_photos">
</a></td>
<td align="center" valign="middle"><a
href="map.html#4._A_subset_of_a_global_dataset"><img
src="private/thumb_ex_modis.gif" alt="" height="99" width="135"></a><a
href="map.html#4._A_subset_of_a_global_dataset"> </a></td>
<td align="center" valign="middle"><br>
</td>
</tr>
</tbody>
</table>
<hr ,="" width="5">M_Map is a set of mapping tools written for Matlab
v5 and later. These include:
<ol>
<li> Routines to project data in 19 different spherical projections
(and determine inverse mappings)</li>
<li> A grid generation routine to make nice axes with limits either
in lat/long terms or in planar X/Y terms.</li>
<li> A coastline database (with 1/4 degree resolution)</li>
<li> A global elevation database (1 degree resolution)</li>
<li> Hooks into freely available high-resolution coastline and
bathymetry databases</li>
</ol>
<center> </center>
New in release 1.4f are<br>
<ol>
<li>m_shaperead.m to read SHAPEFILES! (so <a href="http://www.naturalearthdata.com/">Natural Earth</a> can be
used for political boundaries instead of DCW, among other opportunities) </li>
<li>gshhs version 2 support</li>
<li> partial OCTAVE compatibility </li>
</ol>
New in release 1.4e are<br>
<ol>
<li>GSHHS Now comes with the WDB rivers and borders database, and
links to them have been added via m_gshhs.m </li>
<li>Ellipsoidal Albers and Lambert conic projections included </li>
</ol>
New in release 1.4d are<br>
<ol>
<li>Modifications to work around bugs in matlab7 contourf </li>
<li>Robinson projection</li>
<li>A few compatibility issues with current matlab versions
<li>Upgraded hooks into some databases.
</ol>
New in release 1.4b are<br>
<ol>
<li>m_hatch for hatched and speckled patches</li>
<li>old-fashioned speckled coastlines (good for B&W pics - see <a
href="#12._Speckle">Example 13</a>).<br>
</li>
<li>m_lldist now also returns points on great circle geodesics.</li>
<li>m_fdist, m_idist, and m_geodesic for geodesics on an ellipsoidal
earth.<br>
</li>
</ol>
New in release 1.4 are<br>
<ol>
<li>m_pcolor</li>
<li>m_coord (to allow for geographic and geomagnetic coordinate
systems)</li>
<li>A very few minor bug fixes.</li>
<li>Some hints about and examples of adding satellite image data to
your
maps.<br>
</li>
</ol>
<p></p>
<ol>
</ol>
<hr>
<h2> <a name="download"></a>How to get M_Map</h2>
You can download the M_Map toolbox either as a <a
href="http://www.eos.ubc.ca/%7Erich/m_map1.4.tar.gz">gzipped tar-file </a>,
or as <a href="http://www.eos.ubc.ca/%7Erich/m_map1.4.zip">zip archive
</a>(Click on these links to download). If you are unpacking the zip
file MAKE SURE YOU
ALSO UNPACK SUBDIRECTORIES! Both are around 650k in size. Once you have
this
archive, read the <a href="private/mapug.html#p1">Getting started </a>section
of the <a href="private/mapug.html">User's guide </a>to correctly
install this toolbox, and sections <a href="private/mapug.html#p9">9</a>
and <a href="private/mapug.html#p9.6">10.1</a> to install TerrainBase
and GSHHS respectively.
<p>A number of <a href="#examples">examples</a> have been given to
highlight the various capabilities of M_Map (thumbnails are shown
above). </p>
<p>You can also get <b>m_namebox </b>(a set of utilities for
automatically adding names to your map), through its home page at
<a href="http://www.nersc.no/%7Eeven/matlab/m_namebox/m_namebox.html">http://www.nersc.no/~even/
.</a> </p>
<p> </p>
<hr>
<h2> <a href="private/mapug.html">User's guide</a></h2>
<ol>
<li> <a href="private/mapug.html#p1">Getting started</a></li>
<li> <a href="private/mapug.html#p2">Specifying projections</a></li>
<ol>
<li> <a href="private/mapug.html#p2.1">Azimuthal projections</a></li>
<li> <a href="private/mapug.html#p2.2">Cylindrical and
Pseudo-cylindrical projections</a></li>
<li> <a href="private/mapug.html#p2.3">Conic projections</a></li>
<li> <a href="private/mapug.html#p2.4">Miscellaneous global
projections</a></li>
<li> <a href="private/mapug.html#p2.5">Yeah, but which projection
should I use?</a></li>
<li> <a href="private/mapug.html#p2.6">Map scales</a></li>
<li><a href="./private/mapug.html#p2.7">Map coordinate systems
-geographic and geomagnetic</a> <br>
</li>
</ol>
<li> <a href="private/mapug.html#p3">Coastlines and Bathymetry</a></li>
<ol>
<li> <a href="private/mapug.html#p3.1">Coastline options</a> </li>
<li> <a href="private/mapug.html#p3.2">Topography/Bathymetry
options</a></li>
</ol>
<li> <a href="private/mapug.html#p4">Customizing the axes</a></li>
<ol>
<li> <a href="private/mapug.html#p4.1">Grid lines and labels</a></li>
<li> <a href="private/mapug.html#p4.2">Titles and x/ylabels</a></li>
<li> <a href="private/mapug.html#p4.3">Legend Boxes </a></li>
<li> <a href="private/mapug.html#p4.4">Scale bar </a><img src="./private/new.gif"></li>
</ol>
<li> <a href="private/mapug.html#p5">Adding your own data</a></li>
<ol>
<li> <a href="private/mapug.html#p5.3">Drawing lines, text,
arrows, patches, hatches, speckles, and contours</a> </li>
<li><a href="private/mapug.html#p5.2new">Drawing images and p_color
</a> </li>
<li> <a href="private/mapug.html#p5.4">Drawing tracklines</a></li>
<li> <a href="private/mapug.html#p5.5">Drawing range rings and
geodesics</a></li>
<li> <a href="private/mapug.html#p5.1">Converting
longitude/latitude to projection coordinates</a></li>
<li> <a href="private/mapug.html#p5.2">Converting projection
coordinates to longitude/latitude</a></li>
<li> <a href="private/mapug.html#p5.6">Computing distances between
points </a></li>
</ol>
<li> <a href="private/mapug.html#p6">More complex plots</a></li>
<li> <a href="private/mapug.html#p13">Removing data from a plot</a></li>
<li> <a href="private/mapug.html#p7">Adding your own coastlines</a></li>
<ol>
<li> <a href="private/mapug.html#p7.1">DCW political boundaries</a></li>
<li> <a href="private/mapug.html#p7.2">ESRI Shapefiles</a><img src="./private/new.gif"></li>
</ol>
<li> <a href="private/mapug.html#p8">Adding your own
topography/bathymetry</a></li>
<ol>
<li> <a href="private/mapug.html#p8.1">Sandwell and Smith
Bathymetry</a></li>
</ol>
<li> <a href="private/mapug.html#p9">Using TerrainBase 5-minute
or ETOPO2 2-minute global bathymetry/topography </a></li>
<li> <a href="private/mapug.html#p9.5">Using the GSHHS
high-resolution coastline database</a></li>
<ol>
<li> <a href="private/mapug.html#p9.6">Installing GSHHS</a></li>
<li> <a href="private/mapug.html#p9.7">Using GSHHS effectively</a></li>
</ol>
<li> <a href="private/mapug.html#p10">M_Map toolbox contents and
description</a></li>
<li> <a href="private/mapug.html#p11">Known Problems and Bugs</a></li>
<li> <a href="private/mapug.html#p11a">OCTAVE Compatibility Issues</a> <img src="./private/new.gif"></li>
<li> <a href="private/mapug.html#p12">Changes since last
release </a> </li>
</ol>
For information, help, suggestions, or bug reports, contact <a
href="http://www.eos.ubc.ca/people/faculty/pawlowicz/">Rich Pawlowicz </a>,
(<a href="mailto:rich@eos.ubc.ca"> rich@eos.ubc.ca </a>) <br>
<hr> <br>
<h2> Acknowledgements</h2>
A number of people have helped out with suggestions, code fixes,
etc. I am especially grateful for the work done by E. Firing, D.
Byrne, M. Mann, J. Pringle, and J. E. Nilsen who have all
contributed code.
<p> </p>
<hr>
<h2> <a name="examples"></a>Examples</h2>
<h4><a name="1._M_Map_Logo"></a> 1. M_Map Logo</h4>
<pre>m_proj('ortho','lat',48','long',-123');<br>m_coast('patch','r');<br>m_grid('linest','-','xticklabels',[],'yticklabels',[]);<br>patch(.55*[-1 1 1 -1],.25*[-1 -1 1 1]-.55,'w');<br>text(0,-.55,'M\_Map','fontsize',25,'color','b',...<br> 'vertical','middle','horizontal','center');<br>set(gcf,'units','inches','position',[2 2 3 3]);<br>set(gcf,'paperposition',[3 3 3 3]);</pre>
<center><img src="./private/mlogo.gif"> </center>
<h4><a name="2._Lambert_Conformal_Conic_projection_of"></a> <a
name="e2"></a>2.
Lambert Conformal Conic projection of North American Topography</h4>
<pre>m_proj('lambert','long',[-160 -40],'lat',[30 80]);<br>m_coast('patch',[1 .85 .7]);<br>m_elev('contourf',[500:500:6000]);<br>m_grid('box','fancy','tickdir','in');<br>colormap(flipud(copper));</pre>
<center><img src="./private/exlamber.gif"> </center>
<h4><a name="3._Stereographic_projection_of_North"></a> 3.
Stereographic
projection of North Polar regions</h4>
<pre>% Note that coastline is drawn OVER the grid because of the order in which<br>% the two routines are called<br><br>m_proj('stereographic','lat',90,'long',30,'radius',25);<br>m_elev('contour',[-3500:1000:-500],'edgecolor','b');<br>m_grid('xtick',12,'tickdir','out','ytick',[70 80],'linest','-');<br>m_coast('patch',[.7 .7 .7],'edgecolor','r');</pre>
<center><img src="./private/exster.gif"> </center>
<h4><a name="4._Two_Interrupted_Projections_of_the"></a> <a name="e4"></a>4.
Two Interrupted Projections of the World's Oceans</h4>
<pre>subplot(211);<br>Slongs=[-100 0;-75 25;-5 45; 25 145;45 100;145 295;100 290];<br>Slats= [ 8 80;-80 8; 8 80;-80 8; 8 80;-80 0; 0 80];<br>for l=1:7,<br> m_proj('sinusoidal','long',Slongs(l,:),'lat',Slats(l,:));<br> m_grid('fontsize',6,'xticklabels',[],'xtick',[-180:30:360],...<br> 'ytick',[-80:20:80],'yticklabels',[],'linest','-','color',[.9 .9 .9]);<br> m_coast('patch','g');<br>end;<br>xlabel('Interrupted Sinusoidal Projection of World Oceans');<br>% In order to see all the maps we must undo the axis limits set by m_grid calls:<br>set(gca,'xlimmode','auto','ylimmode','auto');<br><br>subplot(212);<br>Slongs=[-100 43;-75 20; 20 145;43 100;145 295;100 295];<br>Slats= [ 0 90;-90 0;-90 0; 0 90;-90 0; 0 90];<br>for l=1:6,<br> m_proj('mollweide','long',Slongs(l,:),'lat',Slats(l,:));<br> m_grid('fontsize',6,'xticklabels',[],'xtick',[-180:30:360],...<br> 'ytick',[-80:20:80],'yticklabels',[],'linest','-','color','k');<br> m_coast('patch',[.6 .6 .6]);<br>end;<br>xlabel('Interrupted Mollweide Projection of World Oceans');<br>set(gca,'xlimmode','auto','ylimmode','auto');</pre>
<center><img src="./private/exsinus.gif"> </center>
<h4><a name="5._Oblique_Mercator_Projection_with"></a> 5. Oblique
Mercator
Projection with quiver and contour data</h4>
<pre>%% Nice looking data<br>[lon,lat]=meshgrid([-136:2:-114],[36:2:54]);<br>u=sin(lat/6);<br>v=sin(lon/6);<br><br>m_proj('oblique','lat',[56 30],'lon',[-132 -120],'aspect',.8);<br><br>subplot(121);<br>m_coast('patch',[.9 .9 .9],'edgecolor','none');<br>m_grid('tickdir','out','yaxislocation','right',...<br> 'xaxislocation','top','xlabeldir','end','ticklen',.02);<br>hold on;<br>m_quiver(lon,lat,u,v);<br>xlabel('Simulated surface winds');<br><br>subplot(122);<br>m_coast('patch',[.9 .9 .9],'edgecolor','none');<br>m_grid('tickdir','out','yticklabels',[],...<br> 'xticklabels',[],'linestyle','none','ticklen',.02);<br>hold on;<br>[cs,h]=m_contour(lon,lat,sqrt(u.*u+v.*v));<br>clabel(cs,h,'fontsize',8);<br>xlabel('Simulated something else');</pre>
<center><img src="./private/exquiv.gif"> </center>
<h4><a name="6._Miller_Projection_with_Great_Circle"></a> <a name="e6"></a>6.
Miller Projection with Great Circle</h4>
<pre>% Plot a circular orbit<br>lon=[-180:180];<br>lat=atan(tan(60*pi/180)*cos((lon-30)*pi/180))*180/pi;<br><br>m_proj('miller','lat',82);<br>m_coast('color',[0 .6 0]);<br>m_line(lon,lat,'linewi',3,'color','r');<br>m_grid('linestyle','none','box','fancy','tickdir','out');</pre>
<center><img src="./private/exmiller.gif"> </center>
<h4><a name="7._Lambert_Conformal_Projection_with_Med"></a> 7. Lambert
Conformal
Projection with high-resolution bathymetry of Western Mediterranean</h4>
<pre>m_proj('lambert','lon',[-10 20],'lat',[33 48]);<br>m_tbase('contourf');<br>m_grid('linestyle','none','tickdir','out','linewidth',3);</pre>
<center><img src="./private/extbase.gif"> </center>
<h4><a name="8._Demonstration_of_fancy_vectors"></a> <a name="e8"></a>8.
Demonstration of fancy vectors</h4>
<pre>m_vec % See code in m_vec.m for details</pre>
<center><img src="./private/exvec.gif"> </center>
<h4><a name="9._Zoom_in_on_Prince_Edward_Island_to_co"></a> <a
name="e9"></a>9.
Zoom in on Prince Edward Island to show different coastline resolutions</h4>
<pre>% Example showing the default coastline and all of the different resolutions <br>% of GSHHS coastlines as we zoom in on a section of Prince Edward Island.<br><br>clf<br>axes('position',[.35 .6 .37 .37]);<br>m_proj('albers equal-area','lat',[40 60],'long',[-90 -50],'rect','on');<br>m_coast('patch',[0 1 0]);<br>m_grid('linest','none','linewidth',2,'tickdir','out','xaxisloc','top','yaxisloc','right');<br>m_text(-69,41,'Standard coastline','color','r','fontweight','bold');<br><br>axes('position',[.09 .5 .37 .37]);<br>m_proj('albers equal-area','lat',[40 54],'long',[-80 -55],'rect','on');<br>m_gshhs_c('patch',[.2 .8 .2]);<br>m_grid('linest','none','linewidth',2,'tickdir','out','xaxisloc','top');<br>m_text(-80,52.5,'GSHHS\_C (crude)','color','m','fontweight','bold','fontsize',14);<br><br>axes('position',[.13 .2 .37 .37]);<br>m_proj('albers equal-area','lat',[43 48],'long',[-67 -59],'rect','on');<br>m_gshhs_l('patch',[.4 .6 .4]);<br>m_grid('linest','none','linewidth',2,'tickdir','out');<br>m_text(-66.5,43.5,'GSHHS\_L (low)','color','m','fontweight','bold','fontsize',14);<br><br>axes('position',[.35 .05 .37 .37]);<br>m_proj('albers equal-area','lat',[45.8 47.2],'long',[-64.5 -62],'rect','on');<br>m_gshhs_i('patch',[.5 .6 .5]);<br>m_grid('linest','none','linewidth',2,'tickdir','out','yaxisloc','right');<br>m_text(-64.4,45.9,'GSHHS\_I (intermediate)','color','m','fontweight','bold','fontsize',14);<br><br>axes('position',[.55 .23 .37 .37]);<br>m_proj('albers equal-area','lat',[46.375 46.6],'long',[-64.2 -63.7],'rect','on');<br>m_gshhs_h('patch',[.6 .6 .6]);<br>m_grid('linest','none','linewidth',2,'tickdir','out','xaxisloc','top','yaxisloc','right');<br>m_text(-64.18,46.58,'GSHHS\_H (high)','color','m','fontweight','bold','fontsize',14);</pre>
<center><img src="./private/exgshhs.gif"> </center>
<h4><a name="10._Tracklines_and_UTM_projection"></a> <a name="e10"></a>10.
Tracklines and UTM projection</h4>
<pre>m_proj('UTM','long',[-72 -68],'lat',[40 44]);<br>m_gshhs_i('color','k');<br>m_grid('box','fancy','tickdir','in');<br><br>% fake up a trackline<br>lons=[-71:.1:-67];<br>lats=60*cos((lons+115)*pi/180);<br>dates=datenum(1997,10,23,15,1:41,zeros(1,41));<br><br>m_track(lons,lats,dates,'ticks',0,'times',4,'dates',8,...<br> 'clip','off','color','r','orient','upright');</pre>
<center><img src="./private/track1.gif"> </center>
<h4><a name="11._Range_rings"></a> <a name="e11"></a>11. Range rings</h4>
<pre> m_proj('hammer','clong',170);<br> m_grid('xtick',[],'ytick',[],'linestyle','-');<br> m_coast('patch','g');<br> m_line(100.5,13.5,'marker','square','color','r');<br> m_range_ring(100.5,13.5,[1000:1000:15000],'color','b','linewi',2);<br> xlabel('1000km range rings from Bangkok');</pre>
<center><img src="./private/rring.gif"><br>
<br>
</center>
<h4><a name="12._Speckle"></a> <a name="e12"></a>12. Speckled boundary</h4>
<pre>
bndry_lon=[-128.8 -128.8 -128.3 -128 -126.8 -126.6 -128.8];
bndry_lat=[49 50.33 50.33 50 49.5 49 49];
clf;
m_proj('lambert','long',[-130 -121.5],'lat',[47 51.5],'rectbox','on');
m_gshhs_i('color','k'); % Coastline...
m_gshhs_i('speckle','color','k'); % with speckle added
m_line(bndry_lon,bndry_lat,'linewi',2,'color','k'); % Area outline ...
m_hatch(bndry_lon,bndry_lat,'single',30,5,'color','k'); % ...with hatching added.
m_grid('linewi',2,'linest','none','tickdir','out','fontsize',12);
title('Speckled Boundaries for nice B&W presentation (best in postscript format)','fontsize',14);
m_text(-128,48,5,{'Pacific','Ocean'},'fontsize',18);
</pre>
<center><img src="./private/extspeckle.gif"><br>
<br>
</center>
<h4><a name="13._Blueocean"></a> <a name="e13"></a>13. Blue Ocean</h4>
<pre> m_proj('miller','lat',[-75 75]);<br> <br> set(gca,'color',[.9 .99 1]); % Trick is to set this *before* the patch call.<br> <br> m_coast('patch',[.7 1 .7],'edgecolor','none');<br> m_grid('box','fancy','linestyle','none');<br> <br> cities={'Cairo','Washington','Buenos Aires'};<br> lons=[ 30+2/60 -77-2/60 -58-22/60];<br> lats=[ 31+21/60 38+53/60 -34-45/60];<br> <br> for k=1:3,<br> [range,ln,lt]=m_lldist([-123-6/60 lons(k)],[49+13/60 lats(k)],40);<br> m_line(ln,lt,'color','r','linewi',2);<br> m_text(ln(end),lt(end),sprintf('%s - %d km',cities{k},round(range)));<br> end;<br> <br> title('Great Circle Routes','fontsize',14,'fontweight','bold');<br></pre>
<center><img src="./private/extblueocean.gif"><br>
<br>
</center>
<h2><a name="satellite_examples"></a>Examples of satellite data
manipulation</h2>
<h4><a name="1._Global_SST"></a>1. Global SST (or any variable on a
global
Lat/Long grid)</h4>
<blockquote><tt>% NOAA/NASA Pathfinder AVHRR SST product</tt><br>
<tt>% http://podaac.jpl.nasa.gov/sst/</tt><br>
<br>
<tt>[P,map]=imread('../m_mapWK/199911h54ma-gdm.hdf');</tt><br>
<br>
<tt>% Documentation for the 54km dataset gives</tt><br>
<tt>% this formula for temperature</tt><br>
<tt>P=0.15*double(P)-3; % deg C</tt><br>
<br>
<tt>%...and defines this Lat/Long grid for the data</tt><br>
<tt>Plat=90-.25-[0:359]*.5;Plon=-180+.25+[0:719]*.5;</tt><br>
<br>
<tt>% Since the grid is rectangluar in lat/long (i.e. not</tt><br>
<tt>% really a projection at all, althouhg it is included in</tt><br>
<tt>% m_map under the name 'equidistant cyldindrical'), we </tt><br>
<tt>% don't want to use the 'image' technique. Instead... </tt><br>
<tt>% Create a grid, offsetting by half a grid point to account</tt><br>
<tt>% for the flat pcolor</tt><br>
<tt>[Plg,Plt]=meshgrid(Plon-0.25,Plat+0.25);</tt><br>
<br>
<tt>m_proj('hammer-aitoff','clongitude',-150);</tt><br>
<br>
<tt>% Rather than rearranging the data so its limits match the</tt><br>
<tt>% plot I just draw it twice (you can see the join at 180W</tt><br>
<tt>% because of the quirks of flat pcolor) (Note that </tt><br>
<tt>% all the global projections have 360 deg ambiguities)</tt><br>
<tt>m_pcolor(Plg,Plt,P);shading flat;colormap(map);</tt><br>
<tt>hold on;</tt><br>
<tt>m_pcolor(Plg-360,Plt,P);shading flat;colormap(map);</tt><br>
<br>
<tt>m_coast('patch',[.6 1 .6]);</tt><br>
<tt>m_grid('xaxis','middle');</tt><br>
<br>
<tt>% add a standard colorbar.</tt><br>
<tt>h=colorbar('h');</tt><br>
<tt>set(get(h,'title'),'string','AVHRR SST Nov 1999');</tt><br>
</blockquote>
<pre> </pre>
<div align="center"><img src="private/ex_sst.gif" alt="SST pic"
height="376" width="553">
<br>
<br>
<div align="left"><br>
<h4><a name="2._SSMI_Ice_cover"></a>2. SSM/I Ice cover (data
provided
on a fixed grid)</h4>
<blockquote><tt>% SSM/I Ice concentration grids</tt><br>
<tt>% (National Snow and Ice Data Center)</tt><br>
<br>
<tt>P=hdfread('/mnt/cdrom/nasateam/northern/1991/feb/910222.tot','8-bit
Raster Image #2');</tt><br>
<tt>P(P==168)=101; % Land, no coverage.</tt><br>
<tt>P(P==157)=102; % Bad data</tt><br>
<br>
<tt>% SSM/I ice products are in a polar stereographic projection.</tt><br>
<tt>% and the corner points of the grid are given. Here we just</tt><br>
<tt>% use those given corner points and 'assume' everything will</tt><br>
<tt>% work. It's not bad, although their projection actually uses</tt><br>
<tt>% an ellipsoidal earth (m_map uses a spherical earth).</tt><br>
<br>
<tt>m_proj('stereographic','latitude',90,'radius',55,'rotangle',45);</tt><br>
<br>
<tt>% Convert bottom and left corner points to screen coords. This</tt><br>
<tt>% is of course a kludge.</tt><br>
<tt>[MAPX,dm]=m_ll2xy([279.26 350.03],[33.92 34.35],'clip','off');</tt><br>
<tt>[dm,MAPY]=m_ll2xy([168.35 279.26],[30.98 33.92],'clip','off');</tt><br>
<br>
<tt>clf</tt><br>
<tt>% Plot data as an image</tt><br>
<tt>image(MAPX,MAPY,P);set(gca,'ydir','normal');</tt><br>
<tt>colormap([jet(100);0 0 0;1 1 1]);</tt><br>
<br>
<tt>m_coast('patch',[.6 .6 .6]);</tt><br>
<tt>m_grid('linewi',2,'tickdir','out');</tt><br>
<tt>title('SSM/I Ice cover Feb 22
1991','fontsize',14,'fontweight','bold');</tt><br>
<br>
<tt>h=colorbar('v');</tt><br>
<tt>set(get(h,'ylabel'),'string','Total Ice Concentration (%)');</tt><br>
</blockquote>
<br>
<div align="center"><img src="private/ex_ssmi.gif" alt="SSMi Ice"
height="413" width="522">
<br>
</div>
</div>
</div>
<p> </p>
<br>
<br>
<br>
<h4><a name="3._Aerial_photos"></a>3. Aerial photos on an UTM grid</h4>
<blockquote><tt>% This image comes from the TerraServer</tt><br>
<tt>% (http://terraserver.microsoft.com/)</tt><br>
<tt>% and has been georeferenced to UTM coords. The UTM projection</tt><br>
<tt>% uses UTM coordinates on the screen (as long as the ellipse</tt><br>
<tt>% parameter is set to something other than the default).</tt><br>
<tt>[P,map]=imread('../m_mapWK/oncehome.jpeg');</tt><br>
<br>
<tt>% Set the projection limits to the lat/long of image</tt><br>
<tt>% corners.</tt><br>
<tt>m_proj('UTM','long',[-71-6/60-30/3600 -71-4/60-43/3600],...</tt><br>
<tt>
'lat',[42+21/60+13/3600 42+22/60+7/3600],'ellipse','wgs84');</tt><br>
<br>
<tt>clf;</tt><br>
<tt>image([326400 328800],[4692800
4691200],P);set(gca,'ydir','normal');</tt><br>
<tt>m_grid('tickdir','out','linewi',2,'fontsize',14);</tt><br>
<tt>title('A home for certain nerds','fontsize',16);</tt><br>
</blockquote>
<div align="center"><img src="private/ex_terra.gif" alt="nerdhome"
height="401" width="542">
<br>
</div>
<br>
<br>
<h4><a name="4._A_subset_of_a_global_dataset"></a>4. A subset of
a
global dataset (HDF format)</h4>
<blockquote><font size="-1"><tt>% Ocean colour data from
http://seawifs.gsfc.nasa.gov/SEAWIFS.html</tt></font><br>
<font size="-1"><tt>%</tt></font><br>
<font size="-1"><tt>% Take a 4km weakly average dataset and plot a
map
for the Strait of</tt></font><br>
<font size="-1"><tt>% Georgia and outer coast. Note that most of this
code
is used</tt></font><br>
<font size="-1"><tt>% for reading in and subsetting the data.</tt></font><br>
<br>
<font size="-1"><tt>LATLIMS=[47 51];</tt></font><br>
<font size="-1"><tt>LONLIMS=[-130 -121];</tt></font><br>
<br>
<font size="-1"><tt>% Note - This is probably not the most efficient
way
to read and</tt></font><br>
<font size="-1"><tt>%
handle
HDF data, but I don't usually do this...</tt></font><br>
<font size="-1"><tt>%</tt></font><br>
<font size="-1"><tt>% First, get the attribute data</tt></font><br>
<font size="-1"><tt>PI=hdfinfo('A20040972004104.L3m_8D_CHLO_4KM');</tt></font><br>
<font size="-1"><tt>% And write it into a structure</tt></font><br>
<font size="-1"><tt>pin=[];</tt></font><br>
<font size="-1"><tt>for k=1:59,</tt></font><br>
<font size="-1"><tt> nm=PI.Attributes(k).Name;nm(nm==' ')='_';</tt></font><br>
<font size="-1"><tt> if isstr(PI.Attributes(k).Value),</tt></font><br>
<font size="-1"><tt>
pin=setfield(pin,nm,PI.Attributes(k).Value);</tt></font><br>
<font size="-1"><tt> else</tt></font><br>
<font size="-1"><tt>
pin=setfield(pin,nm,double(PI.Attributes(k).Value));</tt></font><br>
<font size="-1"><tt> end</tt></font><br>
<font size="-1"><tt>end; </tt></font><br>
<br>
<font size="-1"><tt>% lon/lat of grid corners</tt></font><br>
<font size="-1"><tt>lon=[pin.Westernmost_Longitude:pin.Longitude_Step:pin.Easternmost_Longitude];</tt></font><br>
<font size="-1"><tt>lat=[pin.Northernmost_Latitude:-pin.Latitude_Step:pin.Southernmost_Latitude];</tt></font><br>
<br>
<font size="-1"><tt>% Get the indices needed for the area of interest</tt></font><br>
<font size="-1"><tt>[mn,ilt]=min(abs(lat-max(LATLIMS)));</tt></font><br>
<font size="-1"><tt>[mn,ilg]=min(abs(lon-min(LONLIMS)));</tt></font><br>
<font size="-1"><tt>ltlm=fix(diff(LATLIMS)/pin.Latitude_Step);</tt></font><br>
<font size="-1"><tt>lglm=fix(diff(LONLIMS)/pin.Longitude_Step);</tt></font><br>
<br>
<font size="-1"><tt>% load the subset of data needed for the map
limits
given</tt></font><br>
<font size="-1"><tt>P=hdfread('A20040972004104.L3m_8D_CHLO_4KM','l3m_data','Index',{[ilt
ilg],[],[ltlm lglm]});</tt></font><br>
<br>
<font size="-1"><tt>% Convert data into log(Chla) using the equations
given.
Blank no-data.</tt></font><br>
<font size="-1"><tt>P=double(P);</tt></font><br>
<font size="-1"><tt>P(P==255)=NaN;</tt></font><br>
<font size="-1"><tt>P=(pin.Slope*P+pin.Intercept); %
log_10
of chla</tt></font><br>
<br>
<font size="-1"><tt>LT=lat(ilt+[0:ltlm-1]);LG=lon(ilg+[0:lglm-1]);</tt></font><br>
<font size="-1"><tt>[Plg,Plt]=meshgrid(LG,LT);</tt></font><br>
<br>
<font size="-1"><tt>% Draw the map...</tt></font><br>
<br>
<font size="-1"><tt>clf;</tt></font><br>
<font size="-1"><tt>m_proj('lambert','lon',LONLIMS,'lat',LATLIMS);</tt></font><br>
<font size="-1"><tt>m_pcolor(Plg,Plt,P);shading flat;</tt></font><br>
<font size="-1"><tt>m_gshhs_i('color','k');;</tt></font><br>
<font size="-1"><tt>m_grid('linewi',2,'tickdir','out');;</tt></font><br>
<font size="-1"><tt>h=colorbar;</tt></font><br>
<font size="-1"><tt>set(get(h,'ylabel'),'String','Chla (\mug/l)');</tt></font><br>
<font size="-1"><tt>set(h,'ytick',log10([.5 1 2 3 5 10 20
30]),'yticklabel',[.5
1 2 3 5 10 20 30],'tickdir','out');</tt></font><br>
<font size="-1"><tt>title(['MODIS Chla '
datestr(datenum(pin.Period_Start_Year,1,0)+pin.Period_Start_Day)
' -> ' ...</tt></font><br>
<font size="-1"><tt>
datestr(datenum(pin.Period_Start_Year,1,0)+pin.Period_End_Day)],...</tt></font><br>
<font size="-1"><tt>
'fontsize',14,'fontweight','bold');</tt></font><br>
</blockquote>
<br>
<div align="center"><img src="private/ex_modis.gif" alt="modis"
height="396" width="540">
<br>
</div>
<hr><i>Last changed 30/Dec/2005. Questions and comments to <a
href="mailto:rich@eos.ubc.ca">rich@eos.ubc.ca</a></i> <br>
<br>
</body>
</html>