[GRASS-user] Re: r.out.xyz problem floating point

Clémentine Fritsch clementine.fritsch at univ-fcomte.fr
Mon Jan 24 05:56:48 EST 2011


Hi,

I have not found any solution in GRASS, but it is possible to export a 
xyz text file from an ASCII using R.

I have found a solution with the help of Robert Hijmans and Patrick 
Giraudoux. It is necessary to specify the number of significant digits 
using signif().

For instance, in R 2.12.0:

library(raster)

r<-raster("data.asc")

xyv <- cbind(xyFromCell(r, 1:ncell(r)), v=signif(values(r), digits=2))

write.table(xyv, file="data.txt", row.names=FALSE, sep="\t",dec=".")

 
Regards,

Clémentine



Clémentine Fritsch a écrit :
> I need to export a x,y,z text file from an ascii file.
>
> I have run r.out.xyz in GRASS 6.4.0 but the values of z in the output 
> file are incorrect. To check, I have tried to export using r.out.ascii 
> with the parameter “dp=2” and in this case, the values are correct. 
> Therefore, I suppose that the problem is due to floating point.
>
> I have unsuccessfully tried to specify the number of significant 
> digits in r.out.xyz using “dp” parameter.
>
> Is it possible to specify the number of significant digits in r.out.xyz?
>
> If not, how could I export a x,y,z text file from my ascii?
>
> Thanks for your help,
>
> Clémentine
>

-- 
Clémentine Fritsch
PhD, post-doc researcher
UMR 6249 - Chrono-Environment
University of Franche-Comte
Place Leclerc
F-25030 Besançon Cedex
FRANCE
E-mail: clementine.fritsch at univ-fcomte.fr
Tel.: +33 (0) 381 665 710
Fax: +33 (0) 381 665 797

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clementine_fritsch.vcf
Type: text/x-vcard
Size: 405 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20110124/d96878e3/clementine_fritsch.vcf


More information about the grass-user mailing list