Label | Explanation | Data Type |
Input Layer
| The input features that will have a field calculated. | Table View |
Output Dataset
| A new dataset with calculated fields. | Feature Class;Table |
Field to Calculate
| Specifies whether values will be calculated for a newly created field or an existing field.
| String |
New Field Name
(Optional) | The new field that will have values calculated. | String |
Existing Field (Optional) | The existing field that will have values calculated. | Field |
Field Type
(Optional) | Specifies the field type for the calculated field.
| String |
Expression | Calculates values in the field. Expressions are written in Arcade and can include [+ - * / ] operators and multiple fields. Calculated values are applied in the units of the spatial reference of the input unless you are using a geographic coordinate system, in which case they will be in meters. If the layer is added to the map, the Fields and Helpers filters can be used to build an expression. | Calculator Expression |
Track Aware (Optional) | Specifies whether the expression will use a track-aware expression.
| Boolean |
Track Fields
| One or more fields that will be used to identify unique tracks. | Field |
Time Boundary Split
(Optional) |
A time span to split the input data into for analysis. A time boundary allows you to analyze values within a defined time span. For example, if you use a time boundary of 1 day, and set the time boundary reference to January 1, 1980, tracks will be split at the beginning of every day. | Time Unit |
Time Boundary Reference
(Optional) |
The reference time used to split the input data into for analysis. Time boundaries will be created for the entire span of the data, and the reference time does not need to occur at the start. If no reference time is specified, January 1, 1970, is used. | Date |
Summary
Creates a layer with calculated field values.
Parameters
arcpy.gapro.CalculateField(input_layer, output, field_to_calculate, {field_name}, {existing_field}, {field_type}, expression, {track_aware}, track_fields, {time_boundary_split}, {time_boundary_reference})
Name | Explanation | Data Type |
input_layer | The input features that will have a field calculated. | Table View |
output | A new dataset with calculated fields. | Feature Class;Table |
field_to_calculate | Specifies whether values will be calculated for a newly created field or an existing field.
| String |
field_name (Optional) | The new field that will have values calculated. | String |
existing_field (Optional) | The existing field that will have values calculated. | Field |
field_type (Optional) | Specifies the field type for the calculated field.
| String |
expression | Calculates values in the field. Expressions are written in Arcade and can include operators and multiple fields. Calculated values are applied in the units of the spatial reference of the input unless you are using a geographic coordinate system, in which case they will be in meters. | Calculator Expression |
track_aware (Optional) | Specifies whether the expression will use a track-aware expression.
| Boolean |
track_fields [track_fields,...] | One or more fields that will be used to identify unique tracks. | Field |
time_boundary_split (Optional) |
A time span to split the input data into for analysis. A time boundary allows you to analyze values within a defined time span. For example, if you use a time boundary of 1 day, and set the time boundary reference to January 1, 1980, tracks will be split at the beginning of every day. | Time Unit |
time_boundary_reference (Optional) |
The reference time used to split the input data into for analysis. Time boundaries will be created for the entire span of the data, and the reference time does not need to occur at the start. If no reference time is specified, January 1, 1970, is used. | Date |
Code sample
The following Python window script demonstrates how to use the CalculateField tool.
#-------------------------------------------------------------------------------
# Name: CalculateField.py
# Description: Calculate the mean of the 3 most recent speed measurements in hurricane tracks
# Import system modules
import arcpy
arcpy.env.workspace = "C:/data/Weather.gdb"
# Set local variables
inFeatures = "Hurricanes"
fieldName = "MeanSpeed3"
out = "HurricaneTracks_Mean"
calcExpression = "Date($feature.DateAsString)"
# Execute Calculate Field
arcpy.gapro.CalculateField(inFeatures, out, "NEW_FIELD", fieldName, "", "Date",
calcExpression)
Licensing information
- Basic: No
- Standard: No
- Advanced: Yes