Combine Rasters using Con Expression - Error

376
7
06-13-2012 06:37 AM
JannaCaspersen
New Contributor
I am trying to combine many rasters together to create 1 raster with all the input raster values added together. An example of the expression is below...

Con(IsNull("murle_ras_7"),0,"murle_ras_7") + Con(IsNull("murle_ras_6"),0,"murle_ras_6") + Con(IsNull("murle_ras_5"),0,"murle_ras_5") + Con(IsNull("murle_ras_4"),0,"murle_ras_4") + Con(IsNull("murle_ras_3"),0,"murle_ras_3") + Con(IsNull("murle_ras_27"),0,"murle_ras_27") + Con(IsNull("murle_ras_26"),0,"murle_ras_26") + Con(IsNull("murle_ras_25"),0,"murle_ras_25") + Con(IsNull("murle_ras_24"),0,"murle_ras_24") + Con(IsNull("murle_ras_23"),0,"murle_ras_23") + Con(IsNull("murle_ras_21"),0,"murle_ras_21") + Con(IsNull("murle_ras_20"),0,"murle_ras_20") + Con(IsNull("murle_ras_2"),0,"murle_ras_2") + Con(IsNull("murle_ras_19"),0,"murle_ras_19") + Con(IsNull("murle_ras_18"),0,"murle_ras_18") + Con(IsNull("murle_ras_17"),0,"murle_ras_17") + Con(IsNull("murle_ras_16"),0,"murle_ras_16") + Con(IsNull("murle_ras_1"),0,"murle_ras_1")

I also set the environments with a full extent and a specified cell size. The 000539 Error keeps appearing telling me that it "Could not save raster dataset to... with output format GRID.

Does anyone know how I can get around this?
0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus
the error message indicates that you might be concatenating a string with a number
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00vp00000007000539.htm
0 Kudos
JannaCaspersen
New Contributor
the error message indicates that you might be concatenating a string with a number
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00vp00000007000539.htm


I looked at this page and I am not savy with python so I'm not exactly sure what you mean or how you are suggesting to fix it. Are you saying I need to take the numbers out of my file names?
0 Kudos
JeffreySwain
Esri Regular Contributor
What version of ArcMap are you using?  If you break it down to just running the top selection will it work?  If you are using 10, you may have to reference the raster differently.

outRas = Raster("inras1") + Raster("inras2") 

From the help documentation here about accessing rasters.
0 Kudos
SteveLynch
Esri Regular Contributor
0 Kudos
JannaCaspersen
New Contributor
What version of ArcMap are you using?  If you break it down to just running the top selection will it work?  If you are using 10, you may have to reference the raster differently.

outRas = Raster("inras1") + Raster("inras2") 

From the help documentation here about accessing rasters.


I am using 10 and it does work if I run them in smaller groups of 2-5 but when I try to do them all at once it errors. I can go through and do it little by little but I will try the referencing method.
0 Kudos
Luke_Pinner
MVP Regular Contributor
Did you look at the Cell Statistics tool Steve recommended? It does exactly what you are attempting to do with that long Con(IsNull()) code.

outCellStats = CellStatistics(["murle_ras_7","murle_ras_6","murle_ras_5","murle_ras_4",...,"murle_ras_N"], "SUM", "DATA")
0 Kudos
FabianBlau
Occasional Contributor II
Check the output-name and location. The name has not to be to long for GRIDs (>13 characters). You may have a problem, if there are too many subfolders. Try something like "C:/outname.img".
0 Kudos