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

grdedit.rst 6.1 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
  1. .. index:: ! grdedit
  2. .. include:: module_core_purpose.rst_
  3. *******
  4. grdedit
  5. *******
  6. |grdedit_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt grdedit** *grid* [ |-A| ] [ |-C| ]
  11. [ |-D|\ [**+x**\ *xname*][**+y**\ *yname*][**+z**\ *zname*][**+s**\ *scale*][**+o**\ *offset*][**+n**\ *invalid*][**+t**\ *title*][**+r**\ *remark*] ]
  12. [ |-E|\ [**a**\|\ **h**\|\ **l**\|\ **r**\|\ **t**\|\ **v**] ]
  13. [ |-G|\ *outgrid* ]
  14. [ |-J|\ *parameters* ]
  15. [ |-L|\ [**+n**\|\ **p**] ]
  16. [ |-N|\ *table* ]
  17. [ |SYN_OPT-R| ]
  18. [ |-S| ] [ |-T| ]
  19. [ |SYN_OPT-V| ]
  20. [ |SYN_OPT-bi| ]
  21. [ |SYN_OPT-di| ]
  22. [ |SYN_OPT-e| ]
  23. [ |SYN_OPT-f| ]
  24. [ |SYN_OPT-h| ]
  25. [ |SYN_OPT-i| ]
  26. [ |SYN_OPT-:| ]
  27. [ |SYN_OPT--| ]
  28. |No-spaces|
  29. Description
  30. -----------
  31. **grdedit** reads the header information in a binary 2-D grid file and
  32. replaces the information with values provided on the command line [if
  33. any]. As an option, global, geographical grids (with 360 degrees
  34. longitude range) can be rotated in the east-west direction, and
  35. individual nodal values can be replaced from a table of *x*, *y*, *z*
  36. values. **grdedit** only operates on files containing a grid header. **Note**:
  37. If it is important to retain the original data you should use **-G**
  38. to save the modified grid to a new file.
  39. Required Arguments
  40. ------------------
  41. *grid*
  42. Name of the 2-D grid file to modify. (See GRID FILE FORMATS below).
  43. Optional Arguments
  44. ------------------
  45. .. _-A:
  46. **-A**
  47. If necessary, adjust the file's *x_inc*, *y_inc* to be compatible
  48. with its domain (or a new domain set with **-R**). Older grid files
  49. (i.e., created prior to GMT 3.1) often had excessive slop in
  50. *x_inc*, *y_inc* and an adjustment is necessary. Newer files are
  51. created correctly.
  52. .. _-C:
  53. **-C**
  54. Clear the command history from the grid header.
  55. .. _-D:
  56. .. include:: explain_-D_cap.rst_
  57. .. _-E:
  58. **-E**\ [**a**\|\ **h**\|\ **l**\|\ **r**\|\ **t**\|\ **v**]
  59. Transform the grid in one of six ways and (for **l**\|\ **r**\|\ **t**)
  60. interchange the *x* and *y* information:
  61. **-Ea** will rotate the grid around 180 degrees,
  62. **-Eh** will flip the grid horizontally (left-to-right),
  63. **-El** will rotate the grid 90 degrees counter-clockwise (left),
  64. **-Er** will rotate the grid 90 degrees clockwise (right),
  65. **-Et** will transpose the grid [Default],
  66. **-Ev** will flip the grid vertically (top-to-bottom).
  67. Incompatible with the other options (except **-G**).
  68. .. _-G:
  69. **-G**\ *outgrid*
  70. Normally, **grdedit** will overwrite the existing grid with the modified grid.
  71. Use **-G** to write the modified grid to the file *outgrid* instead.
  72. .. _-J:
  73. .. |Add_-J| replace:: Use the **-J** syntax to save the georeferencing info as CF-1 compliant
  74. metadata in netCDF grids. This metadata will be recognized by GDAL.
  75. .. include:: explain_-J.rst_
  76. .. _-L:
  77. **-L**\ [**+n**\|\ **p**]
  78. Adjust the longitude values in the grid (only applies to geographic grids). By default we will
  79. try to adjust *west* and *east* so that *west* >= -180 or *east* <= +180, but this depends on
  80. the range of the longitudes. Append **+n** to force negative longitude values and **+p** to
  81. force positive longitude values.
  82. .. _-N:
  83. **-N**\ *table*
  84. Read the ASCII (or binary; see **-bi**) file
  85. *table* and replace the corresponding nodal values in the grid with
  86. these *x*,\ *y*,\ *z* values.
  87. .. _-R:
  88. .. |Add_-R| replace:: The new w/e/s/n values will
  89. replace those in the grid, and the *x_inc*, *y_inc* values are
  90. adjusted, if necessary.
  91. .. include:: explain_-R.rst_
  92. .. _-S:
  93. **-S**
  94. For global, geographical grids only. Grid values will be shifted
  95. longitudinally according to the new borders given in **-R**.
  96. .. _-T:
  97. **-T**
  98. Make necessary changes in the header to convert a
  99. gridline-registered grid to a pixel-registered grid, or vice-versa.
  100. Basically, gridline-registered grids will have their domain extended
  101. by half the x- and y-increments whereas pixel-registered grids will
  102. have their domain shrunk by the same amount.
  103. .. _-V:
  104. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  105. .. include:: explain_-V.rst_
  106. .. |Add_-bi| replace:: [Default is 3 input columns].
  107. .. include:: explain_-bi.rst_
  108. .. |Add_-di| unicode:: 0x20 .. just an invisible code
  109. .. include:: explain_-di.rst_
  110. .. |Add_-e| unicode:: 0x20 .. just an invisible code
  111. .. include:: explain_-e.rst_
  112. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  113. .. include:: explain_-f.rst_
  114. .. |Add_-h| unicode:: 0x20 .. just an invisible code
  115. .. include:: explain_-h.rst_
  116. .. include:: explain_-icols.rst_
  117. .. include:: explain_help.rst_
  118. .. include:: explain_grd_inout_short.rst_
  119. .. include:: explain_grd_coord.rst_
  120. Examples
  121. --------
  122. .. include:: explain_example.rst_
  123. Let us assume the file data.nc covers the area 300/310/10/30. We want to
  124. change the boundaries from geodetic longitudes to geographic and put a
  125. new title in the header. We accomplish this by::
  126. gmt grdedit data.nc -R-60/-50/10/30 -D+t"Gravity Anomalies"
  127. The grid world.nc has the limits 0/360/-72/72. To shift the data so that
  128. the limits would be -180/180/-72/72, use::
  129. gmt grdedit world.nc -R-180/180/-72/72 -S
  130. The file junk.nc was created prior to GMT 3.1 with incompatible
  131. **-R** and **-I** arguments. To reset the x- and y-increments we run::
  132. gmt grdedit junk.nc -A
  133. The file junk.nc was created prior to GMT 4.1.3 and does not contain
  134. the required information to indicate that the grid is geographic. To add
  135. this information, run::
  136. gmt grdedit junk.nc -fg
  137. To rotate the grid oblique.nc 90 degrees counter-clockwise and write out
  138. the rotated grid to a new file, run::
  139. gmt grdedit oblique.nc -El -Goblique_rot.nc
  140. To ensure that the grid depths.nc only has positive longitude values, run::
  141. gmt grdedit depths.nc -L+p
  142. Notes:
  143. ------
  144. This module is not a general editor for netCDF files. If your netCDF file
  145. contains more than one 2-D (or higher dimension) data layer, then only the
  146. selected layer will be written out if changes are requested. Likewise,
  147. if you have additional netCDF attributes then those will also be lost in
  148. any revised output.
  149. See Also
  150. --------
  151. :doc:`gmt`,
  152. :doc:`grd2xyz`,
  153. :doc:`grdfill`,
  154. :doc:`grdinfo`,
  155. :doc:`xyz2grd`
Tip!

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

Comments

Loading...