Problem with Extraction by Attributes Output

991
8
07-18-2011 09:44 AM
steveSuperczynski
New Contributor
Has anyone else experienced an issue with output from the extraction tool in Spatial Analyst?  I am trying to extract unwanted values from a raster and the result always comes up as a raster full of zeros.  The odd thing is that I can select those values by the attributes but extracting them using SA will not work.

-Steve
0 Kudos
8 Replies
DanPatterson_Retired
MVP Emeritus
ExtractByAttributes does not remove unwanted values from a raster.  Can you describe the exact procedure you are using (ie which tool or raster calculator syntax)?
0 Kudos
steveSuperczynski
New Contributor
What I have is a large number of rasters that I want to average together. In order to do so I need to remove the missing values (-9999) and zeros from the raster. I was trying to use the extract by attributes to extract all values in the raster which are not "-9999" and "0" and save them to a new raster which I can use in the averaging process.

Or the SQL version "values <> -9999 and values <> 0" 

This statement works great at selecting pixels via the attribute table which means it should work with the extraction by attributes tool as well I would think. However I'm positive the statement is not at fault because doing a simple clause wherein I try to extract all values greater than zero produces the same output.

-Steve
0 Kudos
DanPatterson_Retired
MVP Emeritus
SetNull("MyRaster", "MyRaster", "Value <= 0")
might work (version 10 syntax
0 Kudos
steveSuperczynski
New Contributor
That will work but I have negative values that I need to keep in the raster so getting rid of everything less than zero will not give the desired output.

I can get it to work with two SetNull commands in Model Builder however I was having trouble getting it to work in a script and thought the extraction tool would be easier (only to be wrong again!). I must admit though my knowledge of python and the arc10 command window are quite limited so it could be I am just messing something up there that could be easily remedied.

Thanks for the ideas,
Steve
0 Kudos
curtvprice
MVP Esteemed Contributor
That will work but I have negative values that I need to keep in the raster so getting rid of everything less than zero will not give the desired output.


Arc 10:
SetNull("MyRaster", "MyRaster", "Value = 0 OR Value = -9999")

Arc 9.3 Single Output Map Algebra:
setnull(myraster eq 0 or myraster eq -9999,myraster)
0 Kudos
steveSuperczynski
New Contributor
Yep tried that already too... I don't know why but whatever I try does not seem to work properly. Using the SetNull command gives me strange output where none of the -9999 values are removed and only some of the 0 values are removed.
0 Kudos
curtvprice
MVP Esteemed Contributor
You may be at the mercy of the format of ENVI's .tif file output, in which case the best solution is to convert to grid -- the only sure way to control bit depth, etc.

I highly recommend you take this to tech support. If the problem is on the ArcGIS side, this is the only way things like this get fixed.
0 Kudos
steveSuperczynski
New Contributor
Well these tiff images were converted from .hdf files using the MODIS Reprojection Tool (MRT). This has not caused any issues with ArcMap before. The extraction process works like a charm in 9.3 so I think there is def something up with how ArcGIS 10 is handling these .tif files. I have contacted ERSI support so we will see what they come back with.

Thanks,
Steve
0 Kudos