<div dir="ltr">Hi,<div><br></div><div>when you have a raster where stats and histogram have already been computed and later on you edit some pixels programmatically (GDAL C API), previously computed stats/histogram are not automatically invalidated/removed. For performance reasons it probably makes sense, that this is not done automatically and must be explicitly handled, but I'm not sure how to correctly handle removing or updating stats and histogram.</div><div><br></div><div>I would actually prefer just to remove the stats and histogram, but if that's not possible I can also recompute them.</div><div><br></div><div>Removing:</div><div>If I'm not mistaken, stats can be removed by setting the "STATISTICS_MINIMUM", ... Metadata Items to null, or would that only work correctly for some raster formats?</div><div>Is there a better way to remove previously computed statistics?</div><div>How to remove the histogram?</div><div><br></div><div>Updating:</div><div>Stats can be recomputed by calling GDALComputeRasterStatistics which will also update the corresponding metadata items.</div><div>For the histogram calling GDALGetDefaultHistogramEx with bForce=1 will not recompute the histogram (it seems bForce is only relevant in cases where the histogram has not been computed before).</div><div>What's the correct way to recompute the default histogram?</div><div><br></div><div>Kind regards,</div><div>Dennis</div></div>