3

I trying to write a standardisation script that standardises each raster dataset in a list of rasters by the highest and lowest values found in the list of rasters.

The standardisation code is as follows:

for raster in rasters:
 output = (Raster(raster) - min_value) *100 / (max_value - min_value) + 0

Where the max_value and min_value are the maximum and minimum values in the raster list.

I initially though I would be able to use the GetRasterProperties_management function on the raster list but this doesn't work because the raster list is just a list!

The other idea I had was to loop through each raster in the list getting the max and min values and then outputting them as a table of values. Then finding the max and min value in each table to use in the standardisation equation. But I'm struggling to figure out how to output max and min values as a table.

So I would like help if anyone has got a better idea for the whole procedure or knows how to output max and min values from a looped GetRasterProperties_management into a table.

I'm using ArcGIS 10.

Andre Silva
10.5k12 gold badges57 silver badges109 bronze badges
asked Mar 28, 2014 at 11:21

1 Answer 1

5

You could do a first loop for the min and max values using getRasterproperties. Example for the max value below (min can be done in the same loop).

max_value=0
for raster in rasters:
 max_val_tmp = int(arcpy.GetRasterProperties_management(raster, "MAX").getOutput(0))
 if max_val_tmp > max_value:
 max_value = max_val_tmp 
Andre Silva
10.5k12 gold badges57 silver badges109 bronze badges
answered Mar 28, 2014 at 12:32
2
  • I will say though that the "GetOutput(0)" part need to have a lower case "g" to work i.e. "getOutput(0)". Commented Mar 28, 2014 at 14:27
  • 1
    you're right, I've edited my answer Commented Mar 28, 2014 at 14:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.