I want to create a python script to find the minimum elevation pixels from an elevation raster (aster,srtm) using arcpy and arcmap 10.1. The purpose is to reclassify these pixels. I have tried but I do not have enough knowledge in scripting.

Can somebody please help me ?

  • Are you looking for a single value (the lowest elevation point in the entire raster), or multiple values (local low elevations throughout the raster)? – Erica Apr 16 '14 at 12:53

You can use Get Raster Properties (Data Management) to extract minimum elevation values.

import arcpy

inputRaster = r'C:\temp\dem.img'

raster = arcpy.GetRasterProperties_management (inputRaster, "MINIMUM")

To extract the information so that you can use it in a command such as Con or Reclassify use the following:

elevMin = raster.getOutput(0)

To put it all together, the following script shows how to find the minimum elevation value and reclassify all values <= (minimum elevation + 300).

import arcpy
from arcpy.sa import *

inputRaster = r'C:\temp\dem.img'

# Get minimum elevation value in DEM
raster = arcpy.GetRasterProperties_management (inputRaster, "MINIMUM")
elevMin = float(raster.getOutput(0))

# Convert all values <= elevation min + 300 to 0, else maintain pixel value
outCon = Con(Raster(inputRaster) <= elevMin + 300 , 0, inputRaster)
  • yes that right,but that method show me one min only i want all mins from raster – hellas Apr 9 '14 at 15:07
  • this is elevMin = raster.getOutput(0) output parameter ? i cant to get this – hellas Apr 10 '14 at 20:19
  • You have to convert this to type Float to work in the Con function. – Aaron Apr 10 '14 at 20:20

If your script knowledge is limited have you considered doing this in model builder? The model below will identify the minimum cell value and extract all cells with this value to a new grid.

Extract minimum cell values from a raster

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.