[R-sig-Geo] read ascii problem floating point

Clémentine Fritsch clementine.fritsch at univ-fcomte.fr
Fri Jan 21 18:54:34 CET 2011


Sorry for the lack of information. My purpose is to export a x,y,z text 
file.

The values in the ascii imported vary from 0.4 to 5.3 while the correct 
values vary from 0.1 to 2402.
I have performed several checking in GRASS and I really think that the 
problem is due to floating point.

The values are correct using your method:

r = raster('filename.asc')
plot(r)

# if you want an sp object:
x = as(r, 'SpatialGridDataFrame')

However, when I have exported a text file of x at data with "write.delim" 
{pgirmess}, the z values in the text file are incorrect (again 0.4 to 
5.3 instead of 0.1 to 2402).

Ideas about how to export ?

Many thanks,

Clémentine


Robert Hijmans a écrit :
>> I have tried to read an ascii file using “readAsciiGrid” {maptools} in R 
>> 2.12.0. The z values are incorrect, and I strongly suppose that the 
>> problem is due to floating point. 
>>     
>
> Clémentine
>
> If would helpful if you said what is incorrect about the z values. You could
> try this alternative route:
>
> library(raster)
> r = raster('filename.asc')
> plot(r)
>
> # if you want an sp object:
> x = as(r, 'SpatialGridDataFrame')
>
> Robert
>   

-- 
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: 416 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110121/ce51306b/attachment.vcf>


More information about the R-sig-Geo mailing list