[GRASS-dev] r.in.gdal fp precision loss

Markus Metz markus.metz.giswork at gmail.com
Thu Apr 4 10:37:30 PDT 2013


r.in.gdal imports GDAL GDT_Float64 (64 bit floating point) as GRASS
FCELL (32 bit floating point). This leads to surprisingly large
differences between an original DCELL raster map and the re-import of
that map:

# nc_spm_08 dataset
g.region -p rast=elev_state_500m at PERMANENT res=100
r.resamp.interp input=elev_state_500m at PERMANENT output=elev_state_100m
method=bicubic
r.out.gdal in=elev_state_100m out=elev_state_100m.tif -c

r.in.gdal in=elev_state_100m.tif out=elev_state_100m.import
r.mapcalc "diff = elev_state_100m - elev_state_100m.import"
r.info -r diff

The range of the differences between the original and the re-import is

min=-6.10348170084762e-05
max=6.10349170528934e-05

which is magnitudes larger than the 32 bit floating point precision limit.

I changed r.in.gdal in r55625 such that GDAL GDT_Float64 is now
imported as GRASS DCELL (64 bit floating point). The original and the
re-import are now identical.

Should this change be backported to GRASS 6?

Markus M


More information about the grass-dev mailing list