Select to view content in your preferred language

Calculations in one field

364
2
Jump to solution
02-28-2024 12:17 AM
Labels (3)
HusamJubeh
New Contributor III

Hello all
I have four calculations, the final result of which is the field value.
Can you help me write it in Python 3?

A = abs(!AREA_RECORD! - !Shape_Area!)
B = 0.8*math.sqrt(!AREA_RECORD!)+0.002* !AREA_RECORD!
C= abs(B- A)
D = B - C
print D

Thanks

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
GeeteshSingh07
Occasional Contributor II

Hope this helps,

If you're running this in 'Calculate Field', this will be the format. In Code Block,

 

import math

def calculate_D(AREA_RECORD, Shape_Area):
    A = abs(AREA_RECORD - Shape_Area)
    B = 0.8 * math.sqrt(AREA_RECORD) + 0.002 * AREA_RECORD
    C = abs(B - A)
    D = B - C
    return D

 

Expression:

 

calculate_D(!AREA_RECORD!, !Shape_Area!)

 

For example,

GeeteshSingh07_0-1709111992957.png

 

Reference: https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-field-examples.htm

View solution in original post

2 Replies
GeeteshSingh07
Occasional Contributor II

Hope this helps,

If you're running this in 'Calculate Field', this will be the format. In Code Block,

 

import math

def calculate_D(AREA_RECORD, Shape_Area):
    A = abs(AREA_RECORD - Shape_Area)
    B = 0.8 * math.sqrt(AREA_RECORD) + 0.002 * AREA_RECORD
    C = abs(B - A)
    D = B - C
    return D

 

Expression:

 

calculate_D(!AREA_RECORD!, !Shape_Area!)

 

For example,

GeeteshSingh07_0-1709111992957.png

 

Reference: https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-field-examples.htm

HusamJubeh
New Contributor III

Thank

0 Kudos