gmt 0.2.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gmt/gmt.c +49 -6
- data/lib/gmt.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47175ab0f9f220eec500e98bb1b392ec93ae42b61e13c851bae392a0dd4d9d08
|
4
|
+
data.tar.gz: 0f24492604a31c82461d730be0afbc508849ff757939ac99596020f8ffe0c6f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fb19342fb1e3480531f02e1d9ca34203791820952c2d683d5294af027a5f9cc8205f9f2ed07fa452b7a0f9bb4dd51b9bafe36e7b08934e745fea6410cfb4c30
|
7
|
+
data.tar.gz: 8e59daf96977b38a4498c7934d04ec302c7044a50af43e07ad36118742c87070d1d1eb268578f4c3a17c41a3c04912d3db1afd849b0e16d96cce98b7b13f9172
|
data/ext/gmt/gmt.c
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#include <ruby.h>
|
2
|
+
#include <ruby/version.h>
|
3
|
+
|
2
4
|
#include <gmt.h>
|
3
5
|
#include <gmt_version.h>
|
4
6
|
|
@@ -27,6 +29,26 @@ static void raise_if_error(int err, const char *module)
|
|
27
29
|
rb_raise(rb_eRuntimeError, "failed call to GMT module %s", module);
|
28
30
|
}
|
29
31
|
|
32
|
+
static void gmt_free(void*);
|
33
|
+
|
34
|
+
static rb_data_type_t data_type = {
|
35
|
+
.wrap_struct_name = "ruby-gmt-wrap",
|
36
|
+
.function = {
|
37
|
+
.dmark = NULL,
|
38
|
+
.dfree = gmt_free,
|
39
|
+
.dsize = NULL,
|
40
|
+
#if RUBY_API_VERSION_CODE < 20700
|
41
|
+
.reserved = { NULL, NULL }
|
42
|
+
#else
|
43
|
+
.dcompact = NULL,
|
44
|
+
.reserved = { NULL }
|
45
|
+
#endif
|
46
|
+
},
|
47
|
+
.parent = NULL,
|
48
|
+
.data = NULL,
|
49
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
50
|
+
};
|
51
|
+
|
30
52
|
/* ruby object interface */
|
31
53
|
|
32
54
|
static void gmt_free(void *p)
|
@@ -38,13 +60,18 @@ static void gmt_free(void *p)
|
|
38
60
|
GMT_Destroy_Session(gmt->session);
|
39
61
|
gmt->session = NULL;
|
40
62
|
}
|
63
|
+
|
64
|
+
free(gmt);
|
41
65
|
}
|
42
66
|
|
43
|
-
static VALUE gmt_alloc(VALUE
|
67
|
+
static VALUE gmt_alloc(VALUE cls)
|
44
68
|
{
|
45
69
|
gmt_t *gmt;
|
46
70
|
|
47
|
-
|
71
|
+
if ((gmt = malloc(sizeof(gmt_t))) == NULL)
|
72
|
+
rb_raise(rb_eNoMemError, "failed to alloc GMT struct");
|
73
|
+
|
74
|
+
VALUE obj = TypedData_Wrap_Struct(cls, &data_type, gmt);
|
48
75
|
|
49
76
|
gmt->session = NULL;
|
50
77
|
|
@@ -55,7 +82,7 @@ static VALUE gmt_init(VALUE self)
|
|
55
82
|
{
|
56
83
|
gmt_t *gmt;
|
57
84
|
|
58
|
-
|
85
|
+
TypedData_Get_Struct(self, gmt_t, &data_type, gmt);
|
59
86
|
|
60
87
|
gmt->session =
|
61
88
|
GMT_Create_Session("Session name", 2, 0, NULL);
|
@@ -70,7 +97,7 @@ static VALUE gmt_release(VALUE self)
|
|
70
97
|
{
|
71
98
|
gmt_t *gmt;
|
72
99
|
|
73
|
-
|
100
|
+
TypedData_Get_Struct(self, gmt_t, &data_type, gmt);
|
74
101
|
|
75
102
|
if (gmt->session)
|
76
103
|
{
|
@@ -89,7 +116,7 @@ static VALUE gmt_simple(const char *name, int argc, VALUE *argv, VALUE self)
|
|
89
116
|
rb_scan_args(argc, argv, "*1", &files, &opts);
|
90
117
|
|
91
118
|
gmt_t *gmt;
|
92
|
-
|
119
|
+
TypedData_Get_Struct(self, gmt_t, &data_type, gmt);
|
93
120
|
raise_unless_class_data(gmt);
|
94
121
|
|
95
122
|
void *session = gmt->session;
|
@@ -114,7 +141,7 @@ static VALUE gmt_simple(const char *name, int argc, VALUE *argv, VALUE self)
|
|
114
141
|
|
115
142
|
The "modern mode" modules (which have a slicker way of routing and
|
116
143
|
combining postscript output) will probably need a different treatment,
|
117
|
-
possibly a more attractive
|
144
|
+
possibly a more attractive one from the Ruby perspective; for now we
|
118
145
|
just limit ourselves to the classic mode.
|
119
146
|
*/
|
120
147
|
|
@@ -203,6 +230,10 @@ GMT_FUN(gmtinfo)
|
|
203
230
|
GMT_FUN(gmtset)
|
204
231
|
GMT_FUN(grdinfo)
|
205
232
|
|
233
|
+
#if API_AT_LEAST(6, 3, 0)
|
234
|
+
GMT_FUN(grdselect)
|
235
|
+
#endif
|
236
|
+
|
206
237
|
/* Mathematical operations on tables or grids */
|
207
238
|
|
208
239
|
GMT_FUN(gmtmath)
|
@@ -233,6 +264,10 @@ GMT_FUN(grd2kml)
|
|
233
264
|
GMT_FUN(grd2rgb) /* https://github.com/GenericMappingTools/gmt/pull/425 */
|
234
265
|
#endif
|
235
266
|
|
267
|
+
#if API_AT_LEAST(6, 2, 0)
|
268
|
+
GMT_FUN(gmtbinstats)
|
269
|
+
#endif
|
270
|
+
|
236
271
|
/* trends in 1-D and 2-D data */
|
237
272
|
|
238
273
|
GMT_FUN(fitcircle)
|
@@ -366,6 +401,10 @@ void Init_gmt(void)
|
|
366
401
|
RB_DPM(gmtset);
|
367
402
|
RB_DPM(grdinfo);
|
368
403
|
|
404
|
+
#if API_AT_LEAST(6, 3, 0)
|
405
|
+
RB_DPM(grdselect);
|
406
|
+
#endif
|
407
|
+
|
369
408
|
/* Mathematical operations on tables or grids */
|
370
409
|
|
371
410
|
RB_DPM(gmtmath);
|
@@ -377,6 +416,10 @@ void Init_gmt(void)
|
|
377
416
|
|
378
417
|
/* Convert or extract subsets of data */
|
379
418
|
|
419
|
+
#if API_AT_LEAST(6, 2, 0)
|
420
|
+
RB_DPM(gmtbinstats);
|
421
|
+
#endif
|
422
|
+
|
380
423
|
RB_DPM(gmtconnect);
|
381
424
|
RB_DPM(gmtconvert);
|
382
425
|
RB_DPM(gmtselect);
|
data/lib/gmt.rb
CHANGED
@@ -402,6 +402,9 @@ class GMT
|
|
402
402
|
# Get information about grid files
|
403
403
|
wrapper_other :grdinfo
|
404
404
|
|
405
|
+
# Make selections or determine common regions from 2-D grids, images or 3-D cubes
|
406
|
+
wrapper_other :grdselect
|
407
|
+
|
405
408
|
|
406
409
|
# @!group Mathematical operations on tables or grids
|
407
410
|
|
@@ -426,6 +429,9 @@ class GMT
|
|
426
429
|
|
427
430
|
# @!group Convert or extract subsets of data
|
428
431
|
|
432
|
+
# Bin spatial data and determine statistics per bin
|
433
|
+
wrapper_other :gmtbinstats
|
434
|
+
|
429
435
|
# Connect segments into more complete lines or polygons
|
430
436
|
wrapper_other :gmtconnect
|
431
437
|
|
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.2.
|
4
|
+
version: 0.2.4
|
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: 2022-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|