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
|
<HTML>
<HEAD>
<TITLE>grdtrend</TITLE>
</HEAD>
<BODY>
<H1>grdtrend</H1>
<HR>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
grdtrend - Fit and/or remove a polynomial trend in a grd
file
</PRE>
<H2>SYNOPSIS</H2><PRE>
<B>grdtrend</B> <I>grdfile</I> <B>-N</B><I>n</I><B>_</B><I>model</I>[<B>r</B>] [ <B>-D</B><I>diff.grd</I> ] [ <B>-T</B><I>trend.grd</I>
] [ <B>-V</B> ] [ <B>-W</B><I>weight.grd</I> ]
</PRE>
<H2>DESCRIPTION</H2><PRE>
<B>grdtrend</B> reads a 2-D gridded file and fits a low-order
polynomial trend to these data by [optionally weighted]
least-squares. The trend surface is defined by:
m1 + m2*x + m3*y + m4*x*y + m5*x*x + m6*y*y + m7*x*x*x +
m8*x*x*y + m9*x*y*y + m10*y*y*y.
The user must specify <B>-N</B><I>n</I><B>_</B><I>model</I>, the number of model
parameters to use; thus, <B>-N</B><I>4</I> fits a bilinear trend, <B>-N</B><I>6</I> a
quadratic <A HREF="surface.html">surface</A>, and so on. Optionally, append <B>r</B> to the
<B>-N</B> option to perform a robust fit. In this case, the pro
gram will iteratively reweight the data based on a robust
scale estimate, in order to converge to a solution insen
sitive to outliers. This may be handy when separating a
"regional" field from a "residual" which should have non-
zero mean, such as a local mountain on a regional surface.
If data file has values set to NaN, these will be ignored
during fitting; if output files are written, these will
also have NaN in the same locations.
No space between the option flag and the associated argu
ments.
<I>grdfile</I>
The name of a 2-D binary grd file.
<B>-N</B> <I>n</I><B>_</B><I>model</I>[<B>r</B>] sets the number of model parameters to
fit. Append <B>r</B> for robust fit.
</PRE>
<H2>OPTIONS</H2><PRE>
No space between the option flag and the associated argu
ments.
<B>-D</B> Write the difference (input data - trend) to the
file <I>diff.grd</I>.
<B>-T</B> Write the fitted trend to the file <I>trend.grd</I>.
<B>-V</B> Selects verbose mode, which will send progress
reports to stderr [Default runs "silently"].
<B>-W</B> If <I>weight.grd</I> exists, it will be read and used to
solve a weighted least-squares problem. [Default:
fit will be written to <I>weight.grd</I>.
</PRE>
<H2>REMARKS</H2><PRE>
The domain of x and y will be shifted and scaled to [-1,
1] and the basis functions are built from Legendre polyno
mials. These have a numerical advantage in the form of the
matrix which must be inverted and allow more accurate
solutions. NOTE: The model parameters listed with <B>-V</B> are
Legendre polynomial coefficients; they are not numerically
equivalent to the m#s in the equation described above. The
description above is to allow the user to match <B>-N</B> with
the order of the polynomial surface.
</PRE>
<H2>EXAMPLES</H2><PRE>
To remove a planar trend from hawaii_topo.grd and write
result in hawaii_residual.grd, try
<B>grdtrend</B> hawaii_topo.grd <B>-N</B>3 <B>-D</B>hawaii_residual.grd
To do a robust fit of a bicubic surface to
hawaii_topo.grd, writing the result in hawaii_trend.grd
and the weights used in hawaii_weight.grd, and reporting
the progress, try
<B>grdtrend</B> hawaii_topo.grd <B>-N</B>10<B>r</B> <B>-T</B>hawaii_trend.grd
<B>-W</B>hawaii_weight.grd <B>-V</B>
</PRE>
<H2>SEE ALSO</H2><PRE>
<I>gmt</I>(l), <I><A HREF="grdfft.html">grdfft</A></I>(l), <I><A HREF="grdfilter.html">grdfilter</A></I>(l)
</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
<body bgcolor="#ffffff">
|