I'm trying to create a runoff layer using this equation:
Q = (P – 0.2S)2 / (P + 0.8S)
The S in this equation is a soil retention layer that I made using this equation with curve numbers:
S = (1000.0 / CN) – 10.0
P, in this instance, is rainfall total for the storm-- in this case, a one-year storm for the watershed I am studying. I only have one value for P (3.01).
The soil retention layer is working, but the runoff layer isn't going through. I keep getting this error message when I type out the equation: "Error 000989: Python syntax error; parsing error; SyntaxError: invalid syntax (Line 1).
The instructions I have are part of a lab, and they also have this addendum:
"Use the S layer along with the P value to compute a Q layer, a cell by cell runoff layer from the 1-year storm. Use the standard equation below (assumes “normal soil moisture at the beginning of the storm”): Q runoff (inches) P rainfall total for the storm (inches) VERY IMPORTANT: Runoff does not start until P is greater than 0.2S. If P < 0.2S, then Q=0. You will need to set runoff to “0” in cells where P < 0.2S. Note the raster calculator Con function is helpful here."
So i'm not sure where to go from here, since everything I have tried thus far, including the usage of the Con function, have not worked. Any suggestions are welcome!
Did NOT mean to post this three times, oops
Using Raster Calculator, just write the expression on the right, i.e.,
Con(((0.2)*S)>(3.01),0,((((3.01)–((0.2)*S))**2)/((3.01)+((0.8)*S))))
Replace S with the Soil_Retension Raster, in the above equation.
I guess the solution that Jayanta Poddar provided will work, although you could probably reduce the number of brackets.
I ended up with:
Con(3.01 < 0.2*S, 0, (3.01 – 0.2*S)**2 / (3.01 + 0.8*S)
... assuming that the 2 in Q = (P – 0.2S)2 / (P + 0.8S) is a square: Q = (P – 0.2S)² / (P + 0.8S)
And if you don't want to calculate the soil retention before, you could do this:
Con(3.01 < 0.2*((1000.0 / CN) – 10.0), 0, (3.01 – 0.2*((1000.0 / CN) – 10.0))**2 / (3.01 + 0.8*((1000.0 / CN) – 10.0))
Please note that you are dividing by CN. In case CN is 0, this will result in NoData values.