Available with Production Mapping license.
Summary
Computes the magnetic field at point locations for given date and altitude.
Usage
The Input Features parameter value must be points. You can filter input points by applying a layer definition query or selection set.
The Altitude parameter specifies the elevation as a linear unit of the input points. The Altitude value must be a numeric value above sea level. Do not use decimal degrees or unknown units.
The Altitude parameter applies the same elevation value to all points in the Input Features parameter. To use a different altitude value for each input point, use the Iterate Feature Selection or Iterate Field Value tool in ModelBuilder. The iterator can pass a value to the Altitude parameter. In this configuration, the tool runs once per input point.
Magnetic field values are written to existing fields. This tool does not create fields. To add a field, use the Add Field tool.
The Magnetic Component parameter field controls the type of magnetic field calculation. You must specify a magnetic component and an existing field to write to. You can calculate up to nine magnetic component types.
To use the Grid variation magnetic component, you must set the ArcGIS Pro data frame coordinate system to Lambert Conformal Conic. If you specify Grid variation with another coordinate system, the tool will fail.
This tool uses the World Magnetic Model 5-year epoch specific to the data provided. For example, if the data specified is from 2020, the model epoch released at the end of 2019 is used.
Caution:
This tool modifies the input data. See Tools that modify or update the input data for more information and strategies to avoid undesired data changes.
Syntax
arcpy.topographic.CalculateMagneticComponents(in_features, altitude, date, magnetic_component)
Parameter | Explanation | Data Type |
in_features | The point features for which magnetic field values will be calculated. | Feature Layer |
altitude | The elevation of the in_features value including the linear unit. Do not use decimal degrees or unknown units. The default is 0 meters. | Linear Unit |
date | The date for which magnetic field values will be calculated. The date must be valid for the specified World Magnetic Model. The format must use two digits for the month, two digits for the day, and four digits for the year. The default is the system current date. | Date |
magnetic_component [[component, field],...] | The magnetic component to calculate and the field to which the values will be written.
| Value Table |
Derived Output
Name | Explanation | Data Type |
updated_features | The in_features layer with the chosen fields updated. | Feature Layer |
Code sample
The following code sample demonstrates how to use the CalculateMagneticComponents tool in Python.
# Name: CalculateMagneticComponents_sample.py
# Description: Calculates four types of magnetic component fields for a feature class.
# Import System Modules
import arcpy
# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
# Setting Data Variables
ElevP2 = r'C:\Data\Edit_Sample.gdb\Features\ElevP'
ElevP_Layer = 'ElevP_Layer'
# Make Feature Layer from the ElevP feature class
arcpy.MakeFeatureLayer_management(ElevP2, ElevP_Layer)
# Add four magnetic component fields
arcpy.AddField_management('ElevP_Layer', 'Declination', 'LONG')
arcpy.AddField_management('ElevP_Layer', 'Annual_Drift', 'LONG')
arcpy.AddField_management('ElevP_Layer', 'Inclination', 'LONG')
arcpy.AddField_management('ElevP_Layer', 'Horizontal', 'LONG')
# Setting Local Variables
altitude = '1 Feet'
date = '1/1/2010'
magnetic_component = 'DECLINATION Declination;ANNUAL_DRIFT Annual_Drift;INCLINATION Inclination;HORIZONTAL Horizontal'
# Execute Calculate Magnetic Components
arcpy.CalculateMagneticComponents_topographic('ElevP_Layer', altitude, date, magnetic_component)
# Check In Extensions
arcpy.CheckInExtension('Foundation')
Environments
Licensing information
- Basic: No
- Standard: Requires Production Mapping
- Advanced: Requires Production Mapping