gmt 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/ext/gmt/gmt.c +99 -39
- data/lib/gmt.rb +113 -78
- metadata +27 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: bcb103c5d9934352f0d7a88c13b8e6c2478d3fd34dc147b43e437081c456652c
|
|
4
|
+
data.tar.gz: ac99f95bbf7d47b162b7bb5a52e6d5a761d5bafa62149546555cae1bf3dd9878
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aaebef5a24b0f5d72c546b3823f2210f1129195ba1afa6cdc967e81b2808c3a11f520dca9e801b7f100e38162829961202c3f9bbb1134632514a37c9179ef1b3
|
|
7
|
+
data.tar.gz: 1e972987f36a448c7e0389b4ced616c7683f543ad4e289856d61c553d07227487178e505d587459ce5024bc8d952af4db6c17e9a0e2d96f58fd2377fad13605e
|
data/ext/gmt/gmt.c
CHANGED
|
@@ -106,7 +106,17 @@ static VALUE gmt_simple(const char *name, int argc, VALUE *argv, VALUE self)
|
|
|
106
106
|
return Qtrue;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
/*
|
|
109
|
+
/*
|
|
110
|
+
The GMT functions
|
|
111
|
+
|
|
112
|
+
We take this list from the GMT documentation for the "classic mode"
|
|
113
|
+
https://docs.generic-mapping-tools.org/latest/modules-classic.html
|
|
114
|
+
|
|
115
|
+
The "modern mode" modules (which have a slicker way of routing and
|
|
116
|
+
combining postscript output) will probably need a different treatment,
|
|
117
|
+
possibly a more attractive on from the Ruby perspective; for now we
|
|
118
|
+
just limit ourselves to the classic mode.
|
|
119
|
+
*/
|
|
110
120
|
|
|
111
121
|
#define GMT_FUN(name) \
|
|
112
122
|
static VALUE gmt_ ## name (int argc, VALUE *argv, VALUE self) \
|
|
@@ -114,15 +124,7 @@ static VALUE gmt_ ## name (int argc, VALUE *argv, VALUE self) \
|
|
|
114
124
|
return gmt_simple(#name, argc, argv, self); \
|
|
115
125
|
}
|
|
116
126
|
|
|
117
|
-
/*
|
|
118
|
-
|
|
119
|
-
GMT_FUN(blockmean)
|
|
120
|
-
GMT_FUN(blockmedian)
|
|
121
|
-
GMT_FUN(blockmode)
|
|
122
|
-
GMT_FUN(filter1d)
|
|
123
|
-
GMT_FUN(grdfilter)
|
|
124
|
-
|
|
125
|
-
/* Plotting of 1-D and 2-D Data */
|
|
127
|
+
/* Plotting */
|
|
126
128
|
|
|
127
129
|
GMT_FUN(gmtlogo)
|
|
128
130
|
GMT_FUN(grdcontour)
|
|
@@ -152,7 +154,23 @@ GMT_FUN(pssolar)
|
|
|
152
154
|
GMT_FUN(psternary)
|
|
153
155
|
#endif
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
158
|
+
GMT_FUN(psevents)
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
/* Filtering */
|
|
162
|
+
|
|
163
|
+
GMT_FUN(blockmean)
|
|
164
|
+
GMT_FUN(blockmedian)
|
|
165
|
+
GMT_FUN(blockmode)
|
|
166
|
+
GMT_FUN(filter1d)
|
|
167
|
+
GMT_FUN(grdfilter)
|
|
168
|
+
|
|
169
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
170
|
+
GMT_FUN(dimfilter)
|
|
171
|
+
#endif
|
|
172
|
+
|
|
173
|
+
/* Gridding */
|
|
156
174
|
|
|
157
175
|
GMT_FUN(greenspline)
|
|
158
176
|
GMT_FUN(nearneighbor)
|
|
@@ -160,20 +178,20 @@ GMT_FUN(sphinterpolate)
|
|
|
160
178
|
GMT_FUN(surface)
|
|
161
179
|
GMT_FUN(triangulate)
|
|
162
180
|
|
|
163
|
-
/* Sampling of 1-D and 2-D
|
|
181
|
+
/* Sampling of 1-D and 2-D data */
|
|
164
182
|
|
|
165
183
|
GMT_FUN(gmtsimplify)
|
|
166
184
|
GMT_FUN(grdsample)
|
|
167
185
|
GMT_FUN(grdtrack)
|
|
168
186
|
GMT_FUN(sample1d)
|
|
169
187
|
|
|
170
|
-
/* Projection and
|
|
188
|
+
/* Projection and map-transformation */
|
|
171
189
|
|
|
172
190
|
GMT_FUN(grdproject)
|
|
173
191
|
GMT_FUN(mapproject)
|
|
174
192
|
GMT_FUN(project)
|
|
175
193
|
|
|
176
|
-
/*
|
|
194
|
+
/* Information retrieval */
|
|
177
195
|
|
|
178
196
|
GMT_FUN(gmtdefaults)
|
|
179
197
|
GMT_FUN(gmtget)
|
|
@@ -181,7 +199,7 @@ GMT_FUN(gmtinfo)
|
|
|
181
199
|
GMT_FUN(gmtset)
|
|
182
200
|
GMT_FUN(grdinfo)
|
|
183
201
|
|
|
184
|
-
/* Mathematical
|
|
202
|
+
/* Mathematical operations on tables or grids */
|
|
185
203
|
|
|
186
204
|
GMT_FUN(gmtmath)
|
|
187
205
|
GMT_FUN(makecpt)
|
|
@@ -190,14 +208,13 @@ GMT_FUN(sph2grd)
|
|
|
190
208
|
GMT_FUN(sphdistance)
|
|
191
209
|
GMT_FUN(sphtriangulate)
|
|
192
210
|
|
|
193
|
-
/* Convert or
|
|
211
|
+
/* Convert or extract subsets of data */
|
|
194
212
|
|
|
195
213
|
GMT_FUN(gmtconnect)
|
|
196
214
|
GMT_FUN(gmtconvert)
|
|
197
215
|
GMT_FUN(gmtselect)
|
|
198
216
|
GMT_FUN(gmtspatial)
|
|
199
217
|
GMT_FUN(gmtvector)
|
|
200
|
-
GMT_FUN(grd2rgb)
|
|
201
218
|
GMT_FUN(grd2xyz)
|
|
202
219
|
GMT_FUN(grdblend)
|
|
203
220
|
GMT_FUN(grdconvert)
|
|
@@ -206,14 +223,24 @@ GMT_FUN(grdpaste)
|
|
|
206
223
|
GMT_FUN(splitxyz)
|
|
207
224
|
GMT_FUN(xyz2grd)
|
|
208
225
|
|
|
209
|
-
|
|
226
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
227
|
+
GMT_FUN(grd2kml)
|
|
228
|
+
#else
|
|
229
|
+
GMT_FUN(grd2rgb) /* https://github.com/GenericMappingTools/gmt/pull/425 */
|
|
230
|
+
#endif
|
|
231
|
+
|
|
232
|
+
/* trends in 1-D and 2-D data */
|
|
210
233
|
|
|
211
234
|
GMT_FUN(fitcircle)
|
|
212
235
|
GMT_FUN(gmtregress)
|
|
213
236
|
GMT_FUN(trend1d)
|
|
214
237
|
GMT_FUN(trend2d)
|
|
215
238
|
|
|
216
|
-
|
|
239
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
240
|
+
GMT_FUN(grdtrend)
|
|
241
|
+
#endif
|
|
242
|
+
|
|
243
|
+
/* Grid operations */
|
|
217
244
|
|
|
218
245
|
GMT_FUN(grd2cpt)
|
|
219
246
|
GMT_FUN(grdclip)
|
|
@@ -226,12 +253,20 @@ GMT_FUN(grdmask)
|
|
|
226
253
|
GMT_FUN(grdmath)
|
|
227
254
|
GMT_FUN(grdvolume)
|
|
228
255
|
|
|
229
|
-
|
|
256
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
257
|
+
GMT_FUN(grdfill)
|
|
258
|
+
#endif
|
|
259
|
+
|
|
260
|
+
/* Miscellaneous */
|
|
230
261
|
|
|
231
262
|
GMT_FUN(gmt2kml)
|
|
232
263
|
GMT_FUN(kml2gmt)
|
|
233
264
|
GMT_FUN(psconvert)
|
|
234
265
|
|
|
266
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
267
|
+
GMT_FUN(grdgdal)
|
|
268
|
+
#endif
|
|
269
|
+
|
|
235
270
|
#undef GMT_FUN
|
|
236
271
|
|
|
237
272
|
#define RB_DPM(name) rb_define_private_method(cGMT, #name "_c", gmt_ ## name, -1)
|
|
@@ -244,15 +279,7 @@ void Init_gmt(void)
|
|
|
244
279
|
rb_define_method(cGMT, "initialize", gmt_init, 0);
|
|
245
280
|
rb_define_method(cGMT, "free", gmt_release, 0);
|
|
246
281
|
|
|
247
|
-
/*
|
|
248
|
-
|
|
249
|
-
RB_DPM(blockmean);
|
|
250
|
-
RB_DPM(blockmedian);
|
|
251
|
-
RB_DPM(blockmode);
|
|
252
|
-
RB_DPM(filter1d);
|
|
253
|
-
RB_DPM(grdfilter);
|
|
254
|
-
|
|
255
|
-
/* Plotting of 1-D and 2-D Data */
|
|
282
|
+
/* Plotting */
|
|
256
283
|
|
|
257
284
|
RB_DPM(gmtlogo);
|
|
258
285
|
RB_DPM(grdcontour);
|
|
@@ -282,7 +309,23 @@ void Init_gmt(void)
|
|
|
282
309
|
RB_DPM(psternary);
|
|
283
310
|
#endif
|
|
284
311
|
|
|
285
|
-
|
|
312
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
313
|
+
RB_DPM(psevents);
|
|
314
|
+
#endif
|
|
315
|
+
|
|
316
|
+
/* Filtering */
|
|
317
|
+
|
|
318
|
+
RB_DPM(blockmean);
|
|
319
|
+
RB_DPM(blockmedian);
|
|
320
|
+
RB_DPM(blockmode);
|
|
321
|
+
RB_DPM(filter1d);
|
|
322
|
+
RB_DPM(grdfilter);
|
|
323
|
+
|
|
324
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
325
|
+
RB_DPM(dimfilter);
|
|
326
|
+
#endif
|
|
327
|
+
|
|
328
|
+
/* Gridding */
|
|
286
329
|
|
|
287
330
|
RB_DPM(greenspline);
|
|
288
331
|
RB_DPM(nearneighbor);
|
|
@@ -290,20 +333,20 @@ void Init_gmt(void)
|
|
|
290
333
|
RB_DPM(surface);
|
|
291
334
|
RB_DPM(triangulate);
|
|
292
335
|
|
|
293
|
-
/* Sampling of 1-D and 2-D
|
|
336
|
+
/* Sampling of 1-D and 2-D data */
|
|
294
337
|
|
|
295
338
|
RB_DPM(gmtsimplify);
|
|
296
339
|
RB_DPM(grdsample);
|
|
297
340
|
RB_DPM(grdtrack);
|
|
298
341
|
RB_DPM(sample1d);
|
|
299
342
|
|
|
300
|
-
/* Projection and
|
|
343
|
+
/* Projection and map-transformation */
|
|
301
344
|
|
|
302
345
|
RB_DPM(grdproject);
|
|
303
346
|
RB_DPM(mapproject);
|
|
304
347
|
RB_DPM(project);
|
|
305
348
|
|
|
306
|
-
/*
|
|
349
|
+
/* Information retrieval */
|
|
307
350
|
|
|
308
351
|
RB_DPM(gmtdefaults);
|
|
309
352
|
RB_DPM(gmtget);
|
|
@@ -311,7 +354,7 @@ void Init_gmt(void)
|
|
|
311
354
|
RB_DPM(gmtset);
|
|
312
355
|
RB_DPM(grdinfo);
|
|
313
356
|
|
|
314
|
-
/* Mathematical
|
|
357
|
+
/* Mathematical operations on tables or grids */
|
|
315
358
|
|
|
316
359
|
RB_DPM(gmtmath);
|
|
317
360
|
RB_DPM(makecpt);
|
|
@@ -320,14 +363,13 @@ void Init_gmt(void)
|
|
|
320
363
|
RB_DPM(sphdistance);
|
|
321
364
|
RB_DPM(sphtriangulate);
|
|
322
365
|
|
|
323
|
-
/* Convert or
|
|
366
|
+
/* Convert or extract subsets of data */
|
|
324
367
|
|
|
325
368
|
RB_DPM(gmtconnect);
|
|
326
369
|
RB_DPM(gmtconvert);
|
|
327
370
|
RB_DPM(gmtselect);
|
|
328
371
|
RB_DPM(gmtspatial);
|
|
329
372
|
RB_DPM(gmtvector);
|
|
330
|
-
RB_DPM(grd2rgb);
|
|
331
373
|
RB_DPM(grd2xyz);
|
|
332
374
|
RB_DPM(grdblend);
|
|
333
375
|
RB_DPM(grdconvert);
|
|
@@ -336,14 +378,24 @@ void Init_gmt(void)
|
|
|
336
378
|
RB_DPM(splitxyz);
|
|
337
379
|
RB_DPM(xyz2grd);
|
|
338
380
|
|
|
339
|
-
|
|
381
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
382
|
+
RB_DPM(grd2kml);
|
|
383
|
+
#else
|
|
384
|
+
RB_DPM(grd2rgb); /* https://github.com/GenericMappingTools/gmt/pull/425 */
|
|
385
|
+
#endif
|
|
386
|
+
|
|
387
|
+
/* Trends in 1-D and 2-D data */
|
|
340
388
|
|
|
341
389
|
RB_DPM(fitcircle);
|
|
342
390
|
RB_DPM(gmtregress);
|
|
343
391
|
RB_DPM(trend1d);
|
|
344
392
|
RB_DPM(trend2d);
|
|
345
393
|
|
|
346
|
-
|
|
394
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
395
|
+
RB_DPM(grdtrend);
|
|
396
|
+
#endif
|
|
397
|
+
|
|
398
|
+
/* Grid operations */
|
|
347
399
|
|
|
348
400
|
RB_DPM(grd2cpt);
|
|
349
401
|
RB_DPM(grdclip);
|
|
@@ -356,12 +408,20 @@ void Init_gmt(void)
|
|
|
356
408
|
RB_DPM(grdmath);
|
|
357
409
|
RB_DPM(grdvolume);
|
|
358
410
|
|
|
359
|
-
|
|
411
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
412
|
+
RB_DPM(grdfill);
|
|
413
|
+
#endif
|
|
414
|
+
|
|
415
|
+
/* Miscellaneous */
|
|
360
416
|
|
|
361
417
|
RB_DPM(gmt2kml);
|
|
362
418
|
RB_DPM(kml2gmt);
|
|
363
419
|
RB_DPM(psconvert);
|
|
364
420
|
|
|
421
|
+
#if API_AT_LEAST(6, 0, 0)
|
|
422
|
+
RB_DPM(grdgdal);
|
|
423
|
+
#endif
|
|
424
|
+
|
|
365
425
|
/* version constants */
|
|
366
426
|
|
|
367
427
|
rb_define_const(cGMT, "VERSION_MAJOR", INT2NUM(GMT_MAJOR_VERSION));
|
data/lib/gmt.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This class provides a native extension accessing the programs of
|
|
2
|
-
# the {
|
|
2
|
+
# the {https://docs.generic-mapping-tools.org Generic Mapping Tools};
|
|
3
3
|
# an open source collection of about 80 command-line tools for
|
|
4
4
|
# manipulating geographic and Cartesian data sets (including filtering,
|
|
5
5
|
# trend fitting, gridding, projecting, etc.) and producing PostScript
|
|
@@ -13,16 +13,8 @@
|
|
|
13
13
|
# common = { file: 'output.ps', R: '0/3/0/2', J: 'x1i' }
|
|
14
14
|
#
|
|
15
15
|
# GMT.session do |gmt|
|
|
16
|
-
# gmt.psxy('dots.xy',
|
|
17
|
-
#
|
|
18
|
-
# position: :first,
|
|
19
|
-
# S: 'c0.50c',
|
|
20
|
-
# G: 'blue'))
|
|
21
|
-
# gmt.psxy('dots.xy',
|
|
22
|
-
# common.merge(
|
|
23
|
-
# position: :last,
|
|
24
|
-
# S: 'c0.25c',
|
|
25
|
-
# G: 'red'))
|
|
16
|
+
# gmt.psxy('dots.xy', position: :first, S: 'c0.50c', G: 'blue', **common)
|
|
17
|
+
# gmt.psxy('dots.xy', position: :last, S: 'c0.25c', G: 'red', **common)
|
|
26
18
|
# end
|
|
27
19
|
#
|
|
28
20
|
# Those familiar with GMT will recognise the +-R+ (range) and +-J+ (projection)
|
|
@@ -50,23 +42,30 @@
|
|
|
50
42
|
# single options hash. The options hash corresponds to the command-line
|
|
51
43
|
# options of the GMT program; hence the shell command
|
|
52
44
|
#
|
|
53
|
-
# gmt makecpt -Cgebco depths.txt -i2 -Z -E24 >
|
|
45
|
+
# gmt makecpt -Cgebco depths.txt -i2 -Z -E24 > bath.cpt
|
|
54
46
|
#
|
|
55
47
|
# would be replicated by the Ruby
|
|
56
48
|
#
|
|
57
49
|
# gmt = GMT.new
|
|
58
|
-
# gmt.makecpt('depths.txt',
|
|
59
|
-
# :C => 'gebco', :i => 2, :Z => nil, :E => 24, :> => 'my_depths.cpt')
|
|
50
|
+
# gmt.makecpt('depths.txt', C: 'gebco', i: 2, Z: nil, E: 24, :> => 'bath.cpt')
|
|
60
51
|
#
|
|
61
52
|
# Note that
|
|
62
53
|
# - the argument(s) (the input file <code>'depths.txt'</code>) preceed(s)
|
|
63
54
|
# the options hash
|
|
64
55
|
# - the options hash has keys which are symbols
|
|
65
56
|
# - options which lack arguments correspond to hash keys with nil values
|
|
66
|
-
# <code
|
|
57
|
+
# <code>Z: nil</code>.
|
|
67
58
|
# - the output redirection is _also_ treated as hash option, with key
|
|
68
59
|
# <code>:></code> and value which is the output file.
|
|
69
60
|
#
|
|
61
|
+
# The options without argument can also be specifed by a symbol
|
|
62
|
+
# _argument_, but recall that arguments must proceed the options hash,
|
|
63
|
+
# so the above would be
|
|
64
|
+
#
|
|
65
|
+
# gmt.makecpt('depths.txt', :Z, C: 'gebco', i: 2, E: 24, :> => 'bath.cpt')
|
|
66
|
+
#
|
|
67
|
+
# using this format.
|
|
68
|
+
#
|
|
70
69
|
# == PostScript functions
|
|
71
70
|
#
|
|
72
71
|
# When creating complex PostScript plots one needs to make several calls to
|
|
@@ -75,17 +74,17 @@
|
|
|
75
74
|
# and error-prone on the command-line, and more so in the "options hash"
|
|
76
75
|
# representation in the Ruby module.
|
|
77
76
|
#
|
|
78
|
-
# So we add some
|
|
77
|
+
# So we add some syntactic sugar for these PostScript functions: if the
|
|
79
78
|
# options hash has the keys +:position+ (with values one of +:first+, +:middle+,
|
|
80
79
|
# or +:last+) and +:file+ (with the value of the ouptut file), then the
|
|
81
80
|
# +-O+ and +-K+ options and the output redirection are handled by the class.
|
|
82
81
|
# So one might write
|
|
83
82
|
#
|
|
84
83
|
# gmt = GMT.new
|
|
85
|
-
# gmt.psbasemap(
|
|
86
|
-
# gmt.pstext(
|
|
87
|
-
# gmt.psxy(
|
|
88
|
-
# gmt.pslogo(
|
|
84
|
+
# gmt.psbasemap( ..., file: 'map.ps', position: :first)
|
|
85
|
+
# gmt.pstext( ..., file: 'map.ps', position: :middle)
|
|
86
|
+
# gmt.psxy( ..., file: 'map.ps', position: :middle)
|
|
87
|
+
# gmt.pslogo( ..., file: 'map.ps', position: :last)
|
|
89
88
|
#
|
|
90
89
|
class GMT
|
|
91
90
|
|
|
@@ -133,13 +132,13 @@ class GMT
|
|
|
133
132
|
# @param [Array<String>] files The input files
|
|
134
133
|
# @param [Hash] options The GMT command-line options in hash form
|
|
135
134
|
# @return [Boolean] +true+ on success
|
|
136
|
-
# @see
|
|
135
|
+
# @see https://docs.generic-mapping-tools.org/latest/$1.html
|
|
137
136
|
def wrapper_ps(method)
|
|
138
|
-
define_method(method) do |*args, **
|
|
139
|
-
|
|
140
|
-
coerce_postscript_options!(
|
|
141
|
-
coerce_append_option!(
|
|
142
|
-
self.send(api_function(method), *args, options_as_pairs(
|
|
137
|
+
define_method(method) do |*args, **opts|
|
|
138
|
+
args, opts = arg_opt_normalise(args, opts)
|
|
139
|
+
coerce_postscript_options!(opts)
|
|
140
|
+
coerce_append_option!(opts)
|
|
141
|
+
self.send(api_function(method), *args, options_as_pairs(opts))
|
|
143
142
|
end
|
|
144
143
|
end
|
|
145
144
|
|
|
@@ -148,12 +147,12 @@ class GMT
|
|
|
148
147
|
# @param [Array<String>] arguments The arguments
|
|
149
148
|
# @param [Hash] options The GMT command-line options in hash form
|
|
150
149
|
# @return [Boolean] +true+ on success
|
|
151
|
-
# @see
|
|
150
|
+
# @see https://docs.generic-mapping-tools.org/latest/$1.html
|
|
152
151
|
def wrapper_other(method)
|
|
153
|
-
define_method(method) do |*args, **
|
|
154
|
-
|
|
155
|
-
coerce_append_option!(
|
|
156
|
-
self.send(api_function(method), *args, options_as_pairs(
|
|
152
|
+
define_method(method) do |*args, **opts|
|
|
153
|
+
args, opts = arg_opt_normalise(args, opts)
|
|
154
|
+
coerce_append_option!(opts)
|
|
155
|
+
self.send(api_function(method), *args, options_as_pairs(opts))
|
|
157
156
|
end
|
|
158
157
|
end
|
|
159
158
|
|
|
@@ -176,10 +175,22 @@ class GMT
|
|
|
176
175
|
[method.to_s, 'c'].join('_').to_sym
|
|
177
176
|
end
|
|
178
177
|
|
|
179
|
-
# convert arguments to
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
# convert symbol arguments to nil-valued options, and
|
|
179
|
+
# call :to_s on the remaining arguments, so
|
|
180
|
+
#
|
|
181
|
+
# arg_opt_normalise(['a', :b, Pathname('/c')], {d: 'e'})
|
|
182
|
+
#
|
|
183
|
+
# becomes
|
|
184
|
+
#
|
|
185
|
+
# [['a', '/c'], {b: nil, d: 'e'}]
|
|
186
|
+
#
|
|
187
|
+
# returns the normalised arguments and options, does not
|
|
188
|
+
# modify the inputs
|
|
189
|
+
|
|
190
|
+
def arg_opt_normalise(args, opts)
|
|
191
|
+
syms, strs = args.partition { |x| x.is_a? Symbol }
|
|
192
|
+
syms.each { |sym| opts[sym] = nil }
|
|
193
|
+
[strs.map(&:to_s), opts]
|
|
183
194
|
end
|
|
184
195
|
|
|
185
196
|
# for GMT modules which produce PostScript, convert the
|
|
@@ -187,43 +198,43 @@ class GMT
|
|
|
187
198
|
# equivalent of the -K, -O options, and the creation of
|
|
188
199
|
# or appending to the PostScript output file
|
|
189
200
|
|
|
190
|
-
def coerce_postscript_options!(
|
|
191
|
-
file =
|
|
192
|
-
position =
|
|
201
|
+
def coerce_postscript_options!(opts)
|
|
202
|
+
file = opts.delete(:file)
|
|
203
|
+
position = opts.delete(:position)
|
|
193
204
|
if file && position then
|
|
194
|
-
|
|
205
|
+
file_opts =
|
|
195
206
|
case position
|
|
196
207
|
when :first, 'first'
|
|
197
|
-
{ :
|
|
208
|
+
{ K: nil, :> => file }
|
|
198
209
|
when :middle, 'middle'
|
|
199
|
-
{ :
|
|
210
|
+
{ O: nil, K: nil, :>> => file }
|
|
200
211
|
when :last, 'last'
|
|
201
|
-
{ :
|
|
212
|
+
{ O: nil, :>> => file }
|
|
202
213
|
else
|
|
203
214
|
raise ArgumentError, 'position should be :first, :middle or :last'
|
|
204
215
|
end
|
|
205
|
-
|
|
216
|
+
opts.merge!(file_opts)
|
|
206
217
|
end
|
|
207
218
|
end
|
|
208
219
|
|
|
209
220
|
# handle the :>> option
|
|
210
221
|
|
|
211
|
-
def coerce_append_option!(
|
|
212
|
-
if file =
|
|
213
|
-
|
|
222
|
+
def coerce_append_option!(opts)
|
|
223
|
+
if file = opts.delete(:>>) then
|
|
224
|
+
opts[:>] = '>' + file
|
|
214
225
|
end
|
|
215
226
|
end
|
|
216
227
|
|
|
217
228
|
# convert non-nil argument to string
|
|
218
229
|
|
|
219
|
-
def string_unless_nil(
|
|
220
|
-
|
|
230
|
+
def string_unless_nil(arg)
|
|
231
|
+
arg.to_s unless arg.nil?
|
|
221
232
|
end
|
|
222
233
|
|
|
223
234
|
# convert the options hash to an array of pairs
|
|
224
235
|
|
|
225
|
-
def options_as_pairs(
|
|
226
|
-
|
|
236
|
+
def options_as_pairs(opts)
|
|
237
|
+
opts.each_with_object(Array.new) do |(key, values), result|
|
|
227
238
|
if values.respond_to? :each then
|
|
228
239
|
values.each do |value|
|
|
229
240
|
result << [key, string_unless_nil(value)]
|
|
@@ -236,25 +247,7 @@ class GMT
|
|
|
236
247
|
|
|
237
248
|
public
|
|
238
249
|
|
|
239
|
-
# @!group
|
|
240
|
-
|
|
241
|
-
# L2 (x,y,z) table data filter/decimator
|
|
242
|
-
wrapper_other :blockmean
|
|
243
|
-
|
|
244
|
-
# L1 (x,y,z) table data filter/decimator
|
|
245
|
-
wrapper_other :blockmedian
|
|
246
|
-
|
|
247
|
-
# Mode estimate (x,y,z) table data filter/decimator
|
|
248
|
-
wrapper_other :blockmode
|
|
249
|
-
|
|
250
|
-
# Time domain filtering of 1-D data tables
|
|
251
|
-
wrapper_other :filter1d
|
|
252
|
-
|
|
253
|
-
# Filter 2-D gridded data sets in the space domain
|
|
254
|
-
wrapper_other :grdfilter
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
# @!group Plotting of 1-D and 2-D Data
|
|
250
|
+
# @!group Plotting
|
|
258
251
|
|
|
259
252
|
# Plot the GMT logo on maps
|
|
260
253
|
wrapper_ps :gmtlogo
|
|
@@ -313,8 +306,38 @@ class GMT
|
|
|
313
306
|
# Plot symbols, polygons, and lines in 3-D
|
|
314
307
|
wrapper_ps :psxyz
|
|
315
308
|
|
|
309
|
+
# Calculate and plot the day-night terminator
|
|
310
|
+
wrapper_ps :pssolar
|
|
311
|
+
|
|
312
|
+
# Plot data on ternary diagrams
|
|
313
|
+
wrapper_ps :psternary
|
|
314
|
+
|
|
315
|
+
# Plot event symbols and labels for a moment in time
|
|
316
|
+
wrapper_ps :psevents
|
|
316
317
|
|
|
317
|
-
|
|
318
|
+
|
|
319
|
+
# @!group Filtering
|
|
320
|
+
|
|
321
|
+
# L2 (x,y,z) table data filter/decimator
|
|
322
|
+
wrapper_other :blockmean
|
|
323
|
+
|
|
324
|
+
# L1 (x,y,z) table data filter/decimator
|
|
325
|
+
wrapper_other :blockmedian
|
|
326
|
+
|
|
327
|
+
# Mode estimate (x,y,z) table data filter/decimator
|
|
328
|
+
wrapper_other :blockmode
|
|
329
|
+
|
|
330
|
+
# Time domain filtering of 1-D data tables
|
|
331
|
+
wrapper_other :filter1d
|
|
332
|
+
|
|
333
|
+
# Filter 2-D gridded data sets in the space domain
|
|
334
|
+
wrapper_other :grdfilter
|
|
335
|
+
|
|
336
|
+
# Directional filtering of grids in the space domain
|
|
337
|
+
wrapper_other :dimfilter
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
# @!group Gridding
|
|
318
341
|
|
|
319
342
|
# Interpolation with Green’s functions for splines in 1–3 D
|
|
320
343
|
wrapper_other :greenspline
|
|
@@ -332,7 +355,7 @@ class GMT
|
|
|
332
355
|
wrapper_other :triangulate
|
|
333
356
|
|
|
334
357
|
|
|
335
|
-
# @!group Sampling of 1-D and 2-D
|
|
358
|
+
# @!group Sampling of 1-D and 2-D data
|
|
336
359
|
|
|
337
360
|
# Line reduction using the Douglas-Peucker algorithm
|
|
338
361
|
wrapper_other :gmtsimplify
|
|
@@ -347,7 +370,7 @@ class GMT
|
|
|
347
370
|
wrapper_other :sample1d
|
|
348
371
|
|
|
349
372
|
|
|
350
|
-
# @!group Projection and
|
|
373
|
+
# @!group Projection and map-transformation
|
|
351
374
|
|
|
352
375
|
# Project gridded data sets onto a new coordinate system
|
|
353
376
|
wrapper_other :grdproject
|
|
@@ -359,7 +382,7 @@ class GMT
|
|
|
359
382
|
wrapper_other :project
|
|
360
383
|
|
|
361
384
|
|
|
362
|
-
# @!group
|
|
385
|
+
# @!group Information retrieval
|
|
363
386
|
|
|
364
387
|
# List the current default settings
|
|
365
388
|
wrapper_other :gmtdefaults
|
|
@@ -377,7 +400,7 @@ class GMT
|
|
|
377
400
|
wrapper_other :grdinfo
|
|
378
401
|
|
|
379
402
|
|
|
380
|
-
# @!group Mathematical
|
|
403
|
+
# @!group Mathematical operations on tables or grids
|
|
381
404
|
|
|
382
405
|
# Mathematical operations on table data
|
|
383
406
|
wrapper_other :gmtmath
|
|
@@ -398,7 +421,7 @@ class GMT
|
|
|
398
421
|
wrapper_other :sphtriangulate
|
|
399
422
|
|
|
400
423
|
|
|
401
|
-
# @!group Convert or
|
|
424
|
+
# @!group Convert or extract subsets of data
|
|
402
425
|
|
|
403
426
|
# Connect segments into more complete lines or polygons
|
|
404
427
|
wrapper_other :gmtconnect
|
|
@@ -439,8 +462,11 @@ class GMT
|
|
|
439
462
|
# Convert an equidistant table xyz file to a 2-D grid file
|
|
440
463
|
wrapper_other :xyz2grd
|
|
441
464
|
|
|
465
|
+
# Create KML image quadtree from single grid
|
|
466
|
+
wrapper_other :grd2kml
|
|
467
|
+
|
|
442
468
|
|
|
443
|
-
# @!group
|
|
469
|
+
# @!group Trends in 1-D and 2-D data
|
|
444
470
|
|
|
445
471
|
# Finds the best-fitting great or small circle for a set of points
|
|
446
472
|
wrapper_other :fitcircle
|
|
@@ -454,8 +480,11 @@ class GMT
|
|
|
454
480
|
# Fits polynomial trends to z = f(x,y) series
|
|
455
481
|
wrapper_other :trend2d
|
|
456
482
|
|
|
483
|
+
# Fit trend surface to grids and compute residuals
|
|
484
|
+
wrapper_other :grdtrend
|
|
485
|
+
|
|
457
486
|
|
|
458
|
-
# @!group
|
|
487
|
+
# @!group Grid operations
|
|
459
488
|
|
|
460
489
|
# Make color palette table from a grid files
|
|
461
490
|
wrapper_other :grd2cpt
|
|
@@ -487,8 +516,11 @@ class GMT
|
|
|
487
516
|
# Calculate volumes under a surface within specified contour
|
|
488
517
|
wrapper_other :grdvolume
|
|
489
518
|
|
|
519
|
+
# Interpolate across holes in a grid
|
|
520
|
+
wrapper_other :grdfill
|
|
490
521
|
|
|
491
|
-
|
|
522
|
+
|
|
523
|
+
# @!group Miscellaneous
|
|
492
524
|
|
|
493
525
|
# Like psxy but plots KML for use in Google Earth
|
|
494
526
|
wrapper_other :gmt2kml
|
|
@@ -499,6 +531,9 @@ class GMT
|
|
|
499
531
|
# Crop and convert PostScript files to raster images, EPS, and PDF
|
|
500
532
|
wrapper_other :psconvert
|
|
501
533
|
|
|
534
|
+
# Execute GDAL raster programs from GMT
|
|
535
|
+
wrapper_other :grdgdal
|
|
536
|
+
|
|
502
537
|
end
|
|
503
538
|
|
|
504
539
|
require 'gmt/gmt'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gmt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- J.J. Green
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '2'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '2'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '13.0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '13.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,16 +72,30 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: 0.2.4
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
82
|
+
version: 0.2.4
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rake-compiler
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '1'
|
|
83
97
|
description: |
|
|
84
|
-
A Ruby extension for the Generic Mapping Tools (GMT5)
|
|
98
|
+
A Ruby extension for the Generic Mapping Tools (GMT5/6)
|
|
85
99
|
cartographic toolset.
|
|
86
100
|
email: j.j.green@gmx.co.uk
|
|
87
101
|
executables: []
|
|
@@ -94,7 +108,7 @@ files:
|
|
|
94
108
|
- ext/gmt/option.c
|
|
95
109
|
- ext/gmt/option.h
|
|
96
110
|
- lib/gmt.rb
|
|
97
|
-
homepage: https://
|
|
111
|
+
homepage: https://gitlab.com/jjg/ruby-gmt
|
|
98
112
|
licenses:
|
|
99
113
|
- MIT
|
|
100
114
|
metadata: {}
|
|
@@ -114,11 +128,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
114
128
|
- !ruby/object:Gem::Version
|
|
115
129
|
version: '0'
|
|
116
130
|
requirements:
|
|
117
|
-
- GMT5 development libraries (compile)
|
|
118
|
-
- GMT5 installation (test)
|
|
131
|
+
- GMT5/6 development libraries (compile)
|
|
132
|
+
- GMT5/6 installation (test)
|
|
119
133
|
- ghostscript (test)
|
|
120
|
-
|
|
121
|
-
rubygems_version: 2.5.1
|
|
134
|
+
rubygems_version: 3.1.2
|
|
122
135
|
signing_key:
|
|
123
136
|
specification_version: 4
|
|
124
137
|
summary: Generic Mapping Tools (GMT)
|