AnsweredAssumed Answered

Complex AML IF to Python

Question asked by kfolger on Nov 5, 2013
Latest reply on Nov 7, 2013 by csny490
I am trying (going insane) to convert a complex if/else AML to Python. 

The code in the AML looks like:

if (sev_Y gt 0 & time_YN lt duration_Y & wasis_Y eq 96) {    wasis_N = wasis_Y    time_N = time_YN    } else if 


I've converted to Python that looks like any variation of this:

if ((sev_Y > 0) & (wasis_I == 96) & (timeYN < dur_Y)): #         wasis_N = wasis_Y         time_N = timeYN # elif ...


I keep getting a message about invalid use of raster with Boolean operator or function.  I've tried every combo I can think of with parens, using "and" instead of "&".  This is 3 tests that have to be true in order for the rasters below to calculate the values.  Any ideas?  This specific syntax thing is crazy making.  I've tried no parens between the tests, no parens for the whole test but only for the individual tests and nothing works.  A single test works fine, but I need all 3 to pass.

Outcomes