getRasterProperties as variable

302
0
08-29-2011 10:22 AM
WadeGivens
New Contributor II
I'm trying to convert some 16 bit raster images to 8 bit.  What I have done is saved my image files as ESRI GRIDS.  I'll then planing on cycling through each band and scaling them to fit between 0-255.  To do this, I need to store the min and max values from each band as a variable to use in some mathmatical functions.  The min value for this exzample is "0" and the max is "9269".  I get an error
on the "b1plus" calcualtion stating "ERROR 000732: Input Raster: Dataset 0 does not exist or is not supported".  The correct values are getting stored in "b1min" and "b1max".  the calculation for "b1Numerator" works fine.  doesn't like any of the calculations that involve the variables "b1min" or b1max".  Any ideas out there?

Thanks,
Wade

 b1min = (arcpy.GetRasterProperties_management("tempc1", "MINIMUM"))
 b1max = (arcpy.GetRasterProperties_management("tempc1", "MAXIMUM"))
 b1plus = arcpy.sa.Plus("tempc1", b1min)
 b1Numerator = arcpy.sa.Times(b1plus, 255)
 b1Denominator = arcpy.sa.Plus(b1max, b1min)
 b1Int = arcpy.sa.Int(arcpy.sa.Divide(b1Numerator, b1Denominator))           
 b1Int.save("band1.tif")
Tags (2)
0 Kudos
0 Replies