ppigrf 1.0.2__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ppigrf
3
- Version: 1.0.2
3
+ Version: 2.0.0
4
4
  Summary: Pure Python IGRF
5
5
  Author: Karl Laundal
6
6
  Author-email: readme@file.md
@@ -11,15 +11,27 @@ Classifier: Programming Language :: Python :: 3
11
11
  Requires-Python: >=3.6
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Requires-Dist: numpy>=0.13.1
15
+ Requires-Dist: pandas>=1.3.5
14
16
 
15
17
  # Pure Python International Geomagnetic Reference Field
16
18
  [![DOI](https://zenodo.org/badge/352365168.svg)](https://zenodo.org/badge/latestdoi/352365168)
17
19
 
18
20
  Pure Python code to calculate IGRF model predictions. The IGRF is a model of the Earth's main magnetic field that is updated every 5 years.
19
- See https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html for details and https://doi.org/10.1186/s40623-020-01163-9 for even more details.
20
21
 
21
- The code is vectorized, so calculations should be pretty fast.
22
+ References:
23
+ - IAGA V-MOD WG and main IGRF website:
24
+ https://www.ncei.noaa.gov/products/international-geomagnetic-reference-field
25
+ - IGRF-13 (2020):
26
+ - International Geomagnetic Reference Field: the 13th generation, Alken, P., Thébault, E., Beggan, C.D. et al. International Geomagnetic Reference Field: the thirteenth generation. Earth Planets Space 73, 49 (2021). doi: [10.1186/s40623-020-01288-x](https://doi.org/10.1186/s40623-020-01288-x)
27
+ - [EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf13)
28
+ - IGRF-14 (2025):
29
+ - International Association of Geomagnetism and Aeronomy. (2024). IGRF-14. Zenodo. https://doi.org/10.5281/zenodo.14012302
30
+ - (article in progress)
31
+ - [In progress: EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf14)
32
+ - Evaluation code: https://github.com/IAGA-VMOD/IGRF14eval
22
33
 
34
+ **Note that this code now defaults to use IGRF-14**
23
35
 
24
36
  ## Install
25
37
  The only dependencies are Numpy and Pandas. Install by either
@@ -69,6 +81,29 @@ Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates)
69
81
  ```
70
82
  The output will have shape `(4, 2, 3)`.
71
83
 
84
+ ## How to test?
85
+
86
+ It is possible to run some tests that corroborates that `ppigrf` works as
87
+ expected. To do so you need to install [`pytest`](https://docs.pytest.org). You
88
+ can do so through `pip`:
89
+
90
+ ```
91
+ pip install pytest
92
+ ```
93
+
94
+ Then you need to clone this repository and install `ppigrf`:
95
+
96
+ ```
97
+ python setup.py install
98
+ ```
99
+
100
+ Finally you can test the installed version of `ppigrf` with:
101
+
102
+ ```
103
+ pytest -v
104
+ ```
105
+
106
+
72
107
  ## Why?
73
108
  There are lots of Python modules that can calculate IGRF values. Most are wrappers of Fortran code, which can be tricky to compile. This version is pure Python. For most applications it is still quite fast. I also prefer the ppigrf interface over the alternatives.
74
109
 
@@ -2,10 +2,20 @@
2
2
  [![DOI](https://zenodo.org/badge/352365168.svg)](https://zenodo.org/badge/latestdoi/352365168)
3
3
 
4
4
  Pure Python code to calculate IGRF model predictions. The IGRF is a model of the Earth's main magnetic field that is updated every 5 years.
5
- See https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html for details and https://doi.org/10.1186/s40623-020-01163-9 for even more details.
6
5
 
7
- The code is vectorized, so calculations should be pretty fast.
6
+ References:
7
+ - IAGA V-MOD WG and main IGRF website:
8
+ https://www.ncei.noaa.gov/products/international-geomagnetic-reference-field
9
+ - IGRF-13 (2020):
10
+ - International Geomagnetic Reference Field: the 13th generation, Alken, P., Thébault, E., Beggan, C.D. et al. International Geomagnetic Reference Field: the thirteenth generation. Earth Planets Space 73, 49 (2021). doi: [10.1186/s40623-020-01288-x](https://doi.org/10.1186/s40623-020-01288-x)
11
+ - [EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf13)
12
+ - IGRF-14 (2025):
13
+ - International Association of Geomagnetism and Aeronomy. (2024). IGRF-14. Zenodo. https://doi.org/10.5281/zenodo.14012302
14
+ - (article in progress)
15
+ - [In progress: EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf14)
16
+ - Evaluation code: https://github.com/IAGA-VMOD/IGRF14eval
8
17
 
18
+ **Note that this code now defaults to use IGRF-14**
9
19
 
10
20
  ## Install
11
21
  The only dependencies are Numpy and Pandas. Install by either
@@ -55,6 +65,29 @@ Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates)
55
65
  ```
56
66
  The output will have shape `(4, 2, 3)`.
57
67
 
68
+ ## How to test?
69
+
70
+ It is possible to run some tests that corroborates that `ppigrf` works as
71
+ expected. To do so you need to install [`pytest`](https://docs.pytest.org). You
72
+ can do so through `pip`:
73
+
74
+ ```
75
+ pip install pytest
76
+ ```
77
+
78
+ Then you need to clone this repository and install `ppigrf`:
79
+
80
+ ```
81
+ python setup.py install
82
+ ```
83
+
84
+ Finally you can test the installed version of `ppigrf` with:
85
+
86
+ ```
87
+ pytest -v
88
+ ```
89
+
90
+
58
91
  ## Why?
59
92
  There are lots of Python modules that can calculate IGRF values. Most are wrappers of Fortran code, which can be tricky to compile. This version is pure Python. For most applications it is still quite fast. I also prefer the ppigrf interface over the alternatives.
60
93
 
@@ -17,7 +17,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
17
17
 
18
18
  setuptools.setup(
19
19
  name="ppigrf",
20
- version="1.0.2",
20
+ version="2.0.0",
21
21
  author="Karl Laundal",
22
22
  author_email="readme@file.md",
23
23
  description="Pure Python IGRF",
@@ -34,7 +34,7 @@ setuptools.setup(
34
34
  'pandas>=1.3.5'
35
35
  ],
36
36
  package_dir={"": "src"},
37
- package_data={'':['IGRF13.shc']},
37
+ package_data={'':['IGRF13.shc', 'IGRF14.shc']},
38
38
  packages=setuptools.find_packages(where="src"),
39
39
  python_requires=">=3.6",
40
- )
40
+ )
@@ -0,0 +1,200 @@
1
+ # IGRF 14
2
+ # International Geomagnetic Reference Field -- 14th generation
3
+ # see https://doi.org/10.5281/zenodo.14012303 for detailed description
4
+ 1 13 26 2 1 1900.0 2030.0
5
+ 1900.0 1905.0 1910.0 1915.0 1920.0 1925.0 1930.0 1935.0 1940.0 1945.0 1950.0 1955.0 1960.0 1965.0 1970.0 1975.0 1980.0 1985.0 1990.0 1995.0 2000.0 2005.0 2010.0 2015.0 2020.0 2025.0 2030.0
6
+ 1 0 -31543 -31464 -31354 -31212 -31060 -30926 -30805 -30715 -30654 -30594 -30554 -30500 -30421 -30334 -30220 -30100 -29992 -29873 -29775 -29692 -29619.4 -29554.63 -29496.57 -29441.46 -29403.41 -29350.0 -29287.0
7
+ 1 1 -2298 -2298 -2297 -2306 -2317 -2318 -2316 -2306 -2292 -2285 -2250 -2215 -2169 -2119 -2068 -2013 -1956 -1905 -1848 -1784 -1728.2 -1669.05 -1586.42 -1501.77 -1451.37 -1410.3 -1360.3
8
+ 1 -1 5922 5909 5898 5875 5845 5817 5808 5812 5821 5810 5815 5820 5791 5776 5737 5675 5604 5500 5406 5306 5186.1 5077.99 4944.26 4795.99 4653.35 4545.5 4438.0
9
+ 2 0 -677 -728 -769 -802 -839 -893 -951 -1018 -1106 -1244 -1341 -1440 -1555 -1662 -1781 -1902 -1997 -2072 -2131 -2200 -2267.7 -2337.24 -2396.06 -2445.88 -2499.78 -2556.2 -2612.2
10
+ 2 1 2905 2928 2948 2956 2959 2969 2980 2984 2981 2990 2998 3003 3002 2997 3000 3010 3027 3044 3059 3070 3068.4 3047.69 3026.34 3012.20 2981.96 2950.9 2924.4
11
+ 2 -1 -1061 -1086 -1128 -1191 -1259 -1334 -1424 -1520 -1614 -1702 -1810 -1898 -1967 -2016 -2047 -2067 -2129 -2197 -2279 -2366 -2481.6 -2594.50 -2708.54 -2845.41 -2991.72 -3133.6 -3270.1
12
+ 2 2 924 1041 1176 1309 1407 1471 1517 1550 1566 1578 1576 1581 1590 1594 1611 1632 1663 1687 1686 1681 1670.9 1657.76 1668.17 1676.35 1676.85 1648.7 1607.2
13
+ 2 -2 1121 1065 1000 917 823 728 644 586 528 477 381 291 206 114 25 -68 -200 -306 -373 -413 -458.0 -515.43 -575.73 -642.17 -734.62 -814.2 -869.7
14
+ 3 0 1022 1037 1058 1084 1111 1140 1172 1206 1240 1282 1297 1302 1302 1297 1287 1276 1281 1296 1314 1335 1339.6 1336.30 1339.85 1350.33 1363.00 1360.9 1353.4
15
+ 3 1 -1469 -1494 -1524 -1559 -1600 -1645 -1692 -1740 -1790 -1834 -1889 -1944 -1992 -2038 -2091 -2144 -2180 -2208 -2239 -2267 -2288.0 -2305.83 -2326.54 -2352.26 -2380.80 -2404.2 -2426.2
16
+ 3 -1 -330 -357 -389 -421 -445 -462 -480 -494 -499 -499 -476 -462 -414 -404 -366 -333 -336 -310 -284 -262 -227.6 -198.86 -160.40 -115.29 -81.96 -56.9 -37.9
17
+ 3 2 1256 1239 1223 1212 1205 1202 1205 1215 1232 1255 1274 1288 1289 1292 1278 1260 1251 1247 1248 1249 1252.1 1246.39 1232.10 1225.85 1236.06 1243.8 1245.8
18
+ 3 -2 3 34 62 84 103 119 133 146 163 186 206 216 224 240 251 262 271 284 293 302 293.4 269.72 251.75 245.04 241.80 237.6 236.6
19
+ 3 3 572 635 705 778 839 881 907 918 916 913 896 882 878 856 838 830 833 829 802 759 714.5 672.51 633.73 581.69 525.60 453.4 375.4
20
+ 3 -3 523 480 425 360 293 229 166 101 43 -11 -46 -83 -130 -165 -196 -223 -252 -297 -352 -427 -491.1 -524.72 -537.03 -538.70 -542.52 -549.6 -569.1
21
+ 4 0 876 880 884 887 889 891 896 903 914 944 954 958 957 957 952 946 938 936 939 940 932.3 920.55 912.66 907.42 902.82 894.7 886.2
22
+ 4 1 628 643 660 678 695 711 727 744 762 776 792 796 800 804 800 791 782 780 780 780 786.8 797.96 808.97 813.68 809.47 799.6 788.1
23
+ 4 -1 195 203 211 218 220 216 205 188 169 144 136 133 135 148 167 191 212 232 247 262 272.6 282.07 286.48 283.54 282.10 278.6 272.1
24
+ 4 2 660 653 644 631 616 601 584 565 550 544 528 510 504 479 461 438 398 361 325 290 250.0 210.65 166.58 120.49 86.18 55.8 26.8
25
+ 4 -2 -69 -77 -90 -109 -134 -163 -195 -226 -252 -276 -278 -274 -278 -269 -266 -265 -257 -249 -240 -236 -231.9 -225.23 -211.03 -188.43 -158.50 -134.0 -113.5
26
+ 4 3 -361 -380 -400 -416 -424 -426 -422 -415 -405 -421 -408 -397 -394 -390 -395 -405 -419 -424 -423 -418 -403.0 -379.86 -356.83 -334.85 -309.47 -281.1 -254.1
27
+ 4 -3 -210 -201 -189 -173 -153 -130 -109 -90 -72 -55 -37 -23 3 13 26 39 53 69 84 97 119.8 145.15 164.46 180.95 199.75 212.0 220.0
28
+ 4 4 134 146 160 178 199 217 234 249 265 304 303 290 269 252 234 216 199 170 141 122 111.3 100.00 89.40 70.38 47.44 12.0 -22.0
29
+ 4 -4 -75 -65 -55 -51 -57 -70 -90 -114 -141 -178 -210 -230 -255 -269 -279 -288 -297 -297 -299 -306 -303.8 -305.36 -309.72 -329.23 -350.30 -375.4 -395.9
30
+ 5 0 -184 -192 -201 -211 -221 -230 -237 -241 -241 -253 -240 -229 -222 -219 -216 -218 -218 -214 -214 -214 -218.8 -227.00 -230.87 -232.91 -234.42 -232.9 -229.9
31
+ 5 1 328 328 327 327 326 326 327 329 334 346 349 360 362 358 359 356 357 355 353 352 351.4 354.41 357.29 360.14 363.26 369.0 375.5
32
+ 5 -1 -210 -193 -172 -148 -122 -96 -72 -51 -33 -12 3 15 16 19 26 31 46 47 46 46 43.8 42.72 44.58 46.98 47.52 45.3 42.8
33
+ 5 2 264 259 253 245 236 226 218 211 208 194 211 230 242 254 262 264 261 253 245 235 222.3 208.95 200.26 192.35 187.86 187.2 187.2
34
+ 5 -2 53 56 57 58 58 58 60 64 71 95 103 110 125 128 139 148 150 150 154 165 171.9 180.25 189.01 196.98 208.36 220.0 230.5
35
+ 5 3 5 -1 -9 -16 -23 -28 -32 -33 -33 -20 -20 -23 -26 -31 -42 -59 -74 -93 -109 -118 -130.4 -136.54 -141.05 -140.94 -140.73 -138.7 -135.2
36
+ 5 -3 -33 -32 -33 -34 -38 -44 -53 -64 -75 -67 -87 -98 -117 -126 -139 -152 -151 -154 -153 -143 -133.1 -123.45 -118.06 -119.14 -121.43 -122.9 -120.4
37
+ 5 4 -86 -93 -102 -111 -119 -125 -131 -136 -141 -142 -147 -152 -156 -157 -160 -159 -162 -164 -165 -166 -168.6 -168.05 -163.17 -157.40 -151.16 -141.9 -130.4
38
+ 5 -4 -124 -125 -126 -126 -125 -122 -118 -115 -113 -119 -122 -121 -114 -97 -91 -83 -78 -75 -69 -55 -39.3 -19.57 -0.01 15.98 32.09 42.9 51.4
39
+ 5 5 -16 -26 -38 -51 -62 -69 -74 -76 -76 -82 -76 -69 -63 -62 -56 -49 -48 -46 -36 -17 -12.9 -13.55 -8.03 4.30 13.98 20.9 25.9
40
+ 5 -5 3 11 21 32 43 51 58 64 69 82 80 78 81 81 83 88 92 95 97 107 106.3 103.85 101.04 100.12 99.14 106.2 115.7
41
+ 6 0 63 62 62 61 61 61 60 59 57 59 54 47 46 45 43 45 48 53 61 68 72.3 73.60 72.78 69.55 65.97 64.3 63.3
42
+ 6 1 61 60 58 57 55 54 53 53 54 57 57 57 58 61 64 66 66 65 65 67 68.2 69.56 68.69 67.57 65.56 63.8 62.3
43
+ 6 -1 -9 -7 -5 -2 0 3 4 4 4 6 -1 -9 -10 -11 -12 -13 -15 -16 -16 -17 -17.4 -20.33 -20.90 -20.61 -19.22 -18.4 -16.9
44
+ 6 2 -11 -11 -11 -10 -10 -9 -9 -8 -7 6 4 3 1 8 15 28 42 51 59 68 74.2 76.74 75.92 72.79 72.96 76.7 80.7
45
+ 6 -2 83 86 89 93 96 99 102 104 105 100 99 96 99 100 100 99 93 88 82 72 63.7 54.75 44.18 33.30 25.02 16.8 8.8
46
+ 6 3 -217 -221 -224 -228 -233 -238 -242 -246 -249 -246 -247 -247 -237 -228 -212 -198 -192 -185 -178 -170 -160.9 -151.34 -141.40 -129.85 -121.57 -115.7 -109.7
47
+ 6 -3 2 4 5 8 11 14 19 25 33 16 33 48 60 68 72 75 71 69 69 67 65.1 63.63 61.54 58.74 52.76 48.9 46.9
48
+ 6 4 -58 -57 -54 -51 -46 -40 -32 -25 -18 -25 -16 -8 -1 4 2 1 4 4 3 -1 -5.9 -14.58 -22.83 -28.93 -36.06 -40.9 -44.9
49
+ 6 -4 -35 -32 -29 -26 -22 -18 -16 -15 -15 -9 -12 -16 -20 -32 -37 -41 -43 -48 -52 -58 -61.2 -63.53 -66.26 -66.64 -64.40 -59.8 -55.8
50
+ 6 5 59 57 54 49 44 39 32 25 18 21 12 7 -2 1 3 6 14 16 18 19 16.9 14.58 13.10 13.14 13.60 14.9 16.9
51
+ 6 -5 36 32 28 23 18 13 8 4 0 -16 -12 -12 -11 -8 -6 -4 -2 -1 1 1 0.7 0.24 3.02 7.35 8.96 10.9 14.4
52
+ 6 6 -90 -92 -95 -98 -101 -103 -104 -106 -107 -104 -105 -107 -113 -111 -112 -111 -108 -102 -96 -93 -90.4 -86.36 -78.09 -70.85 -64.80 -60.8 -56.3
53
+ 6 -6 -69 -67 -65 -62 -57 -52 -46 -40 -33 -39 -30 -24 -17 -7 1 11 17 21 24 36 43.8 50.94 55.40 62.41 68.04 72.8 77.3
54
+ 7 0 70 70 71 72 73 73 74 74 74 70 65 65 67 75 72 71 72 74 77 77 79.0 79.88 80.44 81.29 80.54 79.6 79.1
55
+ 7 1 -55 -54 -54 -54 -54 -54 -54 -53 -53 -40 -55 -56 -56 -57 -57 -56 -59 -62 -64 -72 -74.0 -74.46 -75.00 -75.99 -76.63 -76.9 -77.4
56
+ 7 -1 -45 -46 -47 -48 -49 -50 -51 -52 -52 -45 -35 -50 -55 -61 -70 -77 -82 -83 -80 -69 -64.6 -61.14 -57.80 -54.27 -51.50 -48.9 -45.9
57
+ 7 2 0 0 1 2 2 3 4 4 4 0 2 2 5 4 1 1 2 3 2 1 0.0 -1.65 -4.55 -6.79 -8.23 -8.8 -9.3
58
+ 7 -2 -13 -14 -14 -14 -14 -14 -15 -17 -18 -18 -17 -24 -28 -27 -27 -26 -27 -27 -26 -25 -24.2 -22.57 -21.20 -19.53 -16.85 -14.4 -11.9
59
+ 7 3 34 33 32 31 29 27 25 23 20 0 1 10 15 13 14 16 21 24 26 28 33.3 38.73 45.24 51.82 56.45 59.3 61.8
60
+ 7 -3 -10 -11 -12 -12 -13 -14 -14 -14 -14 2 0 -4 -6 -2 -4 -5 -5 -2 0 4 6.2 6.82 6.54 5.59 2.36 -1.0 -4.5
61
+ 7 4 -41 -41 -40 -38 -37 -35 -34 -33 -31 -29 -40 -32 -32 -26 -22 -14 -12 -6 -1 5 9.1 12.30 14.00 15.07 15.80 15.8 15.3
62
+ 7 -4 -1 0 1 2 4 5 6 7 7 6 10 8 7 6 8 10 16 20 21 24 24.0 25.35 24.96 24.45 23.56 23.5 23.5
63
+ 7 5 -21 -20 -19 -18 -16 -14 -12 -11 -9 -10 -7 -11 -7 -6 -2 0 1 4 5 4 6.9 9.37 10.46 9.32 6.30 2.5 -1.5
64
+ 7 -5 28 28 28 28 28 29 29 29 29 28 36 28 23 26 23 22 18 17 17 17 14.8 10.93 7.03 3.27 -2.19 -7.4 -11.9
65
+ 7 6 18 18 18 19 19 19 18 18 17 15 5 9 17 13 13 12 11 10 9 8 7.3 5.42 1.64 -2.88 -7.21 -11.2 -15.2
66
+ 7 -6 -12 -12 -13 -15 -16 -17 -18 -19 -20 -17 -18 -20 -18 -23 -23 -23 -23 -23 -23 -24 -25.4 -26.32 -27.61 -27.50 -27.19 -25.1 -22.6
67
+ 7 7 6 6 6 6 6 6 6 6 5 29 19 18 8 1 -2 -5 -2 0 0 -2 -1.2 1.94 4.92 6.61 9.77 14.3 18.8
68
+ 7 -7 -22 -22 -22 -22 -22 -21 -20 -19 -19 -22 -16 -18 -17 -12 -11 -12 -10 -7 -4 -6 -5.8 -4.64 -3.28 -2.32 -1.90 -2.2 -3.7
69
+ 8 0 11 11 11 11 11 11 11 11 11 13 22 11 15 13 14 14 18 21 23 25 24.4 24.80 24.41 23.98 23.66 23.1 22.6
70
+ 8 1 8 8 8 8 7 7 7 7 7 7 15 9 6 5 6 6 6 6 5 6 6.6 7.62 8.21 8.89 9.74 10.9 11.9
71
+ 8 -1 8 8 8 8 8 8 8 8 8 12 5 10 11 7 7 6 7 8 10 11 11.9 11.20 10.84 10.04 8.43 7.2 5.7
72
+ 8 2 -4 -4 -4 -4 -3 -3 -3 -3 -3 -8 -4 -6 -4 -4 -2 -1 0 0 -1 -6 -9.2 -11.73 -14.50 -16.78 -17.49 -17.5 -17.5
73
+ 8 -2 -14 -15 -15 -15 -15 -15 -15 -15 -14 -21 -22 -15 -14 -12 -15 -16 -18 -19 -19 -21 -21.5 -20.88 -20.03 -18.26 -15.23 -12.6 -10.6
74
+ 8 3 -9 -9 -9 -9 -9 -9 -9 -9 -10 -5 -1 -14 -11 -14 -13 -12 -11 -11 -10 -9 -7.9 -6.88 -5.59 -3.16 -0.49 2.0 4.0
75
+ 8 -3 7 7 6 6 6 6 5 5 5 -12 0 5 7 9 6 4 4 5 6 8 8.5 9.83 11.83 13.18 12.83 11.5 10.0
76
+ 8 4 1 1 1 2 2 2 2 1 1 9 11 6 2 0 -3 -8 -7 -9 -12 -14 -16.6 -18.11 -19.34 -20.56 -21.07 -21.8 -22.3
77
+ 8 -4 -13 -13 -13 -13 -14 -14 -14 -15 -15 -7 -21 -23 -18 -16 -17 -19 -22 -23 -22 -23 -21.5 -19.71 -17.41 -14.60 -11.76 -9.7 -7.7
78
+ 8 5 2 2 2 3 4 4 5 6 6 7 15 10 10 8 5 4 4 4 3 9 9.1 10.17 11.61 13.33 15.28 16.9 18.4
79
+ 8 -5 5 5 5 5 5 5 5 5 5 2 -8 3 4 4 6 6 9 11 12 15 15.5 16.22 16.71 16.16 14.94 12.7 10.2
80
+ 8 6 -9 -8 -8 -8 -7 -7 -6 -6 -5 -10 -13 -7 -5 -1 0 0 3 4 4 6 7.0 9.36 10.85 11.76 13.65 14.9 15.4
81
+ 8 -6 16 16 16 16 17 17 18 18 19 18 17 23 23 24 21 18 16 14 12 11 8.9 7.61 6.96 5.69 3.62 0.7 -2.3
82
+ 8 7 5 5 5 6 6 7 8 8 9 7 5 6 10 11 11 10 6 4 2 -5 -7.9 -11.25 -14.05 -15.98 -16.59 -16.8 -16.8
83
+ 8 -7 -5 -5 -5 -5 -5 -5 -5 -5 -5 3 -4 -4 1 -3 -6 -10 -13 -15 -16 -16 -14.9 -12.76 -10.74 -9.10 -6.90 -5.2 -3.7
84
+ 8 8 8 8 8 8 8 8 8 7 7 2 -1 9 8 4 3 1 -1 -4 -6 -7 -7.0 -4.87 -3.54 -2.02 -0.34 1.0 2.5
85
+ 8 -8 -18 -18 -18 -18 -19 -19 -19 -19 -19 -11 -17 -13 -20 -17 -16 -17 -15 -11 -10 -4 -2.1 -0.06 1.64 2.26 2.90 3.9 4.9
86
+ 9 0 8 8 8 8 8 8 8 8 8 5 3 4 4 8 8 7 5 5 4 4 5.0 5.58 5.50 5.33 5.03 4.7 4.7
87
+ 9 1 10 10 10 10 10 10 10 10 10 -21 -7 9 6 10 10 10 10 10 9 9 9.4 9.76 9.45 8.83 8.36 8.0 8.0
88
+ 9 -1 -20 -20 -20 -20 -20 -20 -20 -20 -21 -27 -24 -11 -18 -22 -21 -21 -21 -21 -20 -20 -19.7 -20.11 -20.54 -21.77 -23.44 -24.8 -24.8
89
+ 9 2 1 1 1 1 1 1 1 1 1 1 -1 -4 0 2 2 2 1 1 1 3 3.0 3.58 3.45 3.02 2.84 3.0 3.0
90
+ 9 -2 14 14 14 14 14 14 14 15 15 17 19 12 12 15 16 16 16 15 15 15 13.4 12.69 11.51 10.76 11.04 12.1 12.1
91
+ 9 3 -11 -11 -11 -11 -11 -11 -12 -12 -12 -11 -25 -5 -9 -13 -12 -12 -12 -12 -12 -10 -8.4 -6.94 -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 0 0 0 0 0 0 0 0 -0.4 -0.26 -0.18 -0.13 -0.05 0.0 0.0
190
+ 13 -8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.21 0.10 -0.04 -0.11 -0.2 -0.2
191
+ 13 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.35 0.38 0.38 0.37 0.3 0.3
192
+ 13 -9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.6 0.53 0.49 0.48 0.47 0.5 0.5
193
+ 13 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.1 -0.05 0.02 0.08 0.13 0.2 0.2
194
+ 13 -10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.38 0.44 0.48 0.54 0.6 0.6
195
+ 13 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0.41 0.42 0.46 0.45 0.4 0.4
196
+ 13 -11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.2 -0.22 -0.25 -0.30 -0.41 -0.6 -0.6
197
+ 13 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0 -0.10 -0.26 -0.35 -0.46 -0.5 -0.5
198
+ 13 -12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.5 -0.57 -0.53 -0.43 -0.36 -0.3 -0.3
199
+ 13 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 -0.18 -0.26 -0.36 -0.40 -0.4 -0.4
200
+ 13 -13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.9 -0.82 -0.79 -0.71 -0.60 -0.5 -0.5
@@ -0,0 +1 @@
1
+ from .ppigrf import igrf, igrf_gc, get_inclination_declination
@@ -75,10 +75,11 @@ igrf - Calculate IGRF model values (geodetic input/output)
75
75
  import numpy as np
76
76
  import pandas as pd
77
77
  import os
78
- d2r = np.pi/180
79
78
 
80
79
  basepath = os.path.dirname(__file__)
81
- shc_fn = basepath + '/IGRF13.shc' # Default shc file
80
+ shc_fn = basepath + '/IGRF14.shc' # Default shc file
81
+ shc_fn_igrf13 = basepath + '/IGRF13.shc'
82
+ shc_fn_igrf14 = basepath + '/IGRF14.shc'
82
83
 
83
84
  # Geomagnetic reference radius:
84
85
  RE = 6371.2 # km
@@ -135,8 +136,8 @@ def yearfrac_to_datetime(fracyear):
135
136
  """
136
137
 
137
138
  year = np.uint16(fracyear) # truncate fracyear to get year
138
- # use pandas TimedeltaIndex to represent time since beginning of year:
139
- delta_year = pd.TimedeltaIndex((fracyear - year)*(365 + is_leapyear(year)), unit = 'D')
139
+ # use pandas to_timedelta to represent time since beginning of year:
140
+ delta_year = pd.to_timedelta((fracyear - year)*(365 + is_leapyear(year)), unit = 'D')
140
141
  # and DatetimeIndex to represent beginning of years:
141
142
  start_year = pd.DatetimeIndex(list(map(str, year)))
142
143
 
@@ -171,11 +172,12 @@ def get_legendre(theta, keys):
171
172
  nmax, mmax = np.max(n), np.max(m)
172
173
 
173
174
  theta = theta.flatten()[:, np.newaxis]
175
+ theta_rad = np.radians(theta)
174
176
 
175
177
  P = {}
176
178
  dP = {}
177
- sinth = np.sin(d2r*theta)
178
- costh = np.cos(d2r*theta)
179
+ sinth = np.sin(theta_rad)
180
+ costh = np.cos(theta_rad)
179
181
 
180
182
  # Initialize Schmidt normalization
181
183
  S = {}
@@ -325,25 +327,30 @@ def geod2geoc(gdlat, height, Bn, Bu):
325
327
  a = WGS84_a
326
328
  b = a*np.sqrt(1 - WGS84_e2)
327
329
 
328
- sin_alpha_2 = np.sin(gdlat*d2r)**2
329
- cos_alpha_2 = np.cos(gdlat*d2r)**2
330
+ # Convert geodetic latitude angles to radians
331
+ gdlat_rad = np.radians(gdlat)
332
+
333
+ sin_alpha_2 = np.sin(gdlat_rad)**2
334
+ cos_alpha_2 = np.cos(gdlat_rad)**2
330
335
 
331
336
  # calculate geocentric latitude and radius
332
337
  tmp = height * np.sqrt(a**2 * cos_alpha_2 + b**2 * sin_alpha_2)
333
- beta = np.arctan((tmp + b**2)/(tmp + a**2) * np.tan(gdlat * d2r))
338
+ beta = np.arctan((tmp + b**2)/(tmp + a**2) * np.tan(gdlat_rad))
334
339
  theta = np.pi/2 - beta
335
340
  r = np.sqrt(height**2 + 2 * tmp + a**2 * (1 - (1 - (b/a)**4) * sin_alpha_2) / (1 - (1 - (b/a)**2) * sin_alpha_2))
336
341
 
337
342
  # calculate geocentric components
338
- psi = np.sin(gdlat*d2r) * np.sin(theta) - np.cos(gdlat*d2r) * np.cos(theta)
343
+ psi = np.sin(gdlat_rad) * np.sin(theta) - np.cos(gdlat_rad) * np.cos(theta)
339
344
 
340
345
  B_r = -np.sin(psi) * Bn + np.cos(psi) * Bu
341
346
  B_th = -np.cos(psi) * Bn - np.sin(psi) * Bu
342
347
 
343
- theta = theta/d2r
348
+ # Convert theta to degrees
349
+ theta = np.degrees(theta)
344
350
 
345
351
  return theta, r, B_th, B_r
346
352
 
353
+
347
354
  def geoc2geod(theta, r, B_th, B_r):
348
355
  """
349
356
  Convert from geodetic to geocentric coordinates
@@ -401,7 +408,7 @@ def geoc2geod(theta, r, B_th, B_r):
401
408
  A84 = 320.*E8 /2048.
402
409
 
403
410
  GCLAT = (90-theta)
404
- SCL = np.sin(GCLAT * d2r)
411
+ SCL = np.sin(np.radians(GCLAT))
405
412
 
406
413
  RI = a/r
407
414
  A2 = RI*(A21 + RI * (A22 + RI* A23))
@@ -418,16 +425,18 @@ def geoc2geod(theta, r, B_th, B_r):
418
425
  S6CL = S2CL * C4CL + C2CL * S4CL
419
426
 
420
427
  DLTCL = S2CL * A2 + S4CL * A4 + S6CL * A6 + S8CL * A8
421
- gdlat = DLTCL + GCLAT * d2r
428
+ gdlat = DLTCL + np.radians(GCLAT)
422
429
  height = r * np.cos(DLTCL)- a * np.sqrt(1 - E2 * np.sin(gdlat) ** 2)
423
430
 
424
431
 
425
432
  # magnetic components
426
- psi = np.sin(gdlat) * np.sin(theta*d2r) - np.cos(gdlat) * np.cos(theta*d2r)
433
+ theta_rad = np.radians(theta)
434
+ psi = np.sin(gdlat) * np.sin(theta_rad) - np.cos(gdlat) * np.cos(theta_rad)
427
435
  Bn = -np.cos(psi) * B_th - np.sin(psi) * B_r
428
436
  Bu = -np.sin(psi) * B_th + np.cos(psi) * B_r
429
437
 
430
- gdlat = gdlat / d2r
438
+ # Convert gdlat to degrees
439
+ gdlat = np.degrees(gdlat)
431
440
 
432
441
  return gdlat, height, Bn, Bu
433
442
 
@@ -444,7 +453,7 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
444
453
  of the broadcasting, so that the output will have shape
445
454
  (N, ...) where N is the number of dates, and ... represents
446
455
  the combined shape of the coordinates. If you pass scalars,
447
- the output will be arrays of shape (1, 1)
456
+ the output will be arrays of shape (1,)
448
457
 
449
458
  Parameters
450
459
  ----------
@@ -482,12 +491,9 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
482
491
  print('Warning: You provided date(s) not covered by coefficient file \n({} to {})'.format(
483
492
  g.index[0].date(), g.index[-1].date()))
484
493
 
485
- # convert input to arrays in case they aren't
486
- r, theta, phi = tuple(map(lambda x: np.array(x, ndmin = 1), [r, theta, phi]))
487
-
488
494
  # get coordinate arrays to same size and shape
489
- shape = np.broadcast_shapes(r.shape, theta.shape, phi.shape)
490
- r, theta, phi = map(lambda x: np.broadcast_to(x, shape) , [r, theta, phi])
495
+ r, theta, phi = np.broadcast_arrays(r, theta, phi)
496
+ shape = r.shape
491
497
  r, theta, phi = map(lambda x: x.flatten().reshape((-1 ,1)), [r, theta, phi]) # column vectors
492
498
 
493
499
  # make row vectors of wave numbers n and m:
@@ -511,8 +517,9 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
511
517
  h = h.interpolate(method = 'time').loc[date, :]
512
518
 
513
519
  # compute cosmlon and sinmlon:
514
- cosmphi = np.cos(phi * d2r * m) # shape (n_coords x n_model_params/2)
515
- sinmphi = np.sin(phi * d2r * m)
520
+ phi_rad = np.radians(phi)
521
+ cosmphi = np.cos(phi_rad * m) # shape (n_coords x n_model_params/2)
522
+ sinmphi = np.sin(phi_rad * m)
516
523
 
517
524
  # make versions of n and m that are repeated twice
518
525
  nn, mm = np.tile(n, 2), np.tile(m, 2)
@@ -528,7 +535,7 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
528
535
 
529
536
  # calculate Bphi:
530
537
  G = -(RE / r) ** (nn + 1) * mm * np.hstack((-P * sinmphi, P * cosmphi)) \
531
- * RE / r / np.sin(theta * d2r)
538
+ * RE / r / np.sin(np.radians(theta))
532
539
  Bphi = G.dot(np.hstack((g.values, h.values)).T).T # shape (n_times, n_coords)
533
540
 
534
541
  # reshape and return
@@ -547,7 +554,7 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
547
554
  of the broadcasting, so that the output will have shape
548
555
  (N, ...) where N is the number of dates, and ... represents
549
556
  the combined shape of the coordinates. If you pass scalars,
550
- the output will be arrays of shape (1, 1)
557
+ the output will be arrays of shape (1,)
551
558
 
552
559
  Parameters
553
560
  ----------
@@ -575,9 +582,8 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
575
582
  """
576
583
 
577
584
  # convert input to arrays and cast to same shape:
578
- lon, lat, h = tuple(map(lambda x: np.array(x, ndmin = 1), [lon, lat, h]))
579
- shape = np.broadcast_shapes(lon.shape, lat.shape, h.shape)
580
- lon, lat, h = map(lambda x: np.broadcast_to(x, shape), [lon, lat, h])
585
+ lon, lat, h = np.broadcast_arrays(lon, lat, h)
586
+ shape = lon.shape
581
587
  lon, lat, h = map(lambda x: x.flatten(), [lon, lat, h])
582
588
 
583
589
  # convert to geocentric:
@@ -596,6 +602,149 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
596
602
  return Be.reshape(outshape), Bn.reshape(outshape), Bu.reshape(outshape)
597
603
 
598
604
 
605
+ def igrf_V(r, theta, phi, date, coeff_fn = shc_fn):
606
+ """
607
+ Calculate IGRF magnetic potential
608
+
609
+ Input and output in geocentric coordinates
610
+
611
+ Broadcasting rules apply for coordinate arrays, and the
612
+ combined shape will be preserved. The dates are kept out
613
+ of the broadcasting, so that the output will have shape
614
+ (N, ...) where N is the number of dates, and ... represents
615
+ the combined shape of the coordinates. If you pass scalars,
616
+ the output will be arrays of shape (1,)
617
+
618
+ Parameters
619
+ ----------
620
+ r : array
621
+ radius [km] of IGRF calculation
622
+ theta : array
623
+ colatitude [deg] of IGRF calculation
624
+ phi : array
625
+ longitude [deg], positive east, of IGRF claculation
626
+ date : date(s)
627
+ one or more dates to evaluate IGRF coefficients
628
+ coeff_fn : string, optional
629
+ filename of .shc file. Default is latest IGRF
630
+
631
+ Return
632
+ ------
633
+ V : array
634
+ Magnetic potential (unit nT * km)
635
+ """
636
+
637
+ # read coefficient file:
638
+ g, h = read_shc(coeff_fn)
639
+
640
+ if not hasattr(date, '__iter__'):
641
+ date = np.array([date])
642
+ else:
643
+ date = np.array(date)
644
+
645
+ if np.any(date > g.index[-1]) or np.any(date < g.index[0]):
646
+ print('Warning: You provided date(s) not covered by coefficient file \n({} to {})'.format(
647
+ g.index[0].date(), g.index[-1].date()))
648
+
649
+ # convert input to arrays in case they aren't
650
+ r, theta, phi = np.broadcast_arrays(r, theta, phi)
651
+ shape = r.shape
652
+ r, theta, phi = map(lambda x: x.flatten().reshape((-1 ,1)), [r, theta, phi]) # column vectors
653
+
654
+ # make row vectors of wave numbers n and m:
655
+ n, m = np.array([k for k in g.columns]).T
656
+ n, m = n.reshape((1, -1)), m.reshape((1, -1))
657
+
658
+ # get maximum N and maximum M:
659
+ N, M = np.max(n), np.max(m)
660
+
661
+ # get the legendre functions
662
+ P, dP = get_legendre(theta, g.keys())
663
+
664
+ # Append coefficients at desired times (skip if index is already in coefficient data frame):
665
+ index = g.index.union(date)
666
+
667
+ g = g.reindex(index).groupby(index).first() # reindex and skip duplicates
668
+ h = h.reindex(index).groupby(index).first() # reindex and skip duplicates
669
+
670
+ # interpolate and collect the coefficients at desired times:
671
+ g = g.interpolate(method = 'time').loc[date, :]
672
+ h = h.interpolate(method = 'time').loc[date, :]
673
+
674
+ # compute cosmlon and sinmlon:
675
+ cosmphi = np.cos(np.deg2rad(phi * m)) # shape (n_coords x n_model_params/2)
676
+ sinmphi = np.sin(np.deg2rad(phi * m))
677
+
678
+ # make versions of n and m that are repeated twice
679
+ nn, mm = np.tile(n, 2), np.tile(m, 2)
680
+
681
+ # calculate Br:
682
+ G = RE * (RE / r) ** (nn + 1) * np.hstack((P * cosmphi, P * sinmphi))
683
+ V = G.dot(np.hstack((g.values, h.values)).T).T # shape (n_times, n_coords)
684
+
685
+ # reshape and return
686
+ outshape = tuple([V.shape[0]] + list(shape))
687
+ return V.reshape(outshape)
688
+
689
+
690
+ def get_inclination_declination(Be, Bn, Bu, degrees=True):
691
+ r"""
692
+ Compute the inclination and declination angles of the IGRF
693
+
694
+ The inclination angle is defined as the angle between the magnetic field
695
+ vector and the horizontal plane:
696
+
697
+ .. math::
698
+
699
+ I = \arctan \frac{-B_u}{\sqrt{B_e^2 + B_n^2}}
700
+
701
+ And the declination angle is defined as the azimuth of the projection of
702
+ the magnetic field vector onto the horizontal plane (starting from the
703
+ northing direction, positive to the east and negative to the west):
704
+
705
+ .. math::
706
+
707
+ D = \arcsin \frac{B_e}{\sqrt{B_e^2 + B_n^2}}
708
+
709
+ Parameters
710
+ ----------
711
+ Be : float or array
712
+ Easting component of the IGRF magnetic vector.
713
+ Bn : float or array
714
+ Northing component of the IGRF magnetic vector.
715
+ Bu : float or array
716
+ Upward component of the IGRF magnetic vector.
717
+ degrees : bool (optional)
718
+ If True, the angles are returned in degrees.
719
+ If False, the angles are returned in radians.
720
+ Default True.
721
+
722
+ Returns
723
+ -------
724
+ inclination : float or array
725
+ Inclination angle of the IGRF magnetic vector. If ``degrees`` is True,
726
+ then the angle is returned in degrees. If ``degrees`` is False, then
727
+ it's returned in radians.
728
+ declination : float or array
729
+ Declination angle of the IGRF magnetic vector. If ``degrees`` is True,
730
+ then the angle is returned in degrees. If ``degrees`` is False, then
731
+ it's returned in radians.
732
+ """
733
+ # Compute the horizontal component of B
734
+ horizontal_component = np.sqrt(Be**2 + Bn**2)
735
+ if horizontal_component == 0:
736
+ inclination = -np.sign(Bu) * np.pi /2
737
+ declination = 0
738
+ else:
739
+ # Compute the two angles
740
+ inclination = np.arctan(-Bu / horizontal_component)
741
+ declination = np.arcsin(Be / horizontal_component)
742
+ # Convert to degrees if needed
743
+ if degrees:
744
+ inclination = np.degrees(inclination)
745
+ declination = np.degrees(declination)
746
+ return inclination, declination
747
+
599
748
 
600
749
  if __name__ == '__main__':
601
750
 
@@ -606,18 +755,17 @@ if __name__ == '__main__':
606
755
  lat = 60.39299 # degrees north
607
756
  h = 0 # kilometers above sea level
608
757
  date = datetime(2021, 3, 28)
609
- Be, Bn, Bu = ppigrf.igrf(lon, lat, h, date) # returns east, north, up
758
+ Be, Bn, Bu = igrf(lon, lat, h, date) # returns east, north, up
610
759
 
611
760
  # GEOCENTRIC
612
761
  r = 6500 # kilometers from center of Earht
613
762
  theta = 30 # colatitude in degrees
614
763
  phi = 4 # degrees east (same as lon)
615
- Br, Btheta, Bphi = ppigrf.igrf_gc(r, theta, phi, date) # returns radial, south, east
764
+ Br, Btheta, Bphi = igrf_gc(r, theta, phi, date) # returns radial, south, east
616
765
 
617
766
  # GRID
618
767
  lon = np.array([20, 120, 220])
619
768
  lat = np.array([[60, 60, 60], [-60, -60, -60]])
620
769
  h = 0
621
770
  dates = [datetime(y, 1, 1) for y in np.arange(1960, 2021, 20)]
622
- Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates)
623
-
771
+ Be, Bn, Bu = igrf(lon, lat, h, dates)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ppigrf
3
- Version: 1.0.2
3
+ Version: 2.0.0
4
4
  Summary: Pure Python IGRF
5
5
  Author: Karl Laundal
6
6
  Author-email: readme@file.md
@@ -11,15 +11,27 @@ Classifier: Programming Language :: Python :: 3
11
11
  Requires-Python: >=3.6
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Requires-Dist: numpy>=0.13.1
15
+ Requires-Dist: pandas>=1.3.5
14
16
 
15
17
  # Pure Python International Geomagnetic Reference Field
16
18
  [![DOI](https://zenodo.org/badge/352365168.svg)](https://zenodo.org/badge/latestdoi/352365168)
17
19
 
18
20
  Pure Python code to calculate IGRF model predictions. The IGRF is a model of the Earth's main magnetic field that is updated every 5 years.
19
- See https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html for details and https://doi.org/10.1186/s40623-020-01163-9 for even more details.
20
21
 
21
- The code is vectorized, so calculations should be pretty fast.
22
+ References:
23
+ - IAGA V-MOD WG and main IGRF website:
24
+ https://www.ncei.noaa.gov/products/international-geomagnetic-reference-field
25
+ - IGRF-13 (2020):
26
+ - International Geomagnetic Reference Field: the 13th generation, Alken, P., Thébault, E., Beggan, C.D. et al. International Geomagnetic Reference Field: the thirteenth generation. Earth Planets Space 73, 49 (2021). doi: [10.1186/s40623-020-01288-x](https://doi.org/10.1186/s40623-020-01288-x)
27
+ - [EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf13)
28
+ - IGRF-14 (2025):
29
+ - International Association of Geomagnetism and Aeronomy. (2024). IGRF-14. Zenodo. https://doi.org/10.5281/zenodo.14012302
30
+ - (article in progress)
31
+ - [In progress: EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf14)
32
+ - Evaluation code: https://github.com/IAGA-VMOD/IGRF14eval
22
33
 
34
+ **Note that this code now defaults to use IGRF-14**
23
35
 
24
36
  ## Install
25
37
  The only dependencies are Numpy and Pandas. Install by either
@@ -69,6 +81,29 @@ Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates)
69
81
  ```
70
82
  The output will have shape `(4, 2, 3)`.
71
83
 
84
+ ## How to test?
85
+
86
+ It is possible to run some tests that corroborates that `ppigrf` works as
87
+ expected. To do so you need to install [`pytest`](https://docs.pytest.org). You
88
+ can do so through `pip`:
89
+
90
+ ```
91
+ pip install pytest
92
+ ```
93
+
94
+ Then you need to clone this repository and install `ppigrf`:
95
+
96
+ ```
97
+ python setup.py install
98
+ ```
99
+
100
+ Finally you can test the installed version of `ppigrf` with:
101
+
102
+ ```
103
+ pytest -v
104
+ ```
105
+
106
+
72
107
  ## Why?
73
108
  There are lots of Python modules that can calculate IGRF values. Most are wrappers of Fortran code, which can be tricky to compile. This version is pure Python. For most applications it is still quite fast. I also prefer the ppigrf interface over the alternatives.
74
109
 
@@ -2,10 +2,13 @@ LICENSE
2
2
  README.md
3
3
  setup.py
4
4
  src/ppigrf/IGRF13.shc
5
+ src/ppigrf/IGRF14.shc
5
6
  src/ppigrf/__init__.py
6
7
  src/ppigrf/ppigrf.py
7
8
  src/ppigrf.egg-info/PKG-INFO
8
9
  src/ppigrf.egg-info/SOURCES.txt
9
10
  src/ppigrf.egg-info/dependency_links.txt
10
11
  src/ppigrf.egg-info/requires.txt
11
- src/ppigrf.egg-info/top_level.txt
12
+ src/ppigrf.egg-info/top_level.txt
13
+ test/test_igrf.py
14
+ test/test_inclination_declination.py
@@ -0,0 +1,104 @@
1
+ """
2
+ Test IGRF field
3
+ """
4
+ import os
5
+ import pytest
6
+ import numpy as np
7
+ import numpy.testing as npt
8
+ import pandas as pd
9
+ from pathlib import Path
10
+ from datetime import datetime
11
+
12
+ from ppigrf import igrf
13
+ from ppigrf.ppigrf import yearfrac_to_datetime, shc_fn, shc_fn_igrf13, shc_fn_igrf14
14
+
15
+ # Define paths to test directory and test data directory
16
+ TEST_DIR = Path(os.path.dirname(__file__))
17
+ TEST_DATA_DIR = TEST_DIR / "data"
18
+
19
+
20
+ def load_precomputed_igrf(directory):
21
+ """
22
+ Loads the precomputed IGRF files from a given directory
23
+
24
+ Parameters
25
+ ----------
26
+ directory : :class:`pathlib.Path`
27
+
28
+ Returns
29
+ -------
30
+ igrf_precomputed : :class:`pandas.Dataframe`
31
+ Dataframe containing the precomputed values of the IGRF on the given
32
+ date.
33
+ """
34
+ # Read the csv files
35
+ first_columns = ["date", "latitude", "longitude", "altitude_km"]
36
+ components = ("b_e", "b_n", "b_z")
37
+ dataframes = []
38
+ for component in components:
39
+ columns = first_columns + [component, component + "_sv"]
40
+ fname = directory / f"{component}.csv"
41
+ df = pd.read_csv(fname, skiprows=13, names=columns)
42
+ dataframes.append(df)
43
+ # Merge the dataframes
44
+ igrf_precomputed = pd.merge(dataframes[0], dataframes[1])
45
+ igrf_precomputed = pd.merge(igrf_precomputed, dataframes[-1])
46
+ # Convert the data in the dataframe into a datetime object
47
+ decimal_date = igrf_precomputed.date.values[0]
48
+ (date,) = yearfrac_to_datetime([decimal_date])
49
+ igrf_precomputed = igrf_precomputed.assign(date=date)
50
+ return igrf_precomputed
51
+
52
+
53
+ class TestIGRFKnownValues:
54
+ """
55
+ Test the IGRF field against precomputed values
56
+ """
57
+
58
+ rtol = 1e-2 # 1% of error
59
+
60
+ @pytest.mark.parametrize(
61
+ "date, subdirectory, igrf_version, atol",
62
+ [
63
+ [datetime(2010, 1, 1), "dgrf-2010-01-01", shc_fn_igrf13, 1],
64
+ [datetime(2010, 1, 1), "dgrf-2010-01-01", shc_fn_igrf14, 1],
65
+ [datetime(2020, 1, 1), "igrf13-2020-01-01", shc_fn_igrf13, 1],
66
+ [datetime(2022, 10, 5), "igrf13-2022-10-05", shc_fn_igrf13, 4],
67
+ ],
68
+ ids=[
69
+ "IGRF-13: dgrf-2010-01-01",
70
+ "IGRF-14: dgrf-2010-01-01",
71
+ "IGRF-13: igrf13-2020-01-01",
72
+ "IGRF-13: igrf13-2022-10-05",
73
+ ],
74
+ )
75
+ def test_igrf(self, date, subdirectory, igrf_version, atol):
76
+ """
77
+ Test IGRF against the precomputed values
78
+
79
+ The test on 2020-01-01 doesn't involve any interpolation on the
80
+ dates. The atol (in nT) has been chosen for each case to account points
81
+ where the component is close to zero. For the second date that involves
82
+ an interpolation in time the atol has been increased to account for
83
+ differences due to different types of dates interpolations.
84
+ """
85
+ # Get precomputed IGRF field
86
+ precomputed_igrf = load_precomputed_igrf(TEST_DATA_DIR/subdirectory)
87
+ # Overwrite the date with the one in the data file
88
+ # date = precomputed_igrf.date.values[0]
89
+ # Compute igrf using ppigrf
90
+ b_e, b_n, b_u = igrf(
91
+ precomputed_igrf.longitude,
92
+ precomputed_igrf.latitude,
93
+ precomputed_igrf.altitude_km,
94
+ date,
95
+ coeff_fn=igrf_version,
96
+ )
97
+ # Ravel the arrays
98
+ b_e, b_n, b_u = tuple(np.ravel(component) for component in (b_e, b_n, b_u))
99
+ # Check if the values are equal to the expected ones
100
+ npt.assert_allclose(b_e, precomputed_igrf.b_e, rtol=self.rtol, atol=atol)
101
+ npt.assert_allclose(b_n, precomputed_igrf.b_n, rtol=self.rtol, atol=atol)
102
+ npt.assert_allclose(
103
+ b_u, -precomputed_igrf.b_z, rtol=self.rtol, atol=atol
104
+ ) # invert the direction of b_z
@@ -0,0 +1,34 @@
1
+ """
2
+ Test function to compute inclination and declination.
3
+ """
4
+ import pytest
5
+ import numpy as np
6
+ import numpy.testing as npt
7
+
8
+ from ppigrf import get_inclination_declination
9
+
10
+
11
+ @pytest.mark.parametrize("degrees", (True, False))
12
+ @pytest.mark.parametrize(
13
+ "geomagnetic_field, inclination, declination",
14
+ [
15
+ [(0, 0, -1), 90, 0],
16
+ [(0, 0, 1), -90, 0],
17
+ [(1, 1, 0), 0, 45],
18
+ [(-1, 1, 0), 0, -45],
19
+ [(1, 1, -np.sqrt(2)), 45, 45],
20
+ [(1, 1, np.sqrt(2)), -45, 45],
21
+ [(-2_938.0, 16_308.1, -52_741.9), 72.5582, -10.2126],
22
+ ],
23
+ )
24
+ def test_inclination_declination(degrees, geomagnetic_field, inclination, declination):
25
+ """
26
+ Test inclination and declination with known values.
27
+
28
+ The last values were obtained by one of the online calculators.
29
+ """
30
+ if not degrees:
31
+ inclination = np.radians(inclination)
32
+ declination = np.radians(declination)
33
+ inc, dec = get_inclination_declination(*geomagnetic_field, degrees=degrees)
34
+ npt.assert_allclose([inc, dec], [inclination, declination], rtol=5e-5)
@@ -1 +0,0 @@
1
- from .ppigrf import igrf, igrf_gc
File without changes
File without changes
File without changes