Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Python API Statistics

Johannes Kolbe edited this page Jul 3, 2014 · 1 revision

It is possible to get several statistic values from Raster Coverages, such as the maximum, minimum, mean value, the histogram, etc.

To get these values you have to use the .statistics() method on an existing Raster Coverage and assign it to a new variable for further work. By default it will calculate most of the values but not the histogram and standard deviation. To calculate the histogram as well you can call the method like this: .statistics(PropertySets.pHISTOGRAM). To access the histogram you can then use the method .histogram() and will get a list of tuples in return.

rc = RasterCoverage(n000302.mpr)

stats = rc.statistics(PropertySets.pHISTOGRAM)
stats.histogram()
#list of (value, frequency) pairs

Clone this wiki locally