9

What are the arithmetic rules that govern Nodata values? Regardless of how these null values are defined? I am using ArcMap Raster Calculator.

I am thinking specifically of operations like 1*Nodata (or 1*null), 1/Nodata, 1+Nodata,1-Nodata, Nodata-1 etc...

4
  • 3
    nodata cells are ignored, however, you need to check specific operations to confirm, for example Divide ignores nodata cells, see resources.arcgis.com/en/help/main/10.2/index.html#//…
    – user681
    Commented Aug 16, 2014 at 14:49
  • 3
    I'd just add that for any mathematical operation involving an operand with NoData, the result will always be NoData, even if other operands have valid values. Commented Aug 16, 2014 at 19:19
  • it may be worthwhile to note that there are some types of nodata cells that can be "filled in" by using some interpolation methods. this is particularly handy when one of your rasters has some speckles in it but your other rasters are clean. Commented Sep 29, 2014 at 3:29
  • Hi Whitebox, I can actually think of a couple of operations were you statement may not be quite 100% correct (neighborhood means on a NoData cell for example). Of course, as you state these may not be considered purely mathematical operators but I think it is worth the comment. Commented May 9, 2015 at 20:25

2 Answers 2

5

Okay, no one has provided an answer to this question so I thought I'd chime in. I suspect that all GIS that provide support for the NoData value do so in exactly the same way. Each mathematical operation that is applied to a raster image looks for the special case of grid cells containing NoData values and then executes a path that effectively ignores the operation and outputs a NoData value for the corresponding grid cell in the output image. Here's an example taken from the Add tool in the open-source GIS Whitebox GAT:

enter image description here

Incidentally, this is the code that is also executed if you add two images in Whitebox' Raster Calculator. In Whitebox, each raster can have a unique NoData value since it is specified in the header file of the raster. As such, it is not necessarily the same for both images being added and that's why you see variables noData1 and noData2 defined in the code above. Importantly, you'll see that as the code loops through each grid cell in the raster stack, it retreives the two values in the corresponding input images for a cell (z1 and z2), then checks to see that both are not equal to NoData. Thus, the addition only occurs if both rasters contain a valid value in the inputs. If this is not the case, nothing is entered into the output grid cell. In fact, the output image was created and initialized with its own NoData value, so by not entering an added value for a grid cell (because at least one of the inputs is NoData) the output will have the NoData value as well. Similar operations take place for each of the mathematical operations and in fact most tools that involve input raster datasets will follow a similar approach for treating the special case of NoData values. Two common exceptions to this rule that operations output a NoData value for NoData inputs are found in most GIS in the Con and Set Null tools. The Con tool of ArcGIS states, "If NoData does not satisfy the , it does not receive the value of the , and it remains NoData." Thus, if 'NoData' is part of the conditional statement and a grid cell with this value reduced to 'TRUE', a non-NoData value may be output. Similarly, the Set Null tool will actually output a non-NoData value for input cells containing NoData.

I hope that helps you to understand the workings of that mysterious NoData value. And remember zero is not the same as NoData! (Unless of course zero has been tagged as the NoData value for a particular raster).

3

Each one of your examples the answer is actually NoData

1*Nodata (or 1*null) =NoData

1/Nodata =NoData

1+Nodata =NoData

1-Nodata =NoData

Nodata-1 =NoData

I should add that many operations give you the option to "skip" NoData in a function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.