Opened 14 months ago

Closed 14 months ago

Last modified 14 months 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:
Cc:

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 :)

https://drive.google.com/file/d/0Bz01ZDOdaC5uZ0lBOEh6RUFla0U/view?usp=sharing

Change History (7)

comment:2 Changed 14 months ago by ThomasGocke

Description: modified (diff)

comment:3 Changed 14 months ago by Even Rouault

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

  Metadata:
    STATISTICS_MAXIMUM=3666
    STATISTICS_MEAN=2283.1000561062
    STATISTICS_MINIMUM=1745
    STATISTICS_STDDEV=191.70109193826
Last edited 14 months ago by Even Rouault (previous) (diff)

comment:4 Changed 14 months ago by ThomasGocke

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.

Cheers

comment:5 Changed 14 months ago by ThomasGocke

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 Changed 14 months ago by Even Rouault

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 Changed 14 months ago by ThomasGocke

ah, well then, thanks a lot!

Note: See TracTickets for help on using tickets.