Reclassify: My DEM returns a negative count?

631
6
Jump to solution
03-10-2018 12:16 PM
ErinWoolbright
New Contributor II

Hello,

I am trying to reclassify a DEM into three classes based on elevation and for some reason, it keeps returning decidedly NOT what I was trying to accomplish. However, when I clip it down, it works fine. At first I thought the problem was just because the DEM is fairly large. I then noticed that under classification statistics the count reads as a negative number. I have never encountered this issue before. I have done something similar with the same DEM a few years ago and didn't have this issue. What is really perplexing to me is that if I clip the raster, no problem. Is there a way I can remedy this issue? Please, any help would be much appreciated!

Classification statistics for the DEM

I am currently using ArcGIS Pro but I went back to ArcMap to test this and had the same issue.

What happens with full DEM

This is what is returned when I try to reclassify the entire DEM

What is returned with clipped DEM

This is what is returned, and what I want, with a clipped portion of the DEM.

Prior to reclassifying, I go into symbology and classify the the DEM into three classes, and then from there I use the reclassify tool.

Again, any help would be immensely, greatly apprecaited!

-Erin

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Maybe you need to Calculate Statistics—Help | ArcGIS Desktop again. When you clip the raster the statistics are normally recalculated. Maybe the original raster has invalid statistids. 

View solution in original post

6 Replies
DanPatterson_Retired
MVP Esteemed Contributor

What is the bit type of the raster?

I have seen this when the bit type (and hence its range) is too small to account for an operation.

Here is an example (so I don't have to load an image).  

The bit type for a sequence of 10,000 integers and their sums.  Numbers get rolled/reused when they exceed the possible range of values (see lines 1-3) and the sum or counts are meaningless.

As you move up bit type, then the possible range of values increases until such time that going to a higher bit type doesn't result in a change of counts/sum etc since the values are all within range.

a = np.arange(10000, dtype=np.int8)  # the numbers wrap around themselves
a
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, ...,  6,  7,  8,  9, 10, 11, 12,
       13, 14, 15], dtype=int8)

np.sum(a)  # hence the sum is off
-4872

# --- move to 16 bit  #  now you can see all the numbers
a = np.arange(10000, dtype=np.int16)
a
array([   0,    1,    2,    3,    4,    5,    6,    7,    8,    9, ..., 9990,
       9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999], dtype=int16)
np.sum(a)
49995000

# --- move to 32 bit just to check
a = np.arange(10000, dtype=np.int32)
a
array([   0,    1,    2,    3,    4,    5,    6,    7,    8,    9, ..., 9990,
       9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999])

np.sum(a)
49995000

So... probably the same thing, which is why when you clipped the extent, the size got into a manageable range

ErinWoolbright
New Contributor II

Thanks Dan for the explanation, it helped me to grasp what was going on a bit better.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

no problem... keep it in mind if multi-images go strange when converting them

0 Kudos
ErinWoolbright
New Contributor II

32 bit, floating point. It just seems bizarre to me that I was able to do the exact same thing I am currently trying to on the exact same DEM a couple years ago and had no issues.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Maybe you need to Calculate Statistics—Help | ArcGIS Desktop again. When you clip the raster the statistics are normally recalculated. Maybe the original raster has invalid statistids. 

View solution in original post

ErinWoolbright
New Contributor II

Thank you Xander! That worked! I haven't used that tool for so long I had completely forgotten about it.