I am working on a Python script for dark object subtraction, a radiometric correction method for remotely sensed data.To accomplish this, I need to find the minimum band pixel value of a waterbody within a region of interest (ROI) (screenshot). My initial thought was to create a polygon within a Landsat scene and use Zonal Statistics as Table to find the minimum value. However, I cannot easily call this minimum value later on in the script. Another thought was to convert the band to a numpy array and find the min value (excluding 0), although I am uncertain how to subset the array to my ROI. How can I find the minimum value using a region of interest so that I can easily call this value later on in the script?

enter image description here


Related to answer I gave to a similar question (determine min and max elevation ... within my current extent), I wonder if this would work:

import arcpy

# this sets extent to current display, you can instead set it to ROI polygon
arcpy.env.extent = arcpy.mapping.MapDocument.activeView.Extent

# for a multi-band raster, pay attention to the band index (last input)
arcpy.MakeRasterLayer_management("c:/temp/raster.tif", "rlayer", "#", arcpy.env.extent, "1")

# Get the geoprocessing result object
bandMinResult = arcpy.GetRasterProperties_management("rlayer", "MINIMUM")
# Get the elevation minimum value from geoprocessing result object
bandMinDN = elevMinResult.getOutput(0)
  • Great, this is an excellent solution. Thanks Erica. – Aaron Jul 19 '14 at 14:53
  • Glad to know it works! – Erica Jul 19 '14 at 19:52

You could still use zonal statistics with the minimum option. It produces a raster would could be used for further processing Zonal Statistics


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.