[GRASSLIST:6197] Re: Problems with r.out.bin

Dylan Beaudette dylan at iici.no-ip.org
Wed Mar 16 19:06:22 EST 2005


This may or may not be related.... but:

I have found that GRASS DCELL maps must first be converted to FCELL maps, 
before exporting to a GMT-ready format.

Also when accessing grid files exported from GRASS with a GMT program be sure 
to use the following syntax:

float_grid_file.grd=1         (read as float grid)
integer_grid_file.grd=2     (read as int grid)

..it looks like your spot data is integer, so reading the file with an 
appended "=1" will cause GMT to read the file as if it were a float grid.

I have documented some of my GRASS-GMT findings here:
http://169.237.35.250/~dylan/grass_user_group/

Cheers,

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

On Wednesday 16 March 2005 03:32 pm, Patricio Toledo Peña wrote:
> Hi, i am a happy user of grass. I think i found a little bug, i
> hope.
>
> I have two rasters. A SRTM imported without problems with r.in.srtm
> and SPOT image imported from a TIFF. Grass can show me the info
> without problems with d.rast.
>
> I would like to make an output to be used with GMT's grdimage. If i
> use
>
> []% r.out.bin -h null=NaN in=srtm out=srtm.grd
>
> and then grdimage, there is no problem!, so i tried with the spot,
> but i couldnt render the image.
>
> i decided to use old school output, i use
>
> []% r.stats -1x in=srtm
>
> and the output looks like this
> 1 1 1911.8974609375
> 2 1 1021.7065429688
> 3 1 683.3014526367
> 4 1 547.7792358398
> 5 1 563.8315429688
> 6 1 697.7428588867
> 7 1 674.881652832
> 8 1 885.9045410156
> 9 1 1811.9166259766
> 10 1 1894.6561279297
> 11 1 2184.4465332031
> ...
>
> and for the spot this
> r.stats -1x spot
> 1 1 10667
> 2 1 8483
> 3 1 12844
> 4 1 8466
> 5 1 20080
> 6 1 13835
> 7 1 12741
> 8 1 10631
> 9 1 12743
> 10 1 6406
> 11 1 6368
> ...
>
> so everything looks ok.
>
> After many cups of coffee i managed to look at the bin output. I
> tried
>
> []% r.out.bin -h null=NaN in=spot out=spot.grd
>
> and
>
> []% grdreformat srtm.grd=1 srtm.nc
> []% grdreformat spot.grd=1 spot.nc
>
> then i use ncdump to look at the grid.
>
> []% ncdump srtm.nc
>
> looks like this
>
> -----------------CUT--------------------------
>
> netcdf srtm {
> dimensions:
>         side = 2 ;
>         xysize = 240 ;
> variables:
>         double x_range(side) ;
>                 x_range:units = "Meters ,
> \v@¤íÿ_Ð@d@@`@È\f@è\f at X\v\f at l@Ôo@Ë\t@¤íÿ¿Ï@Ë\t@µØ" ;
>         double y_range(side) ;
>                 y_range:units =
> "Meters¿o at X\v\f@`íÿ¿ì\bíÿ¿o@µØ\\îÿ¿lf at 1ú@íÿ¿ @È\f at pëÿ¿" ;
>         double z_range(side) ;
>                 z_range:units = "elevationM8n@£\bíÿ¿Wû@\b`l at lf@
> ´îÿ¿z£@Ôo at X\v\f@" ;
>         double spacing(side) ;
>         int dimension(side) ;
>         float z(xysize) ;
>                 z:scale_factor = 1. ;
>                 z:add_offset = 0. ;
>                 z:node_offset = 1 ;
>
> // global attributes:
>                 :title = "dem_srtm_90mx@\r\blf at lf@Âc@`x@\n",
>
>     "@@@lf at l@" ;
>
>                 :source = "r.out.bin -h input=dem_srtm_90m
>
> output=srtm.grd0 used for NULL" ;
> data:
>
>  x_range = 310000, 370000 ;
>
>  y_range = 6235000, 6335000 ;
>
>  z_range = 0, 2804.87915039062 ;
>
>  spacing = 5000, 5000 ;
>
>  dimension = 12, 20 ;
>
>  z = 1911.897, 1021.707, 683.3015, 547.7792, 563.8315, 697.7429,
> 674.8817,
>     885.9045, 1811.917, 1894.656, 2184.447, 0, 1524.52, 1867.924,
> 663.9888,
>     602.0908, 519.0523, 765.1163, 594.4846, 706.0734, 1212.255,
> 1479.04,
>     2702.787, 0, 1720.611, 832.5412, 738.3867, 559.8695, 496.3092,
> 648.4741,
>     564.0004, 685.2112, 1330.027, 1833.741, 2804.879, 0, 764.7325,
> 1113.144,
>     884.9847, 515.4147, 488.7629, 506.5552, 530.0245, 599.58,
> 1238.697,
>     1361.697, 2373.276, 0, 1638.143, 1045.054, 740.9617, 486.9698,
> 483.3979,
>     488.5664, 747.3654, 615.978, 1140.735, 971.7466, 1293.763, 0,
> 683.3162,
>     817.0809, 625.1544, 475.649, 476.8131, 487.9839, 501.0298,
> 639.7838,
>     1023.9, 820.8611, 896.476, 0, 596.2768, 1182.775, 597.7131,
> 467.4986,
>     477.4478, 488.2751, 515.9766, 540.3224, 664.6289, 763.2197,
> 1317.51, 0,
>     208.3247, 852.842, 495.4633, 469.7721, 473.3067, 485.7872,
> 517.0618,
>     564.0345, 605.4836, 688.7662, 1530.948, 0, 188.037, 269.8225,
> 844.0717,
>     466.8229, 455.4855, 482.079, 523.5785, 556.554, 587.5854,
> 782.3171,
>     1458.525, 0, 641.4139, 439.9863, 402.5107, 472.7809, 452.5125,
> 499.4549,
>     550.4744, 594.2014, 630.0211, 852.4738, 2028.455, 0, 216.0057,
> 361.0359,
>     548.9712, 403.6217, 452.0291, 716.2377, 574.1116, 621.963,
> 672.7051,
>     776.1525, 826.4809, 0, 569.1906, 673.9302, 368.0906, 417.1798,
> 468.4817,
>     518.9277, 574.379, 624.7796, 677.2015, 728.1828, 1031.293, 0,
> 276.125,
>     311.6169, 350.5661, 391.2746, 792.7806, 511.8949, 557.0769,
> 778.4391,
>     668.5333, 702.291, 1478.079, 0, 254.2038, 279.732, 311.3417,
> 356.5961,
>     768.6725, 485.8281, 512.5512, 786.2317, 806.8865, 746.6079,
> 906.1571, 0,
>     602.7701, 583.3986, 331.9892, 372.4999, 410.9167, 444.7338,
> 460.9563,
>     458.8165, 1277.886, 877.2421, 1959.047, 0, 812.3603, 722.5879,
> 809.0806,
>     354.405, 373.225, 395.8081, 410.2335, 405.3456, 663.4382,
> 1451.57,
>     2679.614, 0, 808.3639, 452.7131, 364.8825, 362.1678, 526.1887,
> 376.366,
>     378.2451, 418.3407, 616.1348, 1688.328, 2589.296, 0, 1906.097,
> 1647.922,
>     810.8583, 578.948, 841.3588, 395.6625, 838.9558, 425.5698,
> 953.824,
>     1469.772, 1608.909, 0, 537.739, 1550.32, 1003.811, 1071.668,
> 1459.342,
>     884.1784, 465.0422, 584.5891, 1117.134, 2319.113, 2493.716, 0,
> 866.7081,
>     1447.663, 1515.252, 1140.653, 1452.902, 798.4017, 486.7825,
> 536.4229,
>     727.7171, 1633.92, 1886.89, 0 ;
> }
>
> ---------------------------------------------
>
> []% ncdump spot.nc
>
> like this
>
> -----------------------CUT---------------------------
>
> netcdf spot {
> dimensions:
>         side = 2 ;
>         xysize = 240 ;
> variables:
>         double x_range(side) ;
>                 x_range:units = "Meters ,
> \v@¤íÿ_Ð@d@@`@È\f@è\f at X\v\f at l@Ôo@Ë\t@¤íÿ¿Ï@Ë\t@µØ" ;
>         double y_range(side) ;
>                 y_range:units =
> "Meters¿o at X\v\f@`íÿ¿ì\bíÿ¿o@µØ\\îÿ¿lf at 1ú@íÿ¿ @È\f at pëÿ¿" ;
>         double z_range(side) ;
>                 z_range:units = "elevationM8n@£\bíÿ¿Wû@\b`l at lf@
> ´îÿ¿z£@Ôo at X\v\f@" ;
>         double spacing(side) ;
>         int dimension(side) ;
>         float z(xysize) ;
>                 z:scale_factor = 1. ;
>                 z:add_offset = 0. ;
>                 z:node_offset = 1 ;
>
> // global attributes:
>                 :title = "imag_spot_0`x@\r\blf at lf@Âc@`x@\n",
>
>     "@@@lf at l@" ;
>
>                 :source = "r.out.bin -h input=imag_spot_0
>
> output=spot.grd0 usedfor NULL" ;
> data:
>
>  x_range = 310000, 370000 ;
>
>  y_range = 6235000, 6335000 ;
>
>  z_range = 8.79034526670958e-42, 1.47562183307065e+36 ;
>
>  spacing = 5000, 5000 ;
>
>  dimension = 12, 20 ;
>
>  z = 5.52817e-19, 4.953313e-19, 2.075827e-06, 6.003838e-14,
> 6.93769e-24,
>     8.923469e-42, 2.395605e-16, 2.536351e-06, 5.854575e-09,
> 2.580565e-06,
>     2.185477e-21, 8.923469e-42, 5.948305e-24, 8.041159e-09,
> 6.814512e-09,
>     1.988653e-16, 0.0009047714, 1.493924e-41, 3.990042e-09,
> 7.512333e-14,
>     1.293629e-16, 26386.59, 1.802539e-21, 1.19783e-41, 5.121541e-24,
>     1.424025e-16, 6.119387e-09, 1.924446e-11, 6.094157e-14,
> 8.839391e-42,
>     2.695473e-11, 0.236614, 3.568534e-09, 0.00077581, 7683.11,
> 1.329552e-41,
>     4.965599e-24, 0.1427695, 5.223165e-19, 0.0003209909,
> 1.911767e-11,
>     1.33768e-41, 6.88098e-24, 2.042624e+09, 9.468347e+13,
> 1.151268e+09,
>     0.0006491734, 8.980922e-42, 0.0009161414, nan, 5.846576e+33,
> 28.90538,
>     1.736398e-16, 8.931876e-42, 2.308851e-16, 8.589542e-24,
> 1.23291e-16,
>     2741403, 5.824033e-24, 1.647086e-41, 6.988471e-24, 1.675731e-21,
>     6.835183e-24, 1.634152e+31, 4.740647e-14, 8.934679e-42,
> 4.141374e-24,
>     5.969695e-19, 1.688843e-21, 1.682113e-21, 5.382549e-24,
> 8.790345e-42,
>     4.067404e-19, 5.458837e-24, 9.093348e-07, 1.763027e-21,
> 1.501376e-16,
>     1.04635e-41, 3.178451e-14, 1.319227e-16, 4.444136e-14,
> 2.596219e-06,
>     5.255992e-19, 8.839391e-42, 6.984338e-24, 1.957237e-11,
> 1.381501e-16,
>     5.302054e-24, 5.225773e-24, 4.589813e-41, 6.051259e-24,
> 5.508448e-24,
>     51.29015, 1.41027e-11, 3.365455e-24, 8.833786e-42, 3.440471e-24,
>     5.921985e-24, 4.238196e-19, 1.684212e-11, 6.677936e-19,
> 1.933512e-41,
>     11271.27, 4.991422e-24, 5.430862e-24, 1.475622e+36,
> 5.017299e-24,
>     8.929074e-42, 5.172394e-24, 5.094835e-24, 3.31417e-24,
> 1.582978e-21,
>     7.376226e-14, 3.266707e-41, 4.293486e-24, 5.096956e-24,
> 7.143683e-24,
>     nan, 4.965612e-24, 1.638398e-41, 5.172394e-24, 5.094835e-24,
> 3.31417e-24,
>     1.582978e-21, 7.376226e-14, 3.266707e-41, 4.293486e-24,
> 5.096956e-24,
>     7.143683e-24, nan, 4.965612e-24, 1.638398e-41, 5.172394e-24,
>     5.094835e-24, 3.31417e-24, 1.582978e-21, 7.376226e-14,
> 3.266707e-41,
>     4.293486e-24, 5.096956e-24, 7.143683e-24, nan, 4.965612e-24,
>     1.638398e-41, 5.172394e-24, 5.094835e-24, 3.31417e-24,
> 1.582978e-21,
>     7.376226e-14, 3.266707e-41, 4.293486e-24, 5.096956e-24,
> 7.143683e-24,
>     nan, 4.965612e-24, 1.638398e-41, 5.172394e-24, 5.094835e-24,
> 3.31417e-24,
>     1.582978e-21, 7.376226e-14, 3.266707e-41, 4.293486e-24,
> 5.096956e-24,
>     7.143683e-24, nan, 4.965612e-24, 1.638398e-41, 5.172394e-24,
>     5.094835e-24, 3.31417e-24, 1.582978e-21, 7.376226e-14,
> 3.266707e-41,
>     4.293486e-24, 5.096956e-24, 7.143683e-24, nan, 4.965612e-24,
>     1.638398e-41, 5.172394e-24, 5.094835e-24, 3.31417e-24,
> 1.582978e-21,
>     7.376226e-14, 3.266707e-41, 4.293486e-24, 5.096956e-24,
> 7.143683e-24,
>     nan, 4.965612e-24, 1.638398e-41, 5.172394e-24, 5.094835e-24,
> 3.31417e-24,
>     1.582978e-21, 7.376226e-14, 3.266707e-41, 4.293486e-24,
> 5.096956e-24,
>     7.143683e-24, nan, 4.965612e-24, 1.638398e-41, 5.172394e-24,
>     5.094835e-24, 3.31417e-24, 1.582978e-21, 7.376226e-14,
> 3.266707e-41,
>     4.293486e-24, 5.096956e-24, 7.143683e-24, nan, 4.965612e-24,
>     1.638398e-41, 5.172394e-24, 5.094835e-24, 3.31417e-24,
> 1.582978e-21,
>     7.376226e-14, 3.266707e-41, 4.293486e-24, 5.096956e-24,
> 7.143683e-24,
>     nan, 4.965612e-24, 1.638398e-41, 5.172394e-24, 5.094835e-24,
> 3.31417e-24,
>     1.582978e-21, 7.376226e-14, 3.266707e-41, 4.293486e-24,
> 5.096956e-24,
>     7.143683e-24, nan, 4.965612e-24, 1.638398e-41 ;
> }
>
> -------------------------------------
>
> so, the data is spreaded between
> 8.79034526670958e-42, 1.47562183307065e+36
> and i think that is the problem. I think i could use oldschool
> output and then xyz2grd but is very interesting these possible bug.
> As an additional info i tried grass53 and grass60 (from debian
> unstable) and is the same problem.
>
> Any ideas?
>
> Thanks a lot.

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list