0

I have a very long operation string using conditionals and simple operations. However, I get an error when copying the syntax to Raster Calculator, apparently the commands are not recognized when copied from text editor. The problem is I need to calculate about 70 operations with varying values, is there a way to work the syntax outside the command box and make it work?

This is my string and it has been cleaned up, but still get error 00539

Con("slope_dgr",1,0, "VALUE <=20") * 
Con("dem_clip",1,0, "VALUE >=1") *
(("acacia_sh_" * 0.6 + 
    "e_open_" * 0.9 + 
    "e_wood_" * 0.8 + 
    "hum_grass_" * 1 + 
    "oth_open_" * 0.8 +
    "oth_sh_" * 0.6 +
    "oth_wood_" * 0.8 +
    "trop_e_grass_" * 0.75 +
    "trop_grass_" * 0.5)/9) * 
(("yellow_dpx1_" * 1 + 
    "red_dpx1_" * 1 + 
    "loams1_" * 0.75 + 
    "m_earth1_" * 0.75 + 
    "sands1_" * 1 + 
    "cr_clay1_" * 0.5)/6) * 
(("ig_fels_intr" * 1 + 
    "ig_fels_volc" * 1 + 
    "ig_maf_intr" * 1 + 
    "ig_maf_volc" * 1 + 
    "ig_volc" * 1 + 
    "metamorphic" * 1 + 
    "metased_silic" * 1 + 
    "regolith" * 1 + 
    "sed_carb" * 1 + 
    "sed_silic" * 1)/10) * 
("wline_mj_" * 0 + 
    "wline_mn_" * 0 + 
    "warea_np_" * 0 + 
    "warea_pn_" * 0) * 
Con("wline_mj",1,0,"VALUE =0") * 
Con("wline_mn",1,0,"VALUE =0") * 
Con("wanp",1,0,"VALUE =0") * 
Con("wapn",1,0,"VALUE =0") * 
("r1000" * 1 + 
    "r800" * 1 + 
    "r600" * 1 ) * 
("t27" * 1 + 
    "t30" * 1 + 
    "t33" * 1)  
  • Are you running this within ArcMap with all these referenced layers in your Table of Contents? – jbchurchill Nov 4 '16 at 17:18
  • Yes I have an arcMap file with all the rasters in the table of contents, one of the rasters is in a different folder tho', would this be an issue? – Josh Nov 4 '16 at 17:28
  • I don't think it would be an issue. It is using the names with no path so as long as they are in the Table of Contents (TOC) you should be fine. You might edit the question to reflect that all the layers are in your TOC. I'm afraid it will be difficult to diagnose the potential problem(s) with such a complicated expression. The nature of the error supposedly has something to do with Raster Calculator not being exposed to Python as a tool (which doesn't appear to make sense in this context since you aren't using Python). support.esri.com/technical-article/000011928 – jbchurchill Nov 4 '16 at 18:10
  • Why are you multiplying by zero in a number of places. ("wline_mj_" * 0 + "wline_mn_" * 0 + "warea_np_" * 0 + "warea_pn_" * 0) You could replace that entire expression with + 0 (or just leave it out). I suspect this cuts quickly to the problem. – jbchurchill Nov 4 '16 at 18:20
2

I couldn't spot a syntax error, but I think there are some things worth checking out that will also help you (or one of us) spotting the problem:

  • Like jbchurchill already said, you should start by removing unecessary parts, like that one where you multiply by zero.

  • Another thing that might help you is to break down the string into chunks and test them separately; try to locate the error.

  • Check your variables' names. There's "trop_e_grass" and "trop_grass". Is that accurate?

  • Using a Python IDE to test that code is a little tiring, but might help you.

  • Lastly, depending on where you're from (the version of your arcmap, you might have trouble with with decimal separation: some countries use commas, some use periods. See if the program is getting that 100% correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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