Maya007 Posted November 7, 2018 Report Share Posted November 7, 2018 Hello all, How can i round the raster pixel values with 5 decimals to just 2 decimals in ArcGIS. I tried the round down and it converted the raster into an integer file which is not what i want. I want to make a value like 1.00469 to 1.00 or a value like 0.93589 to 0.94 etc. Thanks, Maya Quote Link to comment Share on other sites More sharing options...
rahmansunbeam Posted November 7, 2018 Report Share Posted November 7, 2018 (edited) Quote 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. Quote @phloem's answer only works in cases where your raster has positive values only. For a raster myrast with both negative and positive values, try the following: Float(Int("myrast"*100 + (("myrast" > 0)*2 - 1)*0.5))/100.0 How to round up/down an pixel value of a raster to a pixel value with 2 decimal places? related - Round Raster to next higher or lower int Edited November 7, 2018 by rahmansunbeam 1 Quote Link to comment Share on other sites More sharing options...
Maya007 Posted November 7, 2018 Author Report Share Posted November 7, 2018 Thank so much for the fast answer! It helped me In the last step where we divide by 100, we also need to define the answer has to be in float, otherwise it assumes as integer and give answer as 0 and 1: Float("Myras")/100 /Maya Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.