Skip to content

Instantly share code, notes, and snippets.

@scw
Last active December 17, 2015 23:19
Show Gist options
  • Save scw/5688469 to your computer and use it in GitHub Desktop.
Save scw/5688469 to your computer and use it in GitHub Desktop.
example histogram bin size calculation.
import arcpy
arcpy.CheckOutExtension("spatial")
raster = arcpy.Raster("c:\\workspace\\input_raster")
range = raster.maximum - raster.minimum
bins = 256
bin_size = (range) / bins
# now we know the bin width, can multiply that by the OBJECTID for the lower bound of each
lower_bin_value = [bin_size * i for i in range(bins)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment