From cc33b07485c9c8c470f667d9281412cfe8876c46 Mon Sep 17 00:00:00 2001 From: nknoll Date: Wed, 29 Jan 2025 16:50:18 +0100 Subject: [PATCH] Added WMM 2025 --- ahrs/utils/WMM2025/WMM.COF | 93 ++++++++++++++++++++++ ahrs/utils/WMM2025/WMM2025_TEST_VALUES.txt | 31 ++++++++ ahrs/utils/wmm.py | 16 ++-- 3 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 ahrs/utils/WMM2025/WMM.COF create mode 100644 ahrs/utils/WMM2025/WMM2025_TEST_VALUES.txt diff --git a/ahrs/utils/WMM2025/WMM.COF b/ahrs/utils/WMM2025/WMM.COF new file mode 100644 index 0000000..b8eb8fc --- /dev/null +++ b/ahrs/utils/WMM2025/WMM.COF @@ -0,0 +1,93 @@ + 2025.0 WMM-2025 11/13/2024 + 1 0 -29351.8 0.0 12.0 0.0 + 1 1 -1410.8 4545.4 9.7 -21.5 + 2 0 -2556.6 0.0 -11.6 0.0 + 2 1 2951.1 -3133.6 -5.2 -27.7 + 2 2 1649.3 -815.1 -8.0 -12.1 + 3 0 1361.0 0.0 -1.3 0.0 + 3 1 -2404.1 -56.6 -4.2 4.0 + 3 2 1243.8 237.5 0.4 -0.3 + 3 3 453.6 -549.5 -15.6 -4.1 + 4 0 895.0 0.0 -1.6 0.0 + 4 1 799.5 278.6 -2.4 -1.1 + 4 2 55.7 -133.9 -6.0 4.1 + 4 3 -281.1 212.0 5.6 1.6 + 4 4 12.1 -375.6 -7.0 -4.4 + 5 0 -233.2 0.0 0.6 0.0 + 5 1 368.9 45.4 1.4 -0.5 + 5 2 187.2 220.2 0.0 2.2 + 5 3 -138.7 -122.9 0.6 0.4 + 5 4 -142.0 43.0 2.2 1.7 + 5 5 20.9 106.1 0.9 1.9 + 6 0 64.4 0.0 -0.2 0.0 + 6 1 63.8 -18.4 -0.4 0.3 + 6 2 76.9 16.8 0.9 -1.6 + 6 3 -115.7 48.8 1.2 -0.4 + 6 4 -40.9 -59.8 -0.9 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1 + 11 3 2.4 -0.6 0.0 -0.0 + 11 4 -0.6 0.2 0.0 0.1 + 11 5 -0.1 0.5 -0.1 -0.0 + 11 6 -0.6 -0.3 0.0 -0.0 + 11 7 -0.1 -1.2 -0.0 0.1 + 11 8 1.1 -1.7 -0.1 -0.0 + 11 9 -1.0 -2.9 -0.1 0.0 + 11 10 -0.2 -1.8 -0.1 0.0 + 11 11 2.6 -2.3 -0.1 0.0 + 12 0 -2.0 0.0 0.0 0.0 + 12 1 -0.2 -1.3 0.0 -0.0 + 12 2 0.3 0.7 -0.0 0.0 + 12 3 1.2 1.0 -0.0 -0.1 + 12 4 -1.3 -1.4 -0.0 0.1 + 12 5 0.6 -0.0 -0.0 -0.0 + 12 6 0.6 0.6 0.1 -0.0 + 12 7 0.5 -0.1 -0.0 -0.0 + 12 8 -0.1 0.8 0.0 0.0 + 12 9 -0.4 0.1 0.0 -0.0 + 12 10 -0.2 -1.0 -0.1 -0.0 + 12 11 -1.3 0.1 -0.0 0.0 + 12 12 -0.7 0.2 -0.1 -0.1 +999999999999999999999999999999999999999999999999 +999999999999999999999999999999999999999999999999 diff --git a/ahrs/utils/WMM2025/WMM2025_TEST_VALUES.txt b/ahrs/utils/WMM2025/WMM2025_TEST_VALUES.txt new file mode 100644 index 0000000..665b47d --- /dev/null +++ b/ahrs/utils/WMM2025/WMM2025_TEST_VALUES.txt @@ -0,0 +1,31 @@ +# Field 1: Date +# Field 2: Height above WGS84 ellipsoid (km) +# Field 3: Geodetic Latitude (deg) +# Field 4: Geodetic Longitude (deg) +# Field 5: X (nT) +# Field 6: Y (nT) +# Field 7: Z (nT) +# Field 8: H (nT) +# Field 9: F (nT) +# Field 10: Inclination (deg) +# Field 11: Declination (deg) +# Field 12: Grid Variation (deg) +# Field 13: Xdot (nT/yr) +# Field 14: Ydot (nT/yr) +# Field 15: Zdot (nT/yr) +# Field 16: Hdot (nT/yr) +# Field 17: Fdot (nT/yr) +# Field 18: Idot (deg/yr) +# Field 19: Ddot (deg/yr) + 2025.0 0.0 80.0 0.0 6521.6 145.9 54791.5 6523.2 55178.5 83.21 1.28 1.28 -8.3 59.5 31.1 -7.0 30.1 0.01 0.52 + 2025.0 0.0 0.0 120.0 39677.8 -109.6 -10580.2 39677.9 41064.3 -14.93 -0.16 NaN 9.5 -23.1 79.4 9.6 -11.2 0.11 -0.03 + 2025.0 0.0 -80.0 240.0 6117.5 15751.9 -52022.5 16898.1 54698.2 -72.00 68.78 -51.22 33.3 -8.6 95.5 4.0 -89.6 0.03 -0.12 + 2025.0 100.0 80.0 0.0 6216.0 92.4 52598.8 6216.7 52964.9 83.26 0.85 0.85 -7.7 56.5 28.7 -6.9 27.6 0.01 0.52 + 2025.0 100.0 0.0 120.0 37688.6 -96.2 -10152.1 37688.7 39032.1 -15.08 -0.15 NaN 9.2 -21.0 72.9 9.2 -10.0 0.11 -0.03 + 2025.0 100.0 -80.0 240.0 5907.6 14780.3 -49540.7 15917.1 52035.0 -72.19 68.21 -51.79 30.6 -8.0 89.2 3.9 -83.8 0.03 -0.11 + 2027.5 0.0 80.0 0.0 6500.8 294.5 54869.4 6507.5 55253.9 83.24 2.59 2.59 -8.3 59.5 31.1 -5.6 30.3 0.01 0.53 + 2027.5 0.0 0.0 120.0 39701.6 -167.4 -10381.8 39702.0 41036.9 -14.65 -0.24 NaN 9.5 -23.1 79.4 9.6 -10.7 0.11 -0.03 + 2027.5 0.0 -80.0 240.0 6200.7 15730.3 -51783.7 16908.3 54474.2 -71.92 68.49 -51.51 33.3 -8.6 95.5 4.2 -89.5 0.04 -0.12 + 2027.5 100.0 80.0 0.0 6196.7 233.8 52670.5 6201.1 53034.3 83.29 2.16 2.16 -7.7 56.5 28.7 -5.6 27.8 0.01 0.52 + 2027.5 100.0 0.0 120.0 37711.5 -148.7 -9969.8 37711.8 39007.4 -14.81 -0.23 NaN 9.2 -21.0 72.9 9.3 -9.7 0.11 -0.03 + 2027.5 100.0 -80.0 240.0 5984.0 14760.1 -49317.7 15927.0 51825.7 -72.10 67.93 -52.07 30.6 -8.0 89.2 4.0 -83.7 0.03 -0.11 diff --git a/ahrs/utils/wmm.py b/ahrs/utils/wmm.py index 90b99d3..c81cbaf 100644 --- a/ahrs/utils/wmm.py +++ b/ahrs/utils/wmm.py @@ -59,7 +59,7 @@ The secular variation (SV) is the yearly change of the core field, which is also accounted in the WMM by a linear model. Due to unpredictable changes in the core field, the values of the WMM coefficients are updated every five -years (a lustrum). The most recent version is valid from 2020 to 2024. +years (a lustrum). The most recent version is valid from 2020 to 2029. The geomagnetic field vector B is described by 7 elements: @@ -159,7 +159,7 @@ .. note:: The model in this package includes coefficients for dates between **2015** - and **2024** only. Models out of this timespan cannot be built. + and **2029** only. Models out of this timespan cannot be built. The WMM was developed jointly by the National Centers for Environmental Information (NCEI, Boulder CO, USA) (formerly National Geophysical Data Center @@ -291,9 +291,9 @@ class WMM: Every WMM object is created with a set of coefficients read from a COF file, defined by the desired working date of the model. The latest - model available is WMM2020 corresponding to the lustrum 2020-2024. + model available is WMM2025 corresponding to the lustrum 2025-2029. - This class can create models with dates between 2015 and 2024. + This class can create models with dates between 2015 and 2029. Parameters ---------- @@ -534,7 +534,13 @@ def reset_date(self, date: Union[datetime.date, int, float]) -> None: raise TypeError(f"Date must be an instance of datetime.date or a decimalized year. Got {type(date)}") if self.date.year < 2015: raise ValueError("No available coefficients for dates before 2015.") - self.wmm_filename = 'WMM2015/WMM.COF' if self.date_dec < 2020.0 else 'WMM2020/WMM.COF' + if self.date_dec < 2020.0: + self.wmm_filename = 'WMM2015/WMM.COF' + return + if self.date_dec < 2025.0: + self.wmm_filename = 'WMM2020/WMM.COF' + return + self.wmm_filename = 'WMM2025/WMM.COF' def denormalize_coefficients(self, latitude: float) -> None: """