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

blockmedian.rst 7.3 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
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
  1. .. index:: ! blockmedian
  2. .. include:: module_core_purpose.rst_
  3. ***********
  4. blockmedian
  5. ***********
  6. |blockmedian_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt blockmedian** [ *table* ]
  11. |SYN_OPT-I|
  12. |SYN_OPT-R|
  13. [ |-A|\ *fields* ]
  14. [ |-C| ]
  15. [ |-E|\ [**b**\|\ **r**\|\ **s**\ [**+l**\|\ **h**]] ]
  16. [ |-G|\ [*grdfile*] ]
  17. [ |-Q| ]
  18. [ |-T|\ *quantile* ]
  19. [ |SYN_OPT-V| ]
  20. [ |-W|\ [**i**\|\ **o**][**+s**\|\ **w**] ]
  21. [ |SYN_OPT-a| ]
  22. [ |SYN_OPT-b| ]
  23. [ |SYN_OPT-d| ]
  24. [ |SYN_OPT-e| ]
  25. [ |SYN_OPT-f| ]
  26. [ |SYN_OPT-h| ]
  27. [ |SYN_OPT-i| ]
  28. [ |SYN_OPT-o| ]
  29. [ |SYN_OPT-q| ]
  30. [ |SYN_OPT-r| ]
  31. [ |SYN_OPT-w| ]
  32. [ |SYN_OPT-:| ]
  33. [ |SYN_OPT--| ]
  34. |No-spaces|
  35. Description
  36. -----------
  37. **blockmedian** reads arbitrarily located (*x*,\ *y*,\ *z*) triples [or
  38. optionally weighted quadruples (*x*,\ *y*,\ *z*,\ *w*)] from standard
  39. input [or *table*] and writes to standard output a median position and
  40. value for every non-empty block in a grid region defined by the **-R**
  41. and **-I** arguments. See **-G** for writing gridded output directly.
  42. Either :doc:`blockmean`, **blockmedian**, or
  43. :doc:`blockmode` should be used as a pre-processor before running
  44. :doc:`surface` to avoid aliasing short wavelengths. These routines are also
  45. generally useful for decimating or averaging (*x*,\ *y*,\ *z*) data. You
  46. can modify the precision of the output format by editing the
  47. :term:`FORMAT_FLOAT_OUT` parameter in your :doc:`gmt.conf` file, or you may
  48. choose binary input and/or output to avoid loss of precision.
  49. Required Arguments
  50. ------------------
  51. *table*
  52. 3 (or 4, see **-W**) column ASCII data table file(s) (or binary, see
  53. **-bi**) holding (*x*,\ *y*,\ *z*\ [,\ *w*])
  54. data values, where [*w*] is an optional weight for the data.
  55. If no file is specified, **blockmedian** will read
  56. from standard input.
  57. .. _-I:
  58. .. include:: explain_-I.rst_
  59. .. |Add_-R| replace:: |Add_-R_links|
  60. .. include:: explain_-R.rst_
  61. :start-after: **Syntax**
  62. :end-before: **Description**
  63. Optional Arguments
  64. ------------------
  65. .. _-A:
  66. **-A**\ *fields*
  67. Select which fields to write to individual grids. Requires **-G**.
  68. Append the codes for available fields: **z** (the median
  69. data z, but see **-T**), **s** (the L1 scale of the median), **l** (lowest
  70. value), **q25** (the 25% quartile), **q75** (the 75% quartile), **h** (highest value),
  71. and **w** (the output weight; requires **-W**). Note **s**\|\ **l**\|\ **h**
  72. requires **-E**, while **l**\|\ **q25**\|\ **q75**\|\ **h** requires **-Eb**,
  73. and **Es**\|\ **r** cannot be used. [Default is just **z**].
  74. .. _-C:
  75. **-C**
  76. Use the center of the block as the output location [Default uses the
  77. median x and median y as location (but see **-Q**)].
  78. .. _-E:
  79. **-E**\ [**b**]
  80. Provide Extended report which includes **s** (the L1 scale of the
  81. median, i.e., 1.4826 \* median absolute deviation [MAD]), **l**, the lowest
  82. value, and **h**, the high value for each block. Output order becomes
  83. *x*,\ *y*,\ *z*,\ *s*,\ *l*,\ *h*\ [,\ *w*]. Default outputs
  84. *x*,\ *y*,\ *z*\ [,\ *w*]. For box-and-whisker calculation, use
  85. **-Eb** which will output
  86. *x*,\ *y*,\ *z*,\ *l*,\ *q25*,\ *q75*,\ *h*\ [,\ *w*], where *q25* and
  87. *q75* are the 25% and 75% quantiles, respectively. See **-W** for
  88. *w* output.
  89. **-E**\ **r**\|\ **s**\ [**+l**\|\ **h**]
  90. Provide source id **s** or record number **r** output, i.e., append
  91. the source id or record number associated with the median value. If
  92. tied then report the record number of the higher of the two values (i.e., **+h** is the default);
  93. append **+l** to instead report the record number of the lower value.
  94. Note that **-E** may be repeated so that both **-E**\ [**b**] and
  95. **-E**\ **r**\ [**+l**\|\ **h**] can be
  96. specified. For **-E**\ **s** we expect input records of the form
  97. *x*,\ *y*,\ *z*\ [,\ *w*],\ *sid*, where *sid* is an unsigned integer
  98. source id.
  99. .. _-G:
  100. **-G**\ *grdfile*
  101. Write one or more fields directly to grids; no table data are written to
  102. standard output. If more than one fields are specified via **-A** then
  103. *grdfile* must contain the format flag %s so that we can embed the field
  104. code in the file names.
  105. .. _-Q:
  106. **-Q**
  107. (Quicker) Finds median *z* and (*x*,\ *y*) at that the median *z*
  108. [Default finds median *x*, median *y* independent of *z*]. Also see **-C**.
  109. .. _-T:
  110. **-T**\ *quantile*
  111. Sets the *quantile* of the distribution to be returned [Default is
  112. 0.5 which returns the median *z*]. Here, 0 < *quantile* < 1.
  113. .. |Add_-V| replace:: |Add_-V_links|
  114. .. include:: explain_-V.rst_
  115. :start-after: **Syntax**
  116. :end-before: **Description**
  117. .. _-W:
  118. **-W**\ [**i**\|\ **o**][**+s**\|\ **w**]
  119. Weighted modifier[s]. Unweighted input and output have 3 columns
  120. *x*,\ *y*,\ *z*; Weighted i/o has 4 columns *x*,\ *y*,\ *z*,\ *w*.
  121. Weights can be used in input to construct weighted median values for each
  122. block. Weight sums can be reported in output for later combining
  123. several runs, etc. Use **-W** for weighted i/o, **-Wi** for weighted
  124. input only, and **-Wo** for weighted output only. [Default uses
  125. unweighted i/o]. If your weights are actually uncertainties (one sigma)
  126. then append **+s** and we compute weight = 1/sigma. Otherwise (or via **+w**
  127. we use the weights directly).
  128. .. include:: explain_-aspatial.rst_
  129. .. |Add_-bi| replace:: [Default is 3 (or 4 if **-Wi** is set)].
  130. .. include:: explain_-bi.rst_
  131. .. |Add_-bo| replace:: [Default is 3 (or 4 if **-Wo** is set)]. **-E** adds 3 additional columns.
  132. .. include:: explain_-bo.rst_
  133. .. |Add_-d| unicode:: 0x20 .. just an invisible code
  134. .. include:: explain_-d.rst_
  135. .. |Add_-e| unicode:: 0x20 .. just an invisible code
  136. .. include:: explain_-e.rst_
  137. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  138. .. include:: explain_-f.rst_
  139. .. |Add_-h| unicode:: 0x20 .. just an invisible code
  140. .. include:: explain_-h.rst_
  141. .. include:: explain_-icols.rst_
  142. .. include:: explain_-ocols.rst_
  143. .. include:: explain_-q.rst_
  144. .. |Add_nodereg| replace::
  145. Each block is the locus of points nearest the grid value location. Consider an example with
  146. **-R**\ 10/15/10/15 and **-I**\ 1: With **-r** or **-rp**, 10 <=
  147. (*x*,\ *y*) < 11 is one of 25 blocks; otherwise 9.5 <= (*x*,\ *y*)
  148. < 10.5 is one of 36 blocks.
  149. .. include:: explain_nodereg.rst_
  150. .. include:: explain_-w.rst_
  151. .. include:: explain_colon.rst_
  152. .. include:: explain_help.rst_
  153. .. include:: explain_precision.rst_
  154. Examples
  155. --------
  156. To find 5 by 5 minute block medians from the ASCII data in ship_15.txt
  157. and output a binary table with double precision triplets, run::
  158. gmt blockmedian @ship_15.txt -R245/255/20/30 -I5m -bo3d > ship_5x5.b
  159. To compute the shape of a data distribution per bin via a
  160. box-and-whisker diagram we need the 0%, 25%, 50%, 75%, and 100%
  161. quantiles. To do so on a global 5 by 5 degree basis from the ASCII table
  162. mars370.txt and send output to an ASCII table, run::
  163. gmt blockmedian @mars370.txt -Rg -I5 -Eb -r > mars_5x5.txt
  164. To determine the median and L1 scale (MAD) on the median per 10 minute bin and save these to two separate grids
  165. called field_z.nc and field_s.nc, run::
  166. gmt blockmedian @ship_15.txt -I10m -R-115/-105/20/30 -E -Gfield_%s.nc -Azs
  167. See Also
  168. --------
  169. :doc:`blockmean`,
  170. :doc:`blockmode`, :doc:`gmt`,
  171. :doc:`gmt.conf`,
  172. :doc:`greenspline`,
  173. :doc:`nearneighbor`,
  174. :doc:`surface`,
  175. :doc:`sphtriangulate`,
  176. :doc:`triangulate`
Tip!

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

Comments

Loading...