Opened 4 years ago

Closed 4 years ago

#5433 closed defect (fixed)

gdalwarp error on -r mode with sinusoidal input

Reported by: jgrn307 Owned by: Even Rouault
Priority: normal Milestone: 1.11.0
Component: Algorithms Version: 1.10.1
Severity: normal Keywords: gdalwarp mode
Cc:

Description

I'm running a gdalwarp on a sinusoidal MODIS class image to longlat, using a modal resample (and cropping the output). The warp is clipping off a circular region of North America and Australia. I am using multithreaded mode, but I confirmed this error also occurs in sequential mode. The error occurs on both Windows and Linux boxes running GDAL 1.10.1. The error does NOT occur using e.g. a nearest neighbor resample.

gdalwarp -multi -te -180 -59.9499994 180 88.5500006 -ts 720 297 -t_srs "+proj=longlat +datum=WGS84 +no_defs" -r "mode" -of "GTiff" -wo "NUM_THREADS=ALL_CPUS" "MOD44B_V5_TRE.2001_fixed_10k.envi" "MCD12Q1.A2001001_10k_05deg.tif"

I dropped the input and the output files in: https://drive.google.com/folderview?id=0B8Kij67bij_AVG1fWko4bFdTRFk&usp=sharing

Attachments (1)

MCD12Q1.A2001001_10k_05deg.tif (837.1 KB) - added by jgrn307 4 years ago.

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by jgrn307

comment:1 Changed 4 years ago by etourigny

Owner: changed from warmerdam to etourigny

can you try increasing the warp and cache memory size?

something like this

gdalwarp --config GDAL_CACHEMAX 2000 -wm 2000 ...

comment:2 Changed 4 years ago by jgrn307

Same error using --config GDAL_CACHEMAX 2000 -wm 2000. As a small note, my original run used a 14GB input image (it took a few hours to complete) and I had exactly the same error.

comment:3 Changed 4 years ago by Even Rouault

Component: UtilitiesAlgorithms
Priority: highnormal
Severity: criticalnormal

trunk r27156 "warp kernel for average and mode resampler: avoid 'holes' when the source coordinates are in a reversed order from the target coordinates (#5433)"

I've pushed a fix, but perhaps not the ultimate fix. At least, things will be a bit better, although it tends to generate a blury rendering in the areas that were black before.

comment:4 Changed 4 years ago by etourigny

Owner: changed from etourigny to Even Rouault

Looks good to me. Don't see the blurry effect you mention. Those areas are highly distorted due to the sinusoidal projection.

comment:5 Changed 4 years ago by etourigny

BTW the following should work without this fix:

1) warp the file to destination CRS to a high resolution with near resampling 2) warp the temporary file to destination resolution with mode resampling

gdalwarp -te -180 -59.9499994 180 88.5500006 -tr 0.1 0.1 -t_srs "+proj=longlat +datum=WGS84 +no_defs" -r near -of "GTiff" "MOD44B_V5_TRE.2001_fixed_10k.envi"  t1.tif
gdalwarp -te -180 -59.9499994 180 88.5500006 -tr 0.5 0.5 -t_srs "+proj=longlat +datum=WGS84 +no_defs" -r mode  t1.tif t2.tif
}}

The result is not exactly the same as using a single warp with the patch applied. It actually looks a bit better, but it's hard to say.

comment:6 in reply to:  5 Changed 4 years ago by etourigny

BTW the following should work without this fix:

1) warp the file to destination CRS to a high resolution with near resampling

2) warp the temporary file to destination resolution with mode resampling

gdalwarp -te -180 -59.9499994 180 88.5500006 -tr 0.1 0.1 -t_srs "+proj=longlat +datum=WGS84 +no_defs" -r near -of "GTiff" "MOD44B_V5_TRE.2001_fixed_10k.envi"  t1.tif
gdalwarp -te -180 -59.9499994 180 88.5500006 -tr 0.5 0.5 -t_srs "+proj=longlat +datum=WGS84 +no_defs" -r mode  t1.tif t2.tif

The result is not exactly the same as using a single warp with the patch applied. It actually looks a bit better, but it's hard to say.

comment:7 Changed 4 years ago by Even Rouault

Milestone: 1.11.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.