Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

grdtrend.rst 3.7 KB

You have to be logged in to leave a comment. Sign In
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
  1. .. index:: ! grdtrend
  2. .. include:: module_core_purpose.rst_
  3. ********
  4. grdtrend
  5. ********
  6. |grdtrend_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt grdtrend** *grdfile* |-N|\ *n\_model*\ [**+r**]
  11. [ |-D|\ *diff.nc* ]
  12. [ |SYN_OPT-R| ]
  13. [ |-T|\ *trend.nc* ] [ |-W|\ *weight.nc* ]
  14. [ |SYN_OPT--| ]
  15. |No-spaces|
  16. Description
  17. -----------
  18. **grdtrend** reads a 2-D grid file and fits a low-order polynomial trend
  19. to these data by [optionally weighted] least-squares. The trend surface
  20. is defined by:
  21. m1 + m2\*x + m3\*y + m4\*x\*y + m5\*x\*x + m6\*y\*y + m7\*x\*x\*x +
  22. m8\*x\*x\*y + m9\*x\*y\*y + m10\*y\*y\*y.
  23. The user must specify **-N**\ *n\_model*, the number of model parameters
  24. to use; thus, **-N**\ *3* fits a bilinear trend, **-N**\ *6* a quadratic
  25. surface, and so on. Optionally, append **+r** to the **-N** option to
  26. perform a robust fit. In this case, the program will iteratively
  27. reweight the data based on a robust scale estimate, in order to converge
  28. to a solution insensitive to outliers. This may be handy when separating
  29. a "regional" field from a "residual" which should have non-zero mean,
  30. such as a local mountain on a regional surface.
  31. If data file has values set to NaN, these will be ignored during
  32. fitting; if output files are written, these will also have NaN in the
  33. same locations.
  34. Required Arguments
  35. ------------------
  36. *grdfile*
  37. The name of a 2-D binary grid file.
  38. .. _-N:
  39. **-N**\ *n\_model*\ [**+r**]
  40. *n\_model* sets the number of model parameters to fit.
  41. Append **+r** for robust fit.
  42. Optional Arguments
  43. ------------------
  44. **-D**\ *diff.nc*
  45. Write the difference (input data - trend) to the file *diff.nc*.
  46. .. |Add_-R| replace:: Using the **-R** option
  47. will select a subsection of the input grid. If this subsection
  48. exceeds the boundaries of the grid, only the common region will be extracted.
  49. .. include:: explain_-R.rst_
  50. .. _-T:
  51. **-T**\ *trend.nc*
  52. Write the fitted trend to the file *trend.nc*.
  53. .. _-V:
  54. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  55. .. include:: explain_-V.rst_
  56. .. _-W:
  57. **-W**\ *weight.nc*\ [**+s**]
  58. If *weight.nc* exists, it will be read and used to solve a weighted
  59. least-squares problem. [Default: Ordinary least-squares fit]. Append
  60. **+s** to instead read data uncertainties (one sigma) and create weights
  61. as 1/sigma^2. If the robust option has been selected, the weights used
  62. in the robust fit will be written to *weight.nc*.
  63. .. include:: explain_help.rst_
  64. Remarks
  65. -------
  66. The domain of x and y will be shifted and scaled to [-1, 1] and the
  67. basis functions are built from Legendre polynomials. These have a
  68. numerical advantage in the form of the matrix which must be inverted and
  69. allow more accurate solutions. NOTE: The model parameters listed with
  70. **-V** are Legendre polynomial coefficients; they are not numerically
  71. equivalent to the m#s in the equation described above. The description
  72. above is to allow the user to match **-N** with the order of the
  73. polynomial surface. See :doc:`grdmath` if you need to evaluate the trend
  74. using the reported coefficients.
  75. .. include:: explain_grd_inout_short.rst_
  76. Examples
  77. --------
  78. .. include:: explain_example.rst_
  79. To remove a planar trend from the remote grid earth_relief_05m for the region
  80. around Hawaii and write the result to hawaii_residual.nc::
  81. gmt grdtrend @earth_relief_05m -R180/240/10/40 -N3 -Dhawaii_residual.nc
  82. To do a robust fit of a bicubic surface to hawaii_topo.nc, writing the
  83. result in hawaii_trend.nc and the weights used in hawaii_weight.nc,
  84. and reporting the progress:
  85. ::
  86. gmt grdtrend hawaii_topo.nc -N10+r -Thawaii_trend.nc -Whawaii_weight.nc -V
  87. See Also
  88. --------
  89. :doc:`gmt`,
  90. :doc:`grdfft`,
  91. :doc:`grdfilter`,
  92. :doc:`grdmath`
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...