Skip to main content
added 25 characters in body
Source Link
user2856
  • 69.6k
  • 6
  • 119
  • 203

The error tells you exactly what is wrong and where IndentationError: expected an indented block (line 7). You need to indent lines in your if clause:

if value > 1:
    outraster = (f1 + f2 + f3)/3
else:
    outraster = (f1 + f2 +f3)/3 - 1

However, this code won't do what you want it to. You need to use Con:

f123 = f1 + f2 + f3
outraster = Con(f123 > 0, f123 / 3, f123 / 3 - 1)
outraster.save(filepath'S:/npenme2/Faunalyze/rasterCalc')

The error tells you exactly what is wrong and where IndentationError: expected an indented block (line 7). You need to indent lines in your if clause:

if value > 1:
    outraster = (f1 + f2 + f3)/3
else:
    outraster = (f1 + f2 +f3)/3 - 1

However, this code won't do what you want it to. You need to use Con:

f123 = f1 + f2 + f3
outraster = Con(f123 > 0, f123 / 3, f123 / 3 - 1)
outraster.save(filepath)

The error tells you exactly what is wrong and where IndentationError: expected an indented block (line 7). You need to indent lines in your if clause:

if value > 1:
    outraster = (f1 + f2 + f3)/3
else:
    outraster = (f1 + f2 +f3)/3 - 1

However, this code won't do what you want it to. You need to use Con:

f123 = f1 + f2 + f3
outraster = Con(f123 > 0, f123 / 3, f123 / 3 - 1)
outraster.save('S:/npenme2/Faunalyze/rasterCalc')
added 187 characters in body
Source Link
user2856
  • 69.6k
  • 6
  • 119
  • 203

The error tells you exactly what is wrong and where IndentationError: expected an indented block (line 7). You need to indent lines in your if clause:

if value > 1:
    outraster = (f1 + f2 + f3)/3
else:
    outraster = (f1 + f2 +f3)/3 - 1

However, this code won't do what you want it to. You need to use Con:

f123 = f1 + f2 + f3
outraster = Con(f123 > 0, f123 / 3, f123 / 3 - 1)
outraster.save(filepath)

The error tells you exactly what is wrong and where IndentationError: expected an indented block (line 7). You need to indent lines in your if clause:

if value > 1:
    outraster = (f1 + f2 + f3)/3
else:
    outraster = (f1 + f2 +f3)/3 - 1

The error tells you exactly what is wrong and where IndentationError: expected an indented block (line 7). You need to indent lines in your if clause:

if value > 1:
    outraster = (f1 + f2 + f3)/3
else:
    outraster = (f1 + f2 +f3)/3 - 1

However, this code won't do what you want it to. You need to use Con:

f123 = f1 + f2 + f3
outraster = Con(f123 > 0, f123 / 3, f123 / 3 - 1)
outraster.save(filepath)
Source Link
user2856
  • 69.6k
  • 6
  • 119
  • 203

The error tells you exactly what is wrong and where IndentationError: expected an indented block (line 7). You need to indent lines in your if clause:

if value > 1:
    outraster = (f1 + f2 + f3)/3
else:
    outraster = (f1 + f2 +f3)/3 - 1