[gdal-dev] gdalinfo -mm also report n (number of grid cells that are not nodata)
Even Rouault
even.rouault at spatialys.com
Wed Jun 13 14:03:44 PDT 2018
On mercredi 13 juin 2018 22:14:07 CEST Markus Metz wrote:
> Many raster bands contain nodata, therefore it would be helpful if the
> number of non-nodata grid cells could be reported by gdalinfo in some way.
>
> The number of non-nodata grid cells is not available through
> GDALGetRasterStatistics() / GDALRasterBand::GetStatistics(), probably
> because approximations can be stored as raster band statistics, and the
> number of non-nodata grid cells is unknown in case of approximations.
>
> Therefore I suggest to report the number of non-nodata grid cells only if
> all grid cells are evaluated, i.e. with
>
> *gdalinfo -mm* Force computation of the actual min/max values for each band
> in the dataset.
>
> The number of non-nodata grid cells would be a small piece of quite useful
> information to quickly evaluate the usefulness of a raster band.
>
> Asking for the possibility to enhance a bit the output of gdalinfo,
Markus,
That would be more something triggered by -stats since this number of non-
nondata cells is an intermediate result of GDALRasterBand::ComputeStatistics()
in gcore/gdalrasterband.cpp. To make it sensical even in the case of
approximate statistics, why not computing a percentage instead ? That would
need to be saved in a metadata item, let's say STATISTICS_VALID_RATIO (between
0 and 1) ? Wanna take a crack at implementing this ?Otherwise file an
enhancement ticket about that.
By the way, since GDAL 2.3.0, there's a STATISTICS_APPROXIMATE=YES metadata
item so as to know if the stats have been computed in an approx way or not
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list