1

I have a tiff file with some values and I want to read those values and plot a CDF (Cumulative Distribution Function). So far I only know how to get the mean value

from osgeo import gdal
gtif = gdal.Open( "INPUT.tif" )
srcband = gtif.GetRasterBand(band)
stats = srcband.GetStatistics( True, True )
mean_value = stats[2]

I prefer using Python but if QGIS already has a CDF feature implemented I can also use it.

  • Check this answer on SO. You would have to read your raster as a NumPy array, mask out the NoData values and then follow the steps presented there. – Marcelo Villa Aug 16 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.