gmt 0.1.6 → 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 +4 -4
- data/ext/gmt/gmt.c +99 -39
- data/lib/gmt.rb +63 -55
- metadata +10 -11
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 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,20 +42,19 @@ | |
| 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 | 
             
            #
         | 
| @@ -71,8 +62,7 @@ | |
| 71 62 | 
             
            # _argument_, but recall that arguments must proceed the options hash,
         | 
| 72 63 | 
             
            # so the above would be
         | 
| 73 64 | 
             
            #
         | 
| 74 | 
            -
            #    gmt.makecpt('depths.txt',
         | 
| 75 | 
            -
            #                :Z, C: 'gebco', i: 2, E: 24, :> => 'my_depths.cpt')
         | 
| 65 | 
            +
            #    gmt.makecpt('depths.txt', :Z, C: 'gebco', i: 2, E: 24, :> => 'bath.cpt')
         | 
| 76 66 | 
             
            #
         | 
| 77 67 | 
             
            # using this format.
         | 
| 78 68 | 
             
            #
         | 
| @@ -84,17 +74,17 @@ | |
| 84 74 | 
             
            # and error-prone on the command-line, and more so in the "options hash"
         | 
| 85 75 | 
             
            # representation in the Ruby module.
         | 
| 86 76 | 
             
            #
         | 
| 87 | 
            -
            # So we add some  | 
| 77 | 
            +
            # So we add some syntactic sugar for these PostScript functions: if the
         | 
| 88 78 | 
             
            # options hash has the keys +:position+ (with values one of +:first+, +:middle+,
         | 
| 89 79 | 
             
            # or +:last+) and +:file+ (with the value of the ouptut file), then the
         | 
| 90 80 | 
             
            # +-O+ and +-K+ options and the output redirection are handled by the class.
         | 
| 91 81 | 
             
            # So one might write
         | 
| 92 82 | 
             
            #
         | 
| 93 83 | 
             
            #     gmt = GMT.new
         | 
| 94 | 
            -
            #     gmt.psbasemap(  | 
| 95 | 
            -
            #     gmt.pstext(     | 
| 96 | 
            -
            #     gmt.psxy(       | 
| 97 | 
            -
            #     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)
         | 
| 98 88 | 
             
            #
         | 
| 99 89 | 
             
            class GMT
         | 
| 100 90 |  | 
| @@ -142,7 +132,7 @@ class GMT | |
| 142 132 | 
             
                #   @param [Array<String>] files The input files
         | 
| 143 133 | 
             
                #   @param [Hash] options The GMT command-line options in hash form
         | 
| 144 134 | 
             
                #   @return [Boolean] +true+ on success
         | 
| 145 | 
            -
                #   @see  | 
| 135 | 
            +
                #   @see https://docs.generic-mapping-tools.org/latest/$1.html
         | 
| 146 136 | 
             
                def wrapper_ps(method)
         | 
| 147 137 | 
             
                  define_method(method) do |*args, **opts|
         | 
| 148 138 | 
             
                    args, opts = arg_opt_normalise(args, opts)
         | 
| @@ -157,7 +147,7 @@ class GMT | |
| 157 147 | 
             
                #   @param [Array<String>] arguments The arguments
         | 
| 158 148 | 
             
                #   @param [Hash] options The GMT command-line options in hash form
         | 
| 159 149 | 
             
                #   @return [Boolean] +true+ on success
         | 
| 160 | 
            -
                #   @see  | 
| 150 | 
            +
                #   @see https://docs.generic-mapping-tools.org/latest/$1.html
         | 
| 161 151 | 
             
                def wrapper_other(method)
         | 
| 162 152 | 
             
                  define_method(method) do |*args, **opts|
         | 
| 163 153 | 
             
                    args, opts = arg_opt_normalise(args, opts)
         | 
| @@ -215,11 +205,11 @@ class GMT | |
| 215 205 | 
             
                  file_opts =
         | 
| 216 206 | 
             
                    case position
         | 
| 217 207 | 
             
                    when :first, 'first'
         | 
| 218 | 
            -
                      { : | 
| 208 | 
            +
                      { K: nil, :> => file }
         | 
| 219 209 | 
             
                    when :middle, 'middle'
         | 
| 220 | 
            -
                      { : | 
| 210 | 
            +
                      { O: nil, K: nil, :>> => file }
         | 
| 221 211 | 
             
                    when :last, 'last'
         | 
| 222 | 
            -
                      { : | 
| 212 | 
            +
                      { O: nil, :>> => file }
         | 
| 223 213 | 
             
                    else
         | 
| 224 214 | 
             
                      raise ArgumentError, 'position should be :first, :middle or :last'
         | 
| 225 215 | 
             
                    end
         | 
| @@ -257,25 +247,7 @@ class GMT | |
| 257 247 |  | 
| 258 248 | 
             
              public
         | 
| 259 249 |  | 
| 260 | 
            -
              # @!group  | 
| 261 | 
            -
             | 
| 262 | 
            -
              # L2 (x,y,z) table data filter/decimator
         | 
| 263 | 
            -
              wrapper_other :blockmean
         | 
| 264 | 
            -
             | 
| 265 | 
            -
              # L1 (x,y,z) table data filter/decimator
         | 
| 266 | 
            -
              wrapper_other :blockmedian
         | 
| 267 | 
            -
             | 
| 268 | 
            -
              # Mode estimate (x,y,z) table data filter/decimator
         | 
| 269 | 
            -
              wrapper_other :blockmode
         | 
| 270 | 
            -
             | 
| 271 | 
            -
              # Time domain filtering of 1-D data tables
         | 
| 272 | 
            -
              wrapper_other :filter1d
         | 
| 273 | 
            -
             | 
| 274 | 
            -
              # Filter 2-D gridded data sets in the space domain
         | 
| 275 | 
            -
              wrapper_other :grdfilter
         | 
| 276 | 
            -
             | 
| 277 | 
            -
             | 
| 278 | 
            -
              # @!group Plotting of 1-D and 2-D Data
         | 
| 250 | 
            +
              # @!group Plotting
         | 
| 279 251 |  | 
| 280 252 | 
             
              # Plot the GMT logo on maps
         | 
| 281 253 | 
             
              wrapper_ps :gmtlogo
         | 
| @@ -340,8 +312,32 @@ class GMT | |
| 340 312 | 
             
              # Plot data on ternary diagrams
         | 
| 341 313 | 
             
              wrapper_ps :psternary
         | 
| 342 314 |  | 
| 315 | 
            +
              # Plot event symbols and labels for a moment in time
         | 
| 316 | 
            +
              wrapper_ps :psevents
         | 
| 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
         | 
| 343 338 |  | 
| 344 | 
            -
             | 
| 339 | 
            +
             | 
| 340 | 
            +
              # @!group Gridding
         | 
| 345 341 |  | 
| 346 342 | 
             
              # Interpolation with Green’s functions for splines in 1–3 D
         | 
| 347 343 | 
             
              wrapper_other :greenspline
         | 
| @@ -359,7 +355,7 @@ class GMT | |
| 359 355 | 
             
              wrapper_other :triangulate
         | 
| 360 356 |  | 
| 361 357 |  | 
| 362 | 
            -
              # @!group Sampling of 1-D and 2-D  | 
| 358 | 
            +
              # @!group Sampling of 1-D and 2-D data
         | 
| 363 359 |  | 
| 364 360 | 
             
              # Line reduction using the Douglas-Peucker algorithm
         | 
| 365 361 | 
             
              wrapper_other :gmtsimplify
         | 
| @@ -374,7 +370,7 @@ class GMT | |
| 374 370 | 
             
              wrapper_other :sample1d
         | 
| 375 371 |  | 
| 376 372 |  | 
| 377 | 
            -
              # @!group Projection and  | 
| 373 | 
            +
              # @!group Projection and map-transformation
         | 
| 378 374 |  | 
| 379 375 | 
             
              # Project gridded data sets onto a new coordinate system
         | 
| 380 376 | 
             
              wrapper_other :grdproject
         | 
| @@ -386,7 +382,7 @@ class GMT | |
| 386 382 | 
             
              wrapper_other :project
         | 
| 387 383 |  | 
| 388 384 |  | 
| 389 | 
            -
              # @!group  | 
| 385 | 
            +
              # @!group Information retrieval
         | 
| 390 386 |  | 
| 391 387 | 
             
              # List the current default settings
         | 
| 392 388 | 
             
              wrapper_other :gmtdefaults
         | 
| @@ -404,7 +400,7 @@ class GMT | |
| 404 400 | 
             
              wrapper_other :grdinfo
         | 
| 405 401 |  | 
| 406 402 |  | 
| 407 | 
            -
              # @!group Mathematical  | 
| 403 | 
            +
              # @!group Mathematical operations on tables or grids
         | 
| 408 404 |  | 
| 409 405 | 
             
              # Mathematical operations on table data
         | 
| 410 406 | 
             
              wrapper_other :gmtmath
         | 
| @@ -425,7 +421,7 @@ class GMT | |
| 425 421 | 
             
              wrapper_other :sphtriangulate
         | 
| 426 422 |  | 
| 427 423 |  | 
| 428 | 
            -
              # @!group Convert or  | 
| 424 | 
            +
              # @!group Convert or extract subsets of data
         | 
| 429 425 |  | 
| 430 426 | 
             
              # Connect segments into more complete lines or polygons
         | 
| 431 427 | 
             
              wrapper_other :gmtconnect
         | 
| @@ -466,8 +462,11 @@ class GMT | |
| 466 462 | 
             
              # Convert an equidistant table xyz file to a 2-D grid file
         | 
| 467 463 | 
             
              wrapper_other :xyz2grd
         | 
| 468 464 |  | 
| 465 | 
            +
              # Create KML image quadtree from single grid
         | 
| 466 | 
            +
              wrapper_other :grd2kml
         | 
| 467 | 
            +
             | 
| 469 468 |  | 
| 470 | 
            -
              # @!group  | 
| 469 | 
            +
              # @!group Trends in 1-D and 2-D data
         | 
| 471 470 |  | 
| 472 471 | 
             
              # Finds the best-fitting great or small circle for a set of points
         | 
| 473 472 | 
             
              wrapper_other :fitcircle
         | 
| @@ -481,8 +480,11 @@ class GMT | |
| 481 480 | 
             
              # Fits polynomial trends to z = f(x,y) series
         | 
| 482 481 | 
             
              wrapper_other :trend2d
         | 
| 483 482 |  | 
| 483 | 
            +
              # Fit trend surface to grids and compute residuals
         | 
| 484 | 
            +
              wrapper_other :grdtrend
         | 
| 485 | 
            +
             | 
| 484 486 |  | 
| 485 | 
            -
              # @!group  | 
| 487 | 
            +
              # @!group Grid operations
         | 
| 486 488 |  | 
| 487 489 | 
             
              # Make color palette table from a grid files
         | 
| 488 490 | 
             
              wrapper_other :grd2cpt
         | 
| @@ -514,8 +516,11 @@ class GMT | |
| 514 516 | 
             
              # Calculate volumes under a surface within specified contour
         | 
| 515 517 | 
             
              wrapper_other :grdvolume
         | 
| 516 518 |  | 
| 519 | 
            +
              # Interpolate across holes in a grid
         | 
| 520 | 
            +
              wrapper_other :grdfill
         | 
| 517 521 |  | 
| 518 | 
            -
             | 
| 522 | 
            +
             | 
| 523 | 
            +
              # @!group Miscellaneous
         | 
| 519 524 |  | 
| 520 525 | 
             
              # Like psxy but plots KML for use in Google Earth
         | 
| 521 526 | 
             
              wrapper_other :gmt2kml
         | 
| @@ -526,6 +531,9 @@ class GMT | |
| 526 531 | 
             
              # Crop and convert PostScript files to raster images, EPS, and PDF
         | 
| 527 532 | 
             
              wrapper_other :psconvert
         | 
| 528 533 |  | 
| 534 | 
            +
              # Execute GDAL raster programs from GMT
         | 
| 535 | 
            +
              wrapper_other :grdgdal
         | 
| 536 | 
            +
             | 
| 529 537 | 
             
            end
         | 
| 530 538 |  | 
| 531 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
         | 
| @@ -95,7 +95,7 @@ dependencies: | |
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 96 | 
             
                    version: '1'
         | 
| 97 97 | 
             
            description: |
         | 
| 98 | 
            -
              A Ruby extension for the Generic Mapping Tools (GMT5)
         | 
| 98 | 
            +
              A Ruby extension for the Generic Mapping Tools (GMT5/6)
         | 
| 99 99 | 
             
              cartographic toolset.
         | 
| 100 100 | 
             
            email: j.j.green@gmx.co.uk
         | 
| 101 101 | 
             
            executables: []
         | 
| @@ -128,11 +128,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 128 128 | 
             
                - !ruby/object:Gem::Version
         | 
| 129 129 | 
             
                  version: '0'
         | 
| 130 130 | 
             
            requirements:
         | 
| 131 | 
            -
            - GMT5 development libraries (compile)
         | 
| 132 | 
            -
            - GMT5 installation (test)
         | 
| 131 | 
            +
            - GMT5/6 development libraries (compile)
         | 
| 132 | 
            +
            - GMT5/6 installation (test)
         | 
| 133 133 | 
             
            - ghostscript (test)
         | 
| 134 | 
            -
             | 
| 135 | 
            -
            rubygems_version: 2.7.6
         | 
| 134 | 
            +
            rubygems_version: 3.1.2
         | 
| 136 135 | 
             
            signing_key: 
         | 
| 137 136 | 
             
            specification_version: 4
         | 
| 138 137 | 
             
            summary: Generic Mapping Tools (GMT)
         |