[gdal-dev] Odd problem -- Gdalwarp, OpenCL and interpolation

Jonathan Williams jonvwill at verizon.net
Sat Mar 5 16:06:59 PST 2016


Hello,
I've run into an odd problem that I suspect is the result of some
incorrect variable type casting, but I'm not sure where to look or how
to fix it.

Inputting a raster in Float32 format (or Float64, with -ot Float32
and/or -wt Float32 enabled on the command line) and attempting to do a
resample interpolation (doesn't seem to matter what OpenCL-compatible
algorithm) is producing output that is huge compared with the input. The
output still has a range of values, and it makes me wonder whether the
output is being multiplied by a very large amount at some point.

Saga GIS reports the non-OpenCL resampled Float32 values as ranging from
-8.595017433166504 to 166.74661254882812, and the resampled values as
ranging from -340282346638528860000000000000000000000 to
340282346638528860000000000000000000000 (+/- 3.4e38, e.g. the maximum
range of single precision floating point)

Running the exact same warp with OpenCL disabled produces the correct
output.

Here's an example of the gdalwarp runline:

gdalwarp -srcnodata 9999 -dstnodata 9999 -wt Float32 -ot Float32
--config GDAL_CACHEMAX 4096 -wm 2048 -multi -tr .03 .03 -r lanczos
--debug on -overwrite -wo "USE_OPENCL=TRUE" 373.grib2 373_res.tif

I will note that the input file in this case is in Float64 format;
however, converting it to Float32 prior to the warp makes no difference.
Neither does whether the input file is in grib2 format or geotiff format.

Reprojection-only operations produce normal-looking output using OpenCL.

Best,
Jonathan



More information about the gdal-dev mailing list