I am using raster data from Afripop.org and using the R package raster (raster_2.0-41) to do all my computation. Everything has been working out just fine until I tried sending some jobs to a remote linux machine. When I read in the raster on one machine the values are correct but on the other there are no NAs and the population (i.e. sum of all the values) WAY off.
On the linux machine I get:
> civpop <- raster("data/apciv10v3.flt")
> civpop[1:10]
[1] 0 60 28 198 0 60 28 198 0 60
> civpop
class : RasterLayer
dimensions : 7656, 7327, 56095512 (nrow, ncol, ncell)
resolution : 0.0008333, 0.0008333 (x, y)
extent : -8.599802, -2.494213, 4.357029, 10.73677 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs
data source : /home/andrewa/D4D/trunk/data/apciv10v3.flt
names : apciv10v3
values : 0, 255 (min, max)
One the other machine I (correctly) get:
R> civpop <- raster("data/apciv10v3.flt")
R> civpop[1:10]
[1] NA NA NA NA NA NA NA NA NA NA
R> civpop
class : RasterLayer
dimensions : 7656, 7327, 56095512 (nrow, ncol, ncell)
resolution : 0.0008333, 0.0008333 (x, y)
extent : -8.6, -2.494, 4.357, 10.74 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs
data source : /Users/andrewa/Documents/D4D/trunk/data/apciv10v3.flt
names : apciv10v3
If I use just rgdal I have the same issues so I guess it isn't an issue with raster. Any ideas?
Incorrect Machine (using GDAL 1.8.0, released 2011/01/12):
> civpop.gdal = readGDAL("data/apciv10v3.flt")
data/apciv10v3.flt has GDAL driver EHdr
and has 7656 rows and 7327 columns
> civpop.gdal@data[1:10,1]
[1] 0 60 28 198 0 60 28 198 0 60
Correct machine (using GDAL 1.8.1, released 2011/07/09):
R> civpop.gdal = readGDAL("data/apciv10v3.flt")
data/apciv10v3.flt has GDAL driver EHdr
and has 7656 rows and 7327 columns
R> civpop.gdal@data[1:10,1]
[1] NA NA NA NA NA NA NA NA NA NA`

gdalinfo --versionon the command line say? Could it be related to this problem I had with afripop data: geospaced.blogspot.co.uk/2011/12/reading-afripop-data.html – Spacedman Feb 6 at 11:43pixeltype floatto the hdr file did it! Want to post this as a solution so I can accept? – scottyaz Feb 6 at 11:49