Hello,
I am trying to get the tools Tree Points from LAS dataset and NAIP to work in ArcgisPro.
there is a calculate field with the formula "2 * Sqr (([Accum] * %Pixel Size% * %Pixel Size%) /3.14159265)"
how do i get this to work in ArcgisPro with python
Greetings,
Peter
Solved! Go to Solution.
2 * math.sqrt (( !Accum! * %Pixel Size% * %Pixel Size%) / 3.14159265) - this is from the Pro version of Trees from Lidar.
I am not familiar with this tool. If it is published somewhere, please provide a link.
It looks like this is in Model Builder (with the model variable %Pixel Size% in it).
This should work okay. I used a code block.
# VBA Calculate Field expression
# "2 * Sqr (([Accum] * %Pixel Size% * %Pixel Size%) /3.14159265)"
# Calculate Field Python expression
f(!Accum!, %Pixel Size%)
# Calculate Field Python code block
import math
def f(accum, pix):
return 2 * (((accum * pix * pix) / math.pi) ** 2)
# Use PYTHON_9.3
thank you for your help.
this is the tool
https://www.arcgis.com/home/item.html?id=d280e1c023084992b98088d9f14d3252
i still have a error:
file "<string>", line 1
f(!Accum!, %pixel size%)
syntax error: invalid systax
i am working in arcgis pro so python 3
Are your fields names as such? and is %pixel size% title cased? (%Pixel Size%)?
I agree %Pixel Size% would be better as that's what the value field is named in the model.
You also may have to do this to force data type (VB kind of doesn't care)
f(!Accum!, float(%Pixel Size%))
The author of the tool unwisely left his email address so you may want to check with him and see if he any plans to upgrade to Pro. He may want a copy of your model!
2 * math.sqrt (( !Accum! * %Pixel Size% * %Pixel Size%) / 3.14159265) - this is from the Pro version of Trees from Lidar.