[GRASS-user] Re: r.in.gdal oddity

Hamish hamish_b at yahoo.com
Fri Nov 4 02:53:19 EDT 2011

> > > Please check then
> > > http://article.gmane.org/gmane.comp.gis.grass.user/41407
> I will look into it, but my suspicion is that the dataset
> in question has IEEE FP issues like -180.00000000000001 which
> gdalinfo's printf is hiding.


the data file's header is broken causing a cumulative rounding problem.
here's the header from the ascii version of it:

ncols         360
nrows         143
xllcorner     -180
yllcorner     -58
cellsize      1.0000000000008
NODATA_value  -9999

change cellsize to 1.000000000000 and then r.in.arc works as expected.
I'd expect the issue to be the same with the binary formats, just not
as easy to repair.

GRASS> r.in.arc in=glp10ag60.asc out=gl_gpwfe_pcount_10
GRASS> r.colors gl_gpwfe_pcount_10 color=population
GRASS> r.info gl_gpwfe_pcount_10
 |   Data Type:    FCELL                                                      |
 |   Rows:         143                                                        |
 |   Columns:      360                                                        |
 |   Total Cells:  51480                                                      |
 |        Projection: Latitude-Longitude                                      |
 |            N:        85N    S:        58S   Res:     1                     |
 |            E:       180E    W:       180W   Res:     1                     |

> It appears that there is a completely way out value in the millions
> range, although most of the data is less than a thousand.

it would seem that in places like New York, Tokyo, Mexico City, and
Bangladesh, etc, there are some millions of people who live within the
same rather crowded 100km x 100km area.

# r.univar works on the current computational region (window):
GRASS> g.region rast=gl_gpwfe_pcount_10
GRASS> r.univar -e gl_gpwfe_pcount_10 percentile=99.95
total null and non-null cells: 51480
total null cells: 0

Of the non-null cells:
n: 51480
minimum: 0
maximum: 3.16715e+07
range: 3.16715e+07
mean: 132585
mean of absolute values: 132585
standard deviation: 783960
variance: 6.14593e+11
variation coefficient: 591.287 %
sum: 6825499706.1993026733
1st quartile: 0
median (even number of cells): 0
3rd quartile: 1129.64
99.95 percentile: 1.34546e+07


More information about the grass-user mailing list