File: node71.html

package info (click to toggle)
gmt-doc 3.4-1.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,756 kB
  • ctags: 1,800
  • sloc: makefile: 30
file content (291 lines) | stat: -rw-r--r-- 10,054 bytes parent folder | download | duplicates (2)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>4.3 Color images</TITLE>
<META NAME="description" CONTENT="4.3 Color images">
<META NAME="keywords" CONTENT="tutorial">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="tutorial.css">

<LINK REL="next" HREF="node73.html">
<LINK REL="previous" HREF="node70.html">
<LINK REL="up" HREF="node67.html">
<LINK REL="next" HREF="node72.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html1434"
  HREF="node72.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A> 
<A NAME="tex2html1428"
  HREF="node67.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A> 
<A NAME="tex2html1422"
  HREF="node70.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A> 
<A NAME="tex2html1430"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A> 
<A NAME="tex2html1432"
  HREF="node79.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1435"
  HREF="node72.html">4.3.1 Exercises</A>
<B> Up:</B> <A NAME="tex2html1429"
  HREF="node67.html">4. SESSION FOUR</A>
<B> Previous:</B> <A NAME="tex2html1423"
  HREF="node70.html">4.2 Illumination and intensities</A>
 &nbsp <B>  <A NAME="tex2html1431"
  HREF="node1.html">Contents</A></B> 
 &nbsp <B>  <A NAME="tex2html1433"
  HREF="node79.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION00630000000000000000"></A>
<A NAME="1472"></A>
<BR>
4.3 Color images
</H1>

<P>
Once a cpt file has been made it is relatively straightforward to generate
a color image of a gridded data.  Here, we will extract a subset of the
global 30" DEM (data id 9) from USGS:

<P>
<PRE>
grdraster 9 -R-108/-103/35/40 -Gus.grd
</PRE>

<P>
Using <A NAME="tex2html262"
  HREF="../grdinfo.html"><I><B>grdinfo</B></I></A><A NAME="3251"></A> we find that the data ranges from <IMG
 WIDTH="16" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
 SRC="img7.gif"
 ALT="$\sim$">1000m to
<IMG
 WIDTH="16" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
 SRC="img7.gif"
 ALT="$\sim$">4300m so we make a cpt file accordingly:

<P>
<PRE>
makecpt -Crainbow -T1000/5000/500 -Z &gt;! topo.cpt
</PRE>

<P>
Color images are made with <A NAME="tex2html263"
  HREF="../grdimage.html"><I><B>grdimage</B></I></A><A NAME="3260"></A> which takes the usual
common command options (by default the <B>-R</B> is taken from the data set)
and a cptfile; the main other options are

<P>
<BR><P></P>
<DIV ALIGN="CENTER"><A NAME="1760"></A>
<TABLE>
<CAPTION><STRONG>Table 4.3:</STRONG>
The main options in <A NAME="tex2html255"
  HREF="../grdimage.html"><I><B>grdimage</B></I></A><A NAME="3273"></A></CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1">
<TR><TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1">
<I>Option</I></FONT></TD>
<TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1"> <I>Purpose</I></FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
</FONT><FONT SIZE="-1"><B>-E</B></FONT><FONT SIZE="-1"><I>dpi</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Sets the desired resolution of the image [Default is data resolution] </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-I</B></FONT><FONT SIZE="-1"><I>intenfile</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Use artificial illumination using intensities from </FONT><FONT SIZE="-1"><I>intensfile</I> </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-M</B> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Force grayshade using the (television) YIQ conversion </FONT></TD>
</TR>
</TABLE><FONT SIZE="-1">

<A NAME="tbl:grdimage"></A></FONT></DIV></TD></TR>
</TABLE>
</DIV><P></P>
<BR>

<P>
We want to make a plain color map with a color bar superimposed above
the plot.  We try

<P>
<PRE>
grdimage us.grd -JM6i -P -B2 -Ctopo.cpt -V -K &gt;! topo.ps
psscale -D3i/8.5i/5i/0.25ih -Ctopo.cpt -I0.4 -B/:m: -O &gt;&gt; topo.ps
</PRE>

<P>
The plain color map lacks detail and fails to reveal the topographic
complexity of this Rocky Mountain region.  What it needs is artificial
illumination.  We want to simulate shading by a sun source in the east,
hence we derive the required intensities from the gradients of the
topography in the N90<IMG
 WIDTH="11" HEIGHT="15" ALIGN="BOTTOM" BORDER="0"
 SRC="img25.gif"
 ALT="$^{o}$">E direction using <A NAME="tex2html264"
  HREF="../grdgradient.html"><I><B>grdgradient</B></I></A><A NAME="3283"></A>.  Other than the
required input and output filenames, the available options are
<A NAME="1502"></A>
<A NAME="1503"></A>

<P>
<BR><P></P>
<DIV ALIGN="CENTER"><A NAME="1763"></A>
<TABLE>
<CAPTION><STRONG>Table 4.4:</STRONG>
The <A NAME="tex2html258"
  HREF="../grdgradient.html"><I><B>grdgradient</B></I></A><A NAME="3295"></A> options</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1">
<TR><TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1">
<I>Option</I></FONT></TD>
<TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1"> <I>Purpose</I></FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
</FONT><FONT SIZE="-1"><B>-A</B></FONT><FONT SIZE="-1"><I>azimuth</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Azimuthal direction for gradients </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-M</B> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Indicates that this is a geographic grid </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-N</B>[</FONT><FONT SIZE="-1"><B>t</B><IMG
 WIDTH="8" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
 SRC="img1.gif"
 ALT="$\vert$"></FONT><FONT SIZE="-1"><B>e</B>][</FONT><FONT SIZE="-1"><I>norm</I>[/</FONT><FONT SIZE="-1"><I>offset</I>]] </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Normalize gradients by </FONT><FONT SIZE="-1"><I>norm/offset</I> [= 1/0 by default]. </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1"> 
	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Insert </FONT><FONT SIZE="-1"><B>t</B> to normalize by the <IMG
 WIDTH="41" HEIGHT="35" ALIGN="MIDDLE" BORDER="0"
 SRC="img69.gif"
 ALT="$tan^{-1}$"> transformation. </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1"> 
	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Insert </FONT><FONT SIZE="-1"><B>e</B> to normalize by the cumulative Laplace distribution. </FONT></TD>
</TR>
</TABLE><FONT SIZE="-1">

<A NAME="tbl:grdgradient"></A></FONT></DIV></TD></TR>
</TABLE>
</DIV><P></P>
<BR>

<P>
Figure&nbsp;<A HREF="node71.html#fig:GMT_atan">4.1</A> shows that raw slopes from bathymetry tend to be
far from normally distributed (left).  By using the inverse tangent
transformation we can ensure a more uniform distribution (right).
The inverse tangent transform simply takes the raw slope estimate
(the <I>x</I> value at the arrow) and returns the corresponding inverse
tangent value (normalized to fall in the <IMG
 WIDTH="24" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
 SRC="img68.gif"
 ALT="$\pm1$"> range; horizontal
arrow pointing to the <I>y</I>-value).

<P>

<P></P>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_atan"></A><A NAME="3304"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.1:</STRONG>
How the inverse tangent operation works</CAPTION>
<TR><TD><IMG
 WIDTH="633" HEIGHT="144" BORDER="0"
 SRC="img70.gif"
 ALT="\begin{figure}\centering\epsfig{figure=eps/GMT_atan.eps}\end{figure}"></TD></TR>
</TABLE>
</DIV><P></P>

<P>
Both <B>-Ne</B> and <B>-Nt</B> yield well behaved gradients.  Personally,
we prefer to use the <B>-Ne</B> option; the value of
<I>norm</I> is subjective and you may experiment somewhat in the
0.5-5 range.  For our case we choose

<P>
<PRE>
grdgradient us.grd -Ne0.8 -A100 -M -Gus_i.grd
</PRE>

<P>
Given the cpt file and the two gridded data sets we can
create the shaded relief image:

<P>
<PRE>
grdimage us.grd -Ius_i.grd -JM6i -P -B2 -Ctopo.cpt -K &gt;! topo.ps
psscale -D3i/8.5i/5i/0.25ih -Ctopo.cpt -I0.4 -B/:m: -O &gt;&gt; topo.ps
</PRE>

<P>
<BR><HR>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html1436"
  HREF="node72.html">4.3.1 Exercises</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1434"
  HREF="node72.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A> 
<A NAME="tex2html1428"
  HREF="node67.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A> 
<A NAME="tex2html1422"
  HREF="node70.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A> 
<A NAME="tex2html1430"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A> 
<A NAME="tex2html1432"
  HREF="node79.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1435"
  HREF="node72.html">4.3.1 Exercises</A>
<B> Up:</B> <A NAME="tex2html1429"
  HREF="node67.html">4. SESSION FOUR</A>
<B> Previous:</B> <A NAME="tex2html1423"
  HREF="node70.html">4.2 Illumination and intensities</A>
 &nbsp <B>  <A NAME="tex2html1431"
  HREF="node1.html">Contents</A></B> 
 &nbsp <B>  <A NAME="tex2html1433"
  HREF="node79.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2001-04-18
</ADDRESS>
</BODY>
</HTML>