Jump to content
Sign in to follow this  
Maya007

Round down raster values

Recommended Posts

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

 

 

Share this post


Link to post
Share on other sites
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 by rahmansunbeam
  • Like 1

Share this post


Link to post
Share on other sites

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

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.