Reclassify: NoData Bug

2259
9
10-26-2017 06:54 PM
ArianneFord
New Contributor III

If I set my environment settings correctly (every other tool in spatial analyst masks things properly), and then reclassify a raster, and change the NoData value from NoData to (for example) -99, when it produces the output raster, it doesn't mask it. It can't seem to differentiate between NoData areas that fall within the study area mask, and NoData areas that fall outside of the study area mask. See attached screencap for example. I then have to run Extract to Mask to get it to clip my reclassified raster properly.

I need the NoData areas to be an integer for some other processing I am doing, I can't leave them as NoData. Obviously I can keep doing what I'm doing and just run the Extract to Mask all the time, but it's just a pain when I have to batch process lots of maps, because now it's taking double the amount of time having to do the extra step. 

Are ESRI aware of this bug? And can they please fix it?

Issue has been replicated on 10.3.1, 10.4, and 10.5.

0 Kudos
9 Replies
DanPatterson_Retired
MVP Emeritus

not sure I follow, you have an area which has to remain rectangular,  You have a mask, which I presume is everything not classed as -99.  within that irregular area, you have some class 0's. Were those 0's formerly -99 (no data) before the reclass of -99 to 0? I am just trying to follow the transition steps in your process since you seem to show the 'after' and not the 'before' shot, unless I am mistaken

0 Kudos
curtvprice
MVP Esteemed Contributor

If you would like Esri to fix this problem, if you can, it's best to contact Esri support and file an incident.

In general I recommend avoiding using polygons as masks - it is more efficient and robust to convert your polygon mask to raster, map it to a 1/NoData raster, with raster calculator: SetNull(IsNull("p2ras"), 1). Then use the raster as a mask.

ArianneFord
New Contributor III

Apologies for confusion. The mask IS a raster. It works for every other function, just not reclassify. See additional screencaps below:

Mask is a raster:

Original distance grid that needs to be reclassified (it shows the polygon version of the study area just so you can see the extents it is meant to clip to):

You can see there are NoData areas within the study area, and the NoData areas to the north-east which are outside of the study area mask. When you use Reclassify, and you set the NoData value to an integer instead of leaving it as NoData, it gives the following:

Which as you can see, correctly attributes the NoData area as -99 within the study area mask, but incorrectly attributes the NoData area that falls outside the study area mask as -99 rather than clipping it out.

I hope this explains the error better?

0 Kudos
DanPatterson_Retired
MVP Emeritus

if the brownish area is nodata, then I am still confused, since a map can only have 1 no data.  your 2nd last map shows nodata as devoid of color, when you did it a second time, it becomes -99

If you are referring to much smaller areas, then you will have to zoom in to show how one nodata area becomes a value and the other doesn't.  And check to ensure that nodata remains no data during a reclass

0 Kudos
ArianneFord
New Contributor III

So you're saying that it cannot differentiate between NoData inside the mask and NoData outside the mask? That's a very fundamental problem. They are different things.

Literally every other tool in Spatial Analyst can mask the output properly, except for this one particular case in Reclassify where you modify the NoData value to something else.

0 Kudos
DanPatterson_Retired
MVP Emeritus

What I would do in a case like that... lets assume that this is a shoreline... I would have reclassed the really big nodata area as water/ocean/whatever, so your mask area would have been water and land, then do what you need with the area within the masked area reclassifying non-water... then your nodata would be retained.

I haven't seen two nodata values in a resultant raster, because I haven't done similar operations in the way you did, so maybe it is an error, but I wouldn't have seen it

0 Kudos
ArianneFord
New Contributor III

It is in fact the coastline, yes

The problem is that I have another script to run statistics which requires me to enter a value for the NoData class. I can't keep the ocean as a class because it messes up the statistics, I need it to be explicitly masked out. I can do this by running the Extract to Mask tool after the Reclassify tool, there is a workaround for this problem. It's just that when you've got a lot of very large grids at high resolution, this workaround ends up doubling your processing time, making an already time consuming job even worse. 

I want to know why the Reclassify tool can't just clip the resulting output raster back to the mask properly - like it does in literally every other tool in Spatial Analyst.

I've logged the case with ESRI as per the advice in this thread. Will see what they say.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Arianne... any news on the case report?

0 Kudos
ArianneFord
New Contributor III

Hi Dan,

So far the response from ESRI was: "that's weird, please send us the data". Which I've done, and am awaiting further response. 

Cheers

Arianne