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

grd2xyz.rst 5.6 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
  1. .. index:: ! grd2xyz
  2. .. include:: module_core_purpose.rst_
  3. *******
  4. grd2xyz
  5. *******
  6. |grd2xyz_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt grd2xyz** *grid*
  11. [ |-C|\ [**f**\|\ **i**] ]
  12. [ |SYN_OPT-R| ]
  13. [ |SYN_OPT-V| ]
  14. [ |-W|\ [**a**\|\ *weight*] ] [ |-Z|\ [*flags*] ]
  15. [ |SYN_OPT-bo| ]
  16. [ |SYN_OPT-d| ]
  17. [ |SYN_OPT-f| ]
  18. [ **-ho**\ [*n*] ]
  19. [ |SYN_OPT-o| ]
  20. [ |SYN_OPT-qo| ]
  21. [ |SYN_OPT-s| ]
  22. [ |SYN_OPT--| ]
  23. |No-spaces|
  24. Description
  25. -----------
  26. **grd2xyz** reads one or more binary 2-D grid files and writes out
  27. xyz-triplets in ASCII [or binary] format to standard output. Modify the
  28. precision of the ASCII output format by editing the
  29. :term:`FORMAT_FLOAT_OUT` parameter in your :doc:`gmt.conf` file or use
  30. **-**\ **-D_FORMAT**\ =\ *format* on the command line, or choose binary
  31. output using single or double precision storage. As an option you may
  32. output z-values without the (x,y) coordinates; see **-Z** below.
  33. Required Arguments
  34. ------------------
  35. *grid*
  36. Names of 2-D binary grid files to be converted. (See GRID FILE
  37. FORMATS below.)
  38. Optional Arguments
  39. ------------------
  40. .. _-C:
  41. **-C**\ [**f**\|\ **i**]
  42. Replace the x- and y-coordinates on output with the corresponding
  43. column and row numbers. These start at 0 (C-style counting); append
  44. **f** to start at 1 (Fortran-style counting). Alternatively, append
  45. **i** to write just the two columns *index* and *z*, where *index*
  46. is the 1-D indexing that GMT uses when referring to grid nodes.
  47. .. _-R:
  48. .. |Add_-R| replace:: Using the **-R** option
  49. will select a subsection of the grid. If this subsection exceeds the
  50. boundaries of the grid, only the common region will be output.
  51. .. include:: explain_-R.rst_
  52. .. _-V:
  53. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  54. .. include:: explain_-V.rst_
  55. .. _-W:
  56. **-W**\ [**a**\|\ *weight*]
  57. Write out *x,y,z,w*\ , where *w* is the supplied *weight* (or 1 if not
  58. supplied) [Default writes *x,y,z* only]. Choose **-Wa** to compute
  59. weights equal to the area each node represents.
  60. .. _-Z:
  61. **-Z**\ [*flags*]
  62. Write a 1-column ASCII [or binary] table. Output will be organized
  63. according to the specified ordering convention contained in *flags*.
  64. If data should be written by rows, make *flags* start with
  65. **T** (op) if first row is y = ymax or
  66. **B** (ottom) if first row is y = ymin. Then,
  67. append **L** or **R** to indicate that first element should start at
  68. left or right end of row. Likewise for column formats: start with
  69. **L** or **R** to position first column, and then append **T** or
  70. **B** to position first element in a row. For gridline registered
  71. grids: If grid is periodic in x but the written data should not
  72. contain the (redundant) column at x = xmax, append **x**. For grid
  73. periodic in y, skip writing the redundant row at y = ymax by
  74. appending **y**. If the byte-order needs to be swapped, append
  75. **w**. Select one of several data types (all binary except **a**):
  76. * **a** ASCII representation of a single item per record
  77. * **c** int8_t, signed 1-byte character
  78. * **u** uint8_t, unsigned 1-byte character
  79. * **h** int16_t, short 2-byte integer
  80. * **H** uint16_t, unsigned short 2-byte integer
  81. * **i** int32_t, 4-byte integer
  82. * **I** uint32_t, unsigned 4-byte integer
  83. * **l** int64_t, long (8-byte) integer
  84. * **L** uint64_t, unsigned long (8-byte) integer
  85. * **f** 4-byte floating point single precision
  86. * **d** 8-byte floating point double precision
  87. Default format is scanline orientation of ASCII numbers: **-ZTLa**.
  88. .. |Add_-bo| replace:: [Default is 3]. This option
  89. only applies to xyz output; see **-Z** for z table output.
  90. .. include:: explain_-bo.rst_
  91. .. |Add_-d| unicode:: 0x20 .. just an invisible code
  92. .. include:: explain_-d.rst_
  93. .. |Add_-f| replace:: See also **TIME
  94. COORDINATES** below. **-h** Output 1 header record based on
  95. information in the first grid file header. Ignored if binary output
  96. is selected. [Default is no header].
  97. .. include:: explain_-f.rst_
  98. .. include:: explain_-ocols.rst_
  99. .. include:: explain_-qo.rst_
  100. .. include:: explain_-s.rst_
  101. .. include:: explain_help.rst_
  102. .. include:: explain_precision.rst_
  103. .. include:: explain_grd_inout_short.rst_
  104. Non-equidistant x/y Coordinates
  105. -------------------------------
  106. In general, GMT modules cannot accept grids with variable *x* and/or *y* coordinates as most
  107. algorithms and plotting options expect equidistant grids. However, you can use **grd2xyz**
  108. to dump the original *x y z* triplets and then reprocess the data onto an equidistant
  109. lattice via :doc:`greenspline`, :doc:`nearneighbor` or :doc:`surface`, for instance.
  110. Time Coordinates
  111. ----------------
  112. Time coordinates in netCDF grids, be it the x, y, or z coordinate, will
  113. be recognized as such. The variable's **unit** attribute is parsed to
  114. determine the unit and epoch of the time coordinate in the grid. Values
  115. are then converted to the internal time system specified by
  116. :term:`TIME_UNIT` and :term:`TIME_EPOCH` in the
  117. :doc:`gmt.conf` file or on the
  118. command line. The default output is relative time in that time system,
  119. or absolute time when using the option **-f0T**, **-f1T**, or **-f2T**
  120. for x, y, or z coordinate, respectively.
  121. Examples
  122. --------
  123. To edit individual values in the 2' by 2' remote AFR.nc file, dump the .nc to ASCII::
  124. gmt grd2xyz @AFR.nc > AFR.xyz
  125. To write a single precision binary file without the x,y positions from
  126. the remote file @AFR.nc file, using scanline orientation, run::
  127. gmt grd2xyz @AFR.nc -ZTLf > AFR.b
  128. See Also
  129. --------
  130. :doc:`gmt.conf`, :doc:`gmt`,
  131. :doc:`grdedit`, :doc:`grdconvert`,
  132. :doc:`xyz2grd`
Tip!

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

Comments

Loading...