[R-sig-Geo] Make raster from oddly organized ASCII

Thiago V. dos Santos thi_veloso at yahoo.com.br
Wed Dec 19 21:20:06 CET 2012


Dear all,

Today I received some ASCII files that need to be converted to raster. They are organized in a rather odd way, and I cannot think of a method
to read and organize the data to make a raster. Please take a look at a sample file:

sample<-readLines(url("http://dl.dropbox.com/u/27700634/gghswmp.lis"))

Useful information that I know about the data:
- global coverage at 1 degree;
- each line's 2nd value corresponds to the latitude coordinate; 
- the records are ordered from north (lat = 89) to south (lat = 90) within each hemisphere, the eastern hemisphere (lon=0) appearing first and the western (lon=180) second;
- lon is the longitude and lat is the latitude of the southwest corner of the first 1x1 degree cell.

Initially I thought of creating a XYZ data.frame and then use rasterfromXYZ to produce the raster.

Could anyone help me to create a XYZ data.frame from the supplied file?

Many thanks in advance,
Thiago.



More information about the R-sig-Geo mailing list