[GRASS5] ERROR: cell_values_double: xdr_double failed for index 387.

Glynn Clements glynn.clements at virgin.net
Sun Sep 5 08:23:11 EDT 2004

Hamish wrote:

> I'm getting this error when I try to access a DCELL map after setting
> the region to cross 180 degrees lon:
> ERROR: cell_values_double: xdr_double failed for index 387.
> (lib/gis/get_row.c line 414)
> G57:~> g.region -p
> projection: 3 (Latitude-Longitude)
> zone:       0
> datum:      wgs84
> ellipsoid:  wgs84
> north:      25:10S
> south:      56S
> west:       153:05E
> east:       174:40W
> nsres:      0:05
> ewres:      0:05
> rows:       370
> cols:       387
> g.region -d && d.zoom -p
> works ok until I hit 180E, then the above error.
> Works ok with a CELL map; fails on any FCELL or DCELL map.
> fails using d.rast, r.mapcalc, etc. with GRASS 5.0.3 -> GRASS 5.7-cvs.

I can't reproduce this (using the "global" sample data set).

I would guess that the column mapping is being miscalculated, e.g. due
to rounding error, causing cell_values_{float,double} to attempt to
read beyond the end of the row. window_map.c is my prime suspect.

This won't necessarily show up in the integer case; cell_values_int
will just silently read beyond the end of the input buffer (you'll get
bogus data, but no error). OTOH, the FP versions use an XDR stream,
and xdr_{float,double} will indicate an error (by returning zero) if
you overrun the stream.

BTW, the index in the error message is incorrect.

For recent 5.3/5.7 (after my raster I/O changes), it always reports
the total number of columns, not the column number at which the error
occurred. Older versions report the number of columns left to read
(i.e. the first column is reported as columns-1 and the last column is
reported as zero).

This isn't related to why the error occurred, though.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list