6

I am using the Calculate Field tool in ArcGIS Pro to get it to calculate fire hydrant flow data. I need data from the table fields PitotPressure, COE, and HydrantOrificeFlowed in an attribute table to calculate the gallons per minuite to be stored into field Flow_Indiv in the same table. When I define the function as below, the code check feature says the "Expression is Valid" but when I run the code, I get the following error message:

ERROR 000539: Traceback (most recent call last):
  File "<expression>", line 1, in <module>
TypeError: iFlow() missing 2 required positional arguments: 'HydrantOrificeFlowed' and 'PitotPressure'
 Failed to execute (CalculateField). 

Notice the first argument listed in the def below (COE) is not listed a "missing" - only the two subsequent arguments are missing.

It seems the only argument the function sees is the first one listed in the def parameters (in this case, COE). If I move them around, such as list PitotPressure first, it does not see the positional argument, COE.

I have experimented with this same layout, except I used only one parameter from a table field and a simple equation to multiply the called field parameter by an arbitrary number and it works fine. It's only when I add additional parameters that I get the error message.

The code is below.

Flow_Indiv=
iFlow(!PitotPressure!!COE!!HydrantOrificeFlowed!)

Code Block

def iFlow(COE, HydrantOrificeFlowed, PitotPressure):
    if HydrantOrificeFlowed <= 4:
        return 29.84 * (COE * (math.pow(HydrantOrificeFlowed, 2 )*(math.sqrt(PitotPressure))))
    else:
        return 5
0

1 Answer 1

4

You need to separate arguments with commas

Flow_Indiv= iFlow(!PitotPressure!, !COE!, !HydrantOrificeFlowed!)

Code Block

def iFlow(PitotPressure, COE, HydrantOrificeFlowed):
    if HydrantOrificeFlowed <= 4:
        return 29.84 * (COE * (math.pow(HydrantOrificeFlowed, 2 )*(math.sqrt(PitotPressure))))
    else:
        return 5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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