[GRASS-user] Getting Gridded Population of the World (GPW) data into GRASS

G'day all,

I have tried to search for this, but the only chain I found included some off-list component, and I'm not sure what actually happened.

I have not been able to import GPW data into GRASS successfully.

I am downloading data from http://sedac.ciesin.columbia.edu/gpw/global.jsp

I have downloaded the .bil, the ascii grid and the ESRI GRID data types for population count and population density at different resolutions and viewed them in QGIS - there was no real problem once I had changed the colourmap. It appears that there is a completely way out value in the millions range, although most of the data is less than a thousand. I have viewed the .ascii file and can see that there are plenty of values.

for example

r.in.gdal -o input=/Users/benmadin/Spatial/raster/gl_gpwfe_pcount_10_bil_25/glp10ag.bil output=glp10ag

WARNING: Over-riding projection check
100%
r.in.gdal complete. Raster map <glp10ag> created.

r.univar glp10ag

100%
total null and non-null cells: 29652480
total null cells: 29652480

Of the non-null cells:
----------------------
n: 0
minimum: nan
maximum: nan
range: nan
mean: nan
mean of absolute values: nan
standard deviation: nan
variance: nan
variation coefficient: nan %
sum: 0

when I use r.in.gdal (or r.in.arc or r.in.bin) they all seem to work without trouble. They also work fine for gridded livestock of the world data, or worldclim data.

r.univar tmin1.bil

100%
total null and non-null cells: 29652480
total null cells: 20297072

Of the non-null cells:
----------------------
n: 9355408
minimum: -547
maximum: 266
range: 813
mean: -71.4324
mean of absolute values: 196.981
standard deviation: 214.727
variance: 46107.5
variation coefficient: -300.601 %
sum: -668279360

Is there anyone else who has been able to successfully import gpw data to grass. If I wasn't able to display it in QGIS I would just give up, but there must be something going on (both my QGIS and GRASS are using the same versions of GDAL etc)

cheers

Ben

On Thu, Oct 20, 2011 at 3:43 AM, Ben Madin
<lists@remoteinformation.com.au> wrote:

G'day all,

I have tried to search for this, but the only chain I found included some off-list component, and I'm not sure what actually happened.

I have not been able to import GPW data into GRASS successfully.

I can confirm that, unfortunately.

I am downloading data from http://sedac.ciesin.columbia.edu/gpw/global.jsp

I have downloaded the .bil, the ascii grid and the ESRI GRID data types for population count and population density

...

for example

r.in.gdal -o input=/Users/benmadin/Spatial/raster/gl_gpwfe_pcount_10_bil_25/glp10ag.bil output=glp10ag

WARNING: Over-riding projection check
100%
r.in.gdal complete. Raster map <glp10ag> created.

Now you first have to set the computational region to the map, otherwise
r.* will not compute reasonable results (unless you want to work on a
subregion).

But:

gdalinfo glp15ag
...
GEOGCS["WGS 84",
...
Upper Left (-180.0000000, 85.0000000) (180d 0'0.00"W, 85d 0'0.00"N)
Lower Left (-180.0000000, -58.0000000) (180d 0'0.00"W, 58d 0'0.00"S)
Upper Right ( 180.0000000, 85.0000000) (180d 0'0.00"E, 85d 0'0.00"N)
Lower Right ( 180.0000000, -58.0000000) (180d 0'0.00"E, 58d 0'0.00"S)
Center ( 0.0000000, 13.5000000) ( 0d 0'0.00"E, 13d30'0.00"N)
Band 1 Block=8640x1 Type=Float32, ColorInterp=Gray

this looks ok to me. However, neighter GRASS 6 nor 7 can import it
correctly, some epsilon issue:

# note that -l doesn't change anything:
r.in.gdal glp15ag out=population_2015 -l
r.info population_2015
...
| Rows: 3432 |
| Columns: 8640 |
| Total Cells: 29652480 |
| Projection: Latitude-Longitude |
| N: 85N S: 58S Res: 0:02:30 |
| E: 179:59:59.999999W W: 180W Res: 0 |
| Range of data: min = 0 max = 1870454 |
...

g.region rast=population_2015 -p
projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: a=6378137 es=0.00669438
north: 85N
south: 58S
west: 180W
east: 179:59:59.999999W <<--- !!!
nsres: 0:02:30
ewres: 0
rows: 3432
cols: 8640
cells: 29652480

d.rast.leg population_2015
ERROR: region for current mapset is invalid
       line 9: <e-w resol: 0>
       run "g.region"
ERROR: region for current mapset is invalid
       line 9: <e-w resol: 0>
       run "g.region"

We need to add something more in lib/gis/adj_cellhd.c in function
G_adjust_Cell_head().

Markus