Geographic Information Systems Asked by 532 on May 3, 2021
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
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
Answered by user2856 on May 3, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP