[GIS] How to round up/down an pixel value of a raster to a pixel value with 2 decimal places

arcgis-desktopfloating pointpythonrasterraster-calculator

I have a raster (DTM) with floating points as pixel value. Now i want to round up/down the pixel values (to its next nearest value) to 2 decimal places.

I use ArcGIS (with extensions) and tried the tools "int" and "round up/down" to do this but i haven't found any option to determine the number of decimal places. My next idea was to modify one of these tools within the raster calculator but unfortunatelly i don't have (enough) python skills – also with the help of google.

Do you have any easy solutions to solve this problem?

Best Answer

Multiply your float raster by 100, add 0.5, run Int, and divide by 100 to round to the nearest hundredth.

For example, if your floating point value was 1.629 and you want to round to two decimal places, multiply by 100, and add 0.5, which leaves you with 163.4. Run Int, which truncates the value, leaving 163. Divide by 100, leaving 1.63, the desired value.

Related Question