1

I have a raster file which includes floating values. I need to set cells with specific values as Nodata. For Raster integer values, the setnull tool can be applied, is it any tool for floating point?

The image that I have problem with it is the outcome of linear spectral analysis of ENVI software. I imported the image from ENVI to ArcMap by using ASCII to raster tool.

I have tried the Con in the raster calculator of ArcMap but It did not change my image and I got my original image again as output. I need to set the values less than zero to Nodata.

4
  • 2
    Welcome to GIS@SE! What software are you using/ please update your question and the Tags to reflect the tools you are using Feb 12, 2015 at 4:16
  • 1
    I note you're saying Specific Values, is there a range or list of values that should be null? To set one value is one problem, to set a list or range of values is quite another! We really need to know what software you are using to give any specific guidance. Feb 12, 2015 at 4:23
  • AFAIK, SetNull works just fine on floating point rasters.
    – whuber
    Feb 13, 2015 at 15:04
  • What syntax did you use with Con?
    – Aaron
    Sep 5, 2020 at 19:08

2 Answers 2

3

Seeing as you talk about SetNull I will assume ArcGis. You will need the Spatial Analyst extension to perform this type of extraction.

Your friends in ArcGis are Con and Extract by Attributes, this will allow you to specify a clause on what values you want to keep, anything else will be Null.

For example, if you wanted only the parts of a DEM that are above 0:

enter image description here

The biggest problem is creating an appropriate 'where clause'. For example to extract only a range: enter image description here

Con is a bit more powerful when used in raster calculator, you can use it to set null values or replace values with a constant (or a different raster):

enter image description here

Will give you a raster that is NoData for less than 215 and the value of the input for values greater than 215.

With both of these tools the output will be the same as the input, so if input is Float 32 then output will also be Float 32.

If you don't have Spatial Analyst you can try the QGIS raster calculator, which is very much like Esri Raster Calculator or GDAL_Calc, both will work if you're prepared to learn how to use them.

3
  • Thanks for your respond. I have already tried it but It did change my image and I got my original image again as output.
    – Kaveh
    Feb 13, 2015 at 6:21
  • Please post your map algebra syntax, there is likely to be a logic error that can be addressed. Feb 15, 2015 at 22:07
  • I could solve my problem which was about the procedure of exporting the image from ENVI software to Arcmap. Then, i used raster calculator as you have already mentioned.
    – Kaveh
    Feb 18, 2015 at 22:09
1

The following expression will keep all the values between -1 and 1. The values outside this range will be set to null.

Out_Raster = Con((yourraster > -1) & (yourraster < 1), yourraster)

Your Answer

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

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