Rounding and converting raster values

1348
16
Jump to solution
07-27-2021 07:15 AM
BeckB
by
New Contributor III

Hello,

I'm using ArcGIS Pro 2.8.1. I have a raster layer whose values I would like to round and then convert into a corresponding value. For example, if the current value is 9.788, I would round that to 10 and convert that to 144. Is there a way to do this?

16 Replies
JayantaPoddar
MVP Esteemed Contributor

This is what I calculated. Please correct me if I am wrong.

Result of Con Function
(Raster Value)
Con Function -1Calculation of No. of DaysJulian Day
1016 x 00
2116 x 116
3216 x 232
4316 x 348
5416 x 464
6516 x 580
7616 x 696
8716 x 7112
9816 x 8128
10916 x 9144
111016 x 10160
121116 x 11176
131216 x 12192
141316 x 13208
151416 x 14224
161516 x 15240
171616 x 16256
181716 x 17272
191816 x 18288
201916 x 19304
212016 x 20320
222116 x 21336
232216 x 22352


Think Location
0 Kudos
BeckB
by
New Contributor III

This makes sense! However, in my case, the Julian day begins at 1, not 0. Here's a chart of the conversion; would this mean the subtraction is not necessary?

BeckB_0-1627412085524.png

 

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Just add 1 at the end of the expression (outside all brackets). Updated my last expression.



Think Location
BeckB
by
New Contributor III

To clarify, do you mean like this?

16*((Con(("RASTER" - (RoundDown("RASTER"))== 0.5),RoundUp("RASTER"),RoundUp("RASTER" - 0.5)))-1)+1

 

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Yes.



Think Location
0 Kudos
BeckB
by
New Contributor III

Okay, thank you so much!! I really appreciate your help.

0 Kudos
Luke_Pinner
MVP Regular Contributor

If your values are all positive, just add 0.5 before truncating.

Int("RASTER" + 0.5)

 

You can then reclassify the rounded values to whatever you want.

0 Kudos