[STATSGRASS] import DTM with readRAST6()

Matteo Dall'Amico matteo.dallamico at ing.unitn.it
Thu Jul 12 06:50:57 EDT 2007


Hi Markus,
I own a MacBookPro with Intel processor and I am running Mac OSX  
version 10.4.10.
I have installed GRASS 6.2.1 and R 2.5.1.
I have tried all yesterday to read the raster DTM without success.
This is what I get:

 >trent.int<-readRAST6("DTM_integer")
Creating BIL support files ...
Header File = /Users/Matteo/Documents/DataGrass/GBovest/ 
Permafrost/.tmp/nilo.ing.unitn.it/DTM_integer.hdr
World File = /Users/Matteo/Documents/DataGrass/GBovest/ 
Permafrost/.tmp/nilo.ing.unitn.it/DTM_integer.wld
Exporting Raster as integer values (bytes=2)
Using the Current Region settings ...
north=5158000.000000
south=5058500.000000
east=1729700.000000
west=1611600.000000
r=995
c=1181

Percent complete:  100%
r.out.bin complete.

 > summary(trent.int)
Object of class SpatialGridDataFrame
Coordinates:
               min     max
coords.x1 1611600 1729700
coords.x2 5058500 5158000
Is projected: TRUE
proj4string :
[+proj=tmerc +lat_0=0.0000000000 +lon_0=9.0000000000 +k_0=0.9996000000
+x_0=1500000.0000000000 +y_0=0.0000000000 +a=6378388 +rf=297 +no_defs
+towgs84=-225.000,-65.000,9.000]
Number of points: 2
Grid attributes:
   cellcentre.offset cellsize cells.dim
1           1611650      100      1181
2           5058550      100       995
Data attributes:
   DTM_integer
Min.   :-32768
1st Qu.: -3624
Median : -3624
Mean   : -1991
3rd Qu.:  1028
Max.   : 32525

 > print(trent.int at data[100000:100150,])
   [1]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624  -3624
[11]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[21]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[31]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[41]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[51]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[61]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[71]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[81]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[91]  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624  -3624   
-3624
[101]  -3624  -3624  -3624  -3624 -19703  12298  22794   2058  -8951  
-17911
[111] -27895  29961  27401 -32759 -25079 -13815  15370  25354  30986  
-30710
[121] -15094   6923   -758  -7670 -17654 -22518 -20214 -30710  21258   
10506
[131]  17930 -28150 -26102  28938  23818   -247  26889 -31991 -15607   
10761
[141]  -4856 -18936  28936  14088  -4857 -21241   9223 -11002 -17658   
-9722
[151]   5639

As you can see, it doesn't distinguish the NODATA: instead of -9999  
it uses -3624.
Also in summary there is no notice of the NODATA.

I downloaded all the packages and then, from the terminal, I  
installed them using:

R CMD INSTALL name_of_package

I really think there are problems with my spgrass6 package and MacOS  
system.
Any idea?
Thanks,
Matteo

On 12 Jul 2007, at 11:08, Markus Neteler wrote:

>
> hi Matteo,
>
> I have just made a test on a fresh installed machine with latest R
> and sp* packages using a synthetic DEM (still don't have a real
> DEM on this computer):
>
> GRASS 6.3.cvs (bellunoOvest):~ > r.surf.fractal dem
> Steps=1
> Preliminary surface calculations.
> Calculating surface 1 (of 1)
> GRASS 6.3.cvs (bellunoOvest):~ > R
>
> R version 2.5.1 (2007-06-27)
> ...
>> trentino.grid<-readRAST6("dem")
> Error: could not find function "readRAST6"
>> library(spgrass6)
> Loading required package: sp
> Loading required package: maptools
> Loading required package: foreign
> Loading required package: rgdal
> Geospatial Data Abstraction Library extensions to R successfully  
> loaded
>
>> trentino.grid<-readRAST6("dem")
> Creating BIL support files ...
> Header File =
> /home/neteler/grassdata/bellunoOvest/PERMANENT/.tmp/localhost/dem.hdr
> World File =
> /home/neteler/grassdata/bellunoOvest/PERMANENT/.tmp/localhost/dem.wld
> Exporting Raster as double values(bytes=8)
> Using the Current Region settings ...
> north=5175700.000000
> south=5084600.000000
> east=1787600.000000
> west=1706300.000000
> r=911
> c=813
>  100%
>
>> summary(trentino.grid)
> Object of class SpatialGridDataFrame
> Coordinates:
>               min     max
> coords.x1 1706300 1787600
> coords.x2 5084600 5175700
> Is projected: TRUE
> proj4string :
> [+proj=tmerc +lat_0=0 +lon_0=9 +k=0.999600 +x_0=1500000 +y_0=0  
> +no_defs
> +a=6378388 +rf=297 +towgs84=-225.000,-65.000,9.000 +to_meter=1]
> Number of points: 2
> Grid attributes:
>   cellcentre.offset cellsize cells.dim
> 1           1706350      100       813
> 2           5084650      100       911
> Data attributes:
>       dem
>  Min.   :-604.82
>  1st Qu.:-289.55
>  Median :  49.31
>  Mean   :  23.07
>  3rd Qu.: 334.70
>  Max.   : 669.46
>
>> system("r.info -r dem")
> min=-604.821087
> max=669.457656
>
>> system("r.info -t dem")
> datatype=DCELL
>
> Looks all functional. I am using 6.3, though. Do you use a 64bit  
> machine
> (like me)? Probably there were 64bit fixes after GRASS 6.2.1, I don't
> remember in this moment.
>
> Did you run
> update.packages()
> for your R installation?
>
> ciao
> Markus
>
> -- 
> View this message in context: http://www.nabble.com/import-DTM-with- 
> readRAST6%28%29-tf4049321.html#a11556201
> Sent from the Grass - Stats mailing list archive at Nabble.com.
>
> _______________________________________________
> statsgrass mailing list
> statsgrass at grass.itc.it
> http://grass.itc.it/mailman/listinfo/statsgrass
>




More information about the grass-stats mailing list