Magnetic
pyBADA Magnetic declination module Developped @EUROCONTROL (EIH) 2024
- class pyBADA.magnetic.Grid(inputJSON=None)[source]
Bases:
object
This class provides methods to calculate the magnetic declination at a given latitude and longitude using pre-loaded grid data.
The grid data is loaded from a JSON file, and the closest grid point is used to determine the magnetic declination.
- getClosestIdx(LAT_target, LON_target)[source]
Finds the index of the closest grid point for a given latitude and longitude.
- Parameters:
LAT_target (float) – Target latitude.
LON_target (float) – Target longitude.
- Returns:
Index of the closest point in the grid or None if no point is found.
- Return type:
int or None
- getClosestLatitude(LAT_target)[source]
Finds the closest latitude in the grid to the target latitude.
- Parameters:
LAT_target (float) – Target latitude to search for.
- Returns:
The closest latitude from the grid or None if the target is out of bounds.
- Return type:
float or None
- getClosestLongitude(LON_target)[source]
Finds the closest longitude in the grid to the target longitude.
- Parameters:
LON_target (float) – Target longitude to search for.
- Returns:
The closest longitude from the grid or None if the target is out of bounds.
- Return type:
float or None
- getMagneticDeclination(LAT_target, LON_target)[source]
Returns the magnetic declination for the closest grid point to the target coordinates.
- Parameters:
LAT_target (float) – Target latitude.
LON_target (float) – Target longitude.
- Returns:
Magnetic declination at the closest grid point or None if no point is found.
- Return type:
float or None