Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6378 closed defect (fixed)

Approx Stats fails for VRT with Scaling and NoData (no valid pixels found)

Reported by: ThomasGocke Owned by: warmerdam
Priority: normal Milestone: 2.0.3
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords:

Description (last modified by ThomasGocke)

please find three VRTs in the attachement.

-Caluclating approx stats for WithNoData.vrt works

-Caluclating approx stats for Scaled.vrt works

-Caluclating approx stats for Scaled_WithNoData.vrt fails with "no valid pixels found"

I tried this with 2.0 stable and also with the latest dev version.

I see no valid reason why it shouldn't work, so I'd say there is something wrong :)

Change History (7)

comment:2 by ThomasGocke, 8 years ago

Description: modified (diff)

comment:3 by Even Rouault, 8 years ago

I cannot reproduce any issue with Scaled_WithNoData.vrt neither with 2.0 nor dev branches. I get the the same metadata with 3 VRT files :

Version 0, edited 8 years ago by Even Rouault (next)

comment:4 by ThomasGocke, 8 years ago

Hi Even,

thanks for looking into this.

Hmm, that is strange. Did you create stats for the tif before calculating approx stats for the Scaled_WithNoData.vrt? Or did you create pyramids for the tif or the vrt before calculating approx stats?

Three times the same result is strange too, because there are quite some 0 in the image, and at least with the scaled.vrt (without NoData set) values should be lower.

I just retried again, for me approx_ok = 1 always fails with "no valid pixels found" for Scaled_WithNoData.vrt.


comment:5 by ThomasGocke, 8 years ago

Ah, probably you tried Scaled.vrt first, which creates a stats aux.xml file for the tif, and afterwards this is always used. Please make sure there is no 1.tif.aux.xml and no stats tags in the vrt before trying approx_ok = 1 for Scaled_WithNoData.vrt Or redownload the zip and start with Scaled_WithNoData.vrt

comment:6 by Even Rouault, 8 years ago

Resolution: fixed
Status: newclosed

I read too fast your description and missed the fact that you were using approximate statistics instead of exact ones. The issue wasn't directly related to VRT and could be for example reproduced by computing approximate statistics on the result of "gdal_translate approx_stats_prob/Scaled_WithNoData.vrt out.tif -co tiled=yes -co blockxsize=128 -co blockysize=128"

trunk r33591, branches/2.0 r33592 "Avoid ComputeStatistics(), GetHistogram() and ComputeRasterMinMax() to use only the first column of blocks in approximation mode for a raster whose shape of blocks is a square (#6378)"

comment:7 by ThomasGocke, 8 years ago

ah, well then, thanks a lot!

Note: See TracTickets for help on using tickets.