ppigrf 1.0.2__tar.gz → 2.1.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.
- {ppigrf-1.0.2 → ppigrf-2.1.0}/PKG-INFO +72 -7
- ppigrf-1.0.2/src/ppigrf.egg-info/PKG-INFO → ppigrf-2.1.0/README.md +35 -16
- ppigrf-2.1.0/pyproject.toml +47 -0
- ppigrf-2.1.0/src/ppigrf/IGRF14.shc +200 -0
- ppigrf-2.1.0/src/ppigrf/__init__.py +1 -0
- {ppigrf-1.0.2 → ppigrf-2.1.0}/src/ppigrf/ppigrf.py +215 -37
- ppigrf-1.0.2/README.md → ppigrf-2.1.0/src/ppigrf.egg-info/PKG-INFO +81 -2
- {ppigrf-1.0.2 → ppigrf-2.1.0}/src/ppigrf.egg-info/SOURCES.txt +5 -2
- ppigrf-2.1.0/src/ppigrf.egg-info/requires.txt +5 -0
- ppigrf-2.1.0/test/test_igrf.py +104 -0
- ppigrf-2.1.0/test/test_inclination_declination.py +40 -0
- ppigrf-1.0.2/setup.py +0 -40
- ppigrf-1.0.2/src/ppigrf/__init__.py +0 -1
- ppigrf-1.0.2/src/ppigrf.egg-info/requires.txt +0 -2
- {ppigrf-1.0.2 → ppigrf-2.1.0}/LICENSE +0 -0
- {ppigrf-1.0.2 → ppigrf-2.1.0}/setup.cfg +0 -0
- {ppigrf-1.0.2 → ppigrf-2.1.0}/src/ppigrf/IGRF13.shc +0 -0
- {ppigrf-1.0.2 → ppigrf-2.1.0}/src/ppigrf.egg-info/dependency_links.txt +0 -0
- {ppigrf-1.0.2 → ppigrf-2.1.0}/src/ppigrf.egg-info/top_level.txt +0 -0
|
@@ -1,25 +1,67 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ppigrf
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Pure Python IGRF
|
|
5
5
|
Author: Karl Laundal
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Maintainer-email: Ashley Smith <ashley.smith@ed.ac.uk>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2021 Karl M. Laundal
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://github.com/IAGA-VMOD/ppigrf
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Topic :: Scientific/Engineering
|
|
8
32
|
Classifier: Intended Audience :: Science/Research
|
|
9
|
-
Classifier:
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python
|
|
10
36
|
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
38
|
Requires-Python: >=3.6
|
|
12
39
|
Description-Content-Type: text/markdown
|
|
13
40
|
License-File: LICENSE
|
|
41
|
+
Requires-Dist: numpy>=1.15
|
|
42
|
+
Requires-Dist: pandas>=1.0
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: pytest; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
14
46
|
|
|
15
47
|
# Pure Python International Geomagnetic Reference Field
|
|
16
48
|
[](https://zenodo.org/badge/latestdoi/352365168)
|
|
17
49
|
|
|
18
50
|
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
51
|
|
|
21
|
-
|
|
52
|
+
References:
|
|
53
|
+
- IAGA V-MOD WG and main IGRF website:
|
|
54
|
+
https://www.ncei.noaa.gov/products/international-geomagnetic-reference-field
|
|
55
|
+
- IGRF-13 (2020):
|
|
56
|
+
- 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)
|
|
57
|
+
- [EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf13)
|
|
58
|
+
- IGRF-14 (2025):
|
|
59
|
+
- International Association of Geomagnetism and Aeronomy. (2024). IGRF-14. Zenodo. https://doi.org/10.5281/zenodo.14012302
|
|
60
|
+
- (article in progress)
|
|
61
|
+
- [In progress: EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf14)
|
|
62
|
+
- Evaluation code: https://github.com/IAGA-VMOD/IGRF14eval
|
|
22
63
|
|
|
64
|
+
**Note that this code now defaults to use IGRF-14**
|
|
23
65
|
|
|
24
66
|
## Install
|
|
25
67
|
The only dependencies are Numpy and Pandas. Install by either
|
|
@@ -69,6 +111,29 @@ Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates)
|
|
|
69
111
|
```
|
|
70
112
|
The output will have shape `(4, 2, 3)`.
|
|
71
113
|
|
|
114
|
+
## How to test?
|
|
115
|
+
|
|
116
|
+
It is possible to run some tests that corroborates that `ppigrf` works as
|
|
117
|
+
expected. To do so you need to install [`pytest`](https://docs.pytest.org). You
|
|
118
|
+
can do so through `pip`:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
pip install pytest
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Then you need to clone this repository and install `ppigrf`:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
python setup.py install
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Finally you can test the installed version of `ppigrf` with:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
pytest -v
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
|
|
72
137
|
## Why?
|
|
73
138
|
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
139
|
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ppigrf
|
|
3
|
-
Version: 1.0.2
|
|
4
|
-
Summary: Pure Python IGRF
|
|
5
|
-
Author: Karl Laundal
|
|
6
|
-
Author-email: readme@file.md
|
|
7
|
-
Classifier: Development Status :: 4 - Beta
|
|
8
|
-
Classifier: Intended Audience :: Science/Research
|
|
9
|
-
Classifier: Natural Language :: English
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Requires-Python: >=3.6
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
|
|
15
1
|
# Pure Python International Geomagnetic Reference Field
|
|
16
2
|
[](https://zenodo.org/badge/latestdoi/352365168)
|
|
17
3
|
|
|
18
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.
|
|
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
5
|
|
|
21
|
-
|
|
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
|
|
22
17
|
|
|
18
|
+
**Note that this code now defaults to use IGRF-14**
|
|
23
19
|
|
|
24
20
|
## Install
|
|
25
21
|
The only dependencies are Numpy and Pandas. Install by either
|
|
@@ -69,6 +65,29 @@ Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates)
|
|
|
69
65
|
```
|
|
70
66
|
The output will have shape `(4, 2, 3)`.
|
|
71
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
|
+
|
|
72
91
|
## Why?
|
|
73
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.
|
|
74
93
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ppigrf"
|
|
7
|
+
version = "2.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Karl Laundal" }
|
|
10
|
+
]
|
|
11
|
+
maintainers = [
|
|
12
|
+
{ name = "Ashley Smith", email = "ashley.smith@ed.ac.uk" },
|
|
13
|
+
]
|
|
14
|
+
license = { file = "LICENSE" }
|
|
15
|
+
description = "Pure Python IGRF"
|
|
16
|
+
readme = "README.md"
|
|
17
|
+
requires-python = ">=3.6"
|
|
18
|
+
classifiers = [
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Topic :: Scientific/Engineering",
|
|
21
|
+
"Intended Audience :: Science/Research",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"numpy >= 1.15",
|
|
30
|
+
"pandas >= 1.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"pytest"
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/IAGA-VMOD/ppigrf"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools]
|
|
42
|
+
packages = ["ppigrf"]
|
|
43
|
+
package-dir = {"" = "src"}
|
|
44
|
+
include-package-data = true
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
ppigrf = ["*.shc"]
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# IGRF 14
|
|
2
|
+
# International Geomagnetic Reference Field -- 14th generation
|
|
3
|
+
# see https://doi.org/10.5281/zenodo.14012302 for detailed description
|
|
4
|
+
1 13 27 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 -5.27 -3.22 -1.48 -0.2 -0.2
|
|
92
|
+
9 -3 5 5 5 5 5 5 5 5 5 29 12 7 2 7 6 7 9 9 11 12 12.5 12.67 12.75 11.74 9.86 8.3 8.3
|
|
93
|
+
9 4 12 12 12 12 12 12 12 11 11 3 10 2 1 10 10 10 9 9 9 8 6.3 5.01 3.13 0.67 -1.14 -2.5 -2.5
|
|
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
|
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 + '/
|
|
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
|
|
139
|
-
delta_year = pd.
|
|
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(
|
|
178
|
-
costh = np.cos(
|
|
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
|
-
|
|
329
|
-
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
411
|
+
SCL = np.sin(np.radians(GCLAT))
|
|
405
412
|
|
|
406
413
|
RI = a/r
|
|
407
414
|
A2 = RI*(A21 + RI * (A22 + RI* A23))
|
|
@@ -418,22 +425,24 @@ 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
|
|
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
|
-
|
|
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
|
-
|
|
438
|
+
# Convert gdlat to degrees
|
|
439
|
+
gdlat = np.degrees(gdlat)
|
|
431
440
|
|
|
432
441
|
return gdlat, height, Bn, Bu
|
|
433
442
|
|
|
434
443
|
|
|
435
444
|
|
|
436
|
-
def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
|
|
445
|
+
def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn, min_degree=1, max_degree=13):
|
|
437
446
|
"""
|
|
438
447
|
Calculate IGRF model components
|
|
439
448
|
|
|
@@ -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,
|
|
456
|
+
the output will be arrays of shape (1,)
|
|
448
457
|
|
|
449
458
|
Parameters
|
|
450
459
|
----------
|
|
@@ -458,6 +467,10 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
|
|
|
458
467
|
one or more dates to evaluate IGRF coefficients
|
|
459
468
|
coeff_fn : string, optional
|
|
460
469
|
filename of .shc file. Default is latest IGRF
|
|
470
|
+
min_degree : int, optional
|
|
471
|
+
lowest degree of expansion min_degree >= 1
|
|
472
|
+
max_degree : int, optional
|
|
473
|
+
highest degree of expansion, 1 <= max_degree <= 13
|
|
461
474
|
|
|
462
475
|
Return
|
|
463
476
|
------
|
|
@@ -482,12 +495,14 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
|
|
|
482
495
|
print('Warning: You provided date(s) not covered by coefficient file \n({} to {})'.format(
|
|
483
496
|
g.index[0].date(), g.index[-1].date()))
|
|
484
497
|
|
|
485
|
-
|
|
486
|
-
|
|
498
|
+
if min_degree > max_degree:
|
|
499
|
+
print('Warning: Highest degree of expansion must be larger or equal to lowest degree.')
|
|
500
|
+
print('Reset to original range.')
|
|
501
|
+
min_degree, max_degree = 1, 13
|
|
487
502
|
|
|
488
503
|
# get coordinate arrays to same size and shape
|
|
489
|
-
|
|
490
|
-
|
|
504
|
+
r, theta, phi = np.broadcast_arrays(r, theta, phi)
|
|
505
|
+
shape = r.shape
|
|
491
506
|
r, theta, phi = map(lambda x: x.flatten().reshape((-1 ,1)), [r, theta, phi]) # column vectors
|
|
492
507
|
|
|
493
508
|
# make row vectors of wave numbers n and m:
|
|
@@ -511,24 +526,27 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
|
|
|
511
526
|
h = h.interpolate(method = 'time').loc[date, :]
|
|
512
527
|
|
|
513
528
|
# compute cosmlon and sinmlon:
|
|
514
|
-
|
|
515
|
-
|
|
529
|
+
phi_rad = np.radians(phi)
|
|
530
|
+
cosmphi = np.cos(phi_rad * m) # shape (n_coords x n_model_params/2)
|
|
531
|
+
sinmphi = np.sin(phi_rad * m)
|
|
516
532
|
|
|
517
533
|
# make versions of n and m that are repeated twice
|
|
518
534
|
nn, mm = np.tile(n, 2), np.tile(m, 2)
|
|
519
535
|
|
|
536
|
+
N_map = ((nn >= min_degree) & (nn <= max_degree)).astype(int)
|
|
537
|
+
|
|
520
538
|
# calculate Br:
|
|
521
|
-
G = (RE / r) ** (nn + 2) * (nn + 1) * np.hstack((P * cosmphi, P * sinmphi))
|
|
539
|
+
G = N_map * (RE / r) ** (nn + 2) * (nn + 1) * np.hstack((P * cosmphi, P * sinmphi))
|
|
522
540
|
Br = G.dot(np.hstack((g.values, h.values)).T).T # shape (n_times, n_coords)
|
|
523
541
|
|
|
524
542
|
# calculate Btheta:
|
|
525
|
-
G = -(RE / r) ** (nn + 1) * np.hstack((dP * cosmphi, dP * sinmphi)) \
|
|
543
|
+
G = - N_map * (RE / r) ** (nn + 1) * np.hstack((dP * cosmphi, dP * sinmphi)) \
|
|
526
544
|
* RE / r
|
|
527
545
|
Btheta = G.dot(np.hstack((g.values, h.values)).T).T # shape (n_times, n_coords)
|
|
528
546
|
|
|
529
547
|
# calculate Bphi:
|
|
530
|
-
G = -(RE / r) ** (nn + 1) * mm * np.hstack((-P * sinmphi, P * cosmphi)) \
|
|
531
|
-
* RE / r / np.sin(theta
|
|
548
|
+
G = - N_map * (RE / r) ** (nn + 1) * mm * np.hstack((-P * sinmphi, P * cosmphi)) \
|
|
549
|
+
* RE / r / np.sin(np.radians(theta))
|
|
532
550
|
Bphi = G.dot(np.hstack((g.values, h.values)).T).T # shape (n_times, n_coords)
|
|
533
551
|
|
|
534
552
|
# reshape and return
|
|
@@ -536,7 +554,7 @@ def igrf_gc(r, theta, phi, date, coeff_fn = shc_fn):
|
|
|
536
554
|
return Br.reshape(outshape), Btheta.reshape(outshape), Bphi.reshape(outshape)
|
|
537
555
|
|
|
538
556
|
|
|
539
|
-
def igrf(lon, lat, h, date, coeff_fn = shc_fn):
|
|
557
|
+
def igrf(lon, lat, h, date, coeff_fn = shc_fn, min_degree=1, max_degree=13):
|
|
540
558
|
"""
|
|
541
559
|
Calculate IGRF model components
|
|
542
560
|
|
|
@@ -547,7 +565,7 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
|
|
|
547
565
|
of the broadcasting, so that the output will have shape
|
|
548
566
|
(N, ...) where N is the number of dates, and ... represents
|
|
549
567
|
the combined shape of the coordinates. If you pass scalars,
|
|
550
|
-
the output will be arrays of shape (1,
|
|
568
|
+
the output will be arrays of shape (1,)
|
|
551
569
|
|
|
552
570
|
Parameters
|
|
553
571
|
----------
|
|
@@ -561,6 +579,10 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
|
|
|
561
579
|
one or more dates to evaluate IGRF coefficients
|
|
562
580
|
coeff_fn : string, optional
|
|
563
581
|
filename of .shc file. Default is latest IGRF
|
|
582
|
+
min_degree : int, optional
|
|
583
|
+
lowest degree of expansion, min_degree >= 1
|
|
584
|
+
max_degree : int, optional
|
|
585
|
+
highest degree of expansion, 1 <= max_degree <= 13
|
|
564
586
|
|
|
565
587
|
Return
|
|
566
588
|
------
|
|
@@ -574,10 +596,14 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
|
|
|
574
596
|
ellipsoid
|
|
575
597
|
"""
|
|
576
598
|
|
|
599
|
+
if min_degree > max_degree:
|
|
600
|
+
print('Warning: Highest degree of expansion must be larger or equal to lowest degree.')
|
|
601
|
+
print('Reset to original range.')
|
|
602
|
+
min_degree, max_degree = 1, 13
|
|
603
|
+
|
|
577
604
|
# convert input to arrays and cast to same shape:
|
|
578
|
-
lon, lat, h =
|
|
579
|
-
shape =
|
|
580
|
-
lon, lat, h = map(lambda x: np.broadcast_to(x, shape), [lon, lat, h])
|
|
605
|
+
lon, lat, h = np.broadcast_arrays(lon, lat, h)
|
|
606
|
+
shape = lon.shape
|
|
581
607
|
lon, lat, h = map(lambda x: x.flatten(), [lon, lat, h])
|
|
582
608
|
|
|
583
609
|
# convert to geocentric:
|
|
@@ -585,7 +611,7 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
|
|
|
585
611
|
phi = lon
|
|
586
612
|
|
|
587
613
|
# calculate geocentric components of IGRF:
|
|
588
|
-
Br, Btheta, Bphi = igrf_gc(r, theta, phi, date, coeff_fn = coeff_fn)
|
|
614
|
+
Br, Btheta, Bphi = igrf_gc(r, theta, phi, date, coeff_fn = coeff_fn, min_degree=min_degree, max_degree=max_degree)
|
|
589
615
|
Be = Bphi
|
|
590
616
|
|
|
591
617
|
# convert output to geodetic
|
|
@@ -596,6 +622,159 @@ def igrf(lon, lat, h, date, coeff_fn = shc_fn):
|
|
|
596
622
|
return Be.reshape(outshape), Bn.reshape(outshape), Bu.reshape(outshape)
|
|
597
623
|
|
|
598
624
|
|
|
625
|
+
def igrf_V(r, theta, phi, date, coeff_fn = shc_fn, min_degree=1, max_degree=13):
|
|
626
|
+
"""
|
|
627
|
+
Calculate IGRF magnetic potential
|
|
628
|
+
|
|
629
|
+
Input and output in geocentric coordinates
|
|
630
|
+
|
|
631
|
+
Broadcasting rules apply for coordinate arrays, and the
|
|
632
|
+
combined shape will be preserved. The dates are kept out
|
|
633
|
+
of the broadcasting, so that the output will have shape
|
|
634
|
+
(N, ...) where N is the number of dates, and ... represents
|
|
635
|
+
the combined shape of the coordinates. If you pass scalars,
|
|
636
|
+
the output will be arrays of shape (1,)
|
|
637
|
+
|
|
638
|
+
Parameters
|
|
639
|
+
----------
|
|
640
|
+
r : array
|
|
641
|
+
radius [km] of IGRF calculation
|
|
642
|
+
theta : array
|
|
643
|
+
colatitude [deg] of IGRF calculation
|
|
644
|
+
phi : array
|
|
645
|
+
longitude [deg], positive east, of IGRF claculation
|
|
646
|
+
date : date(s)
|
|
647
|
+
one or more dates to evaluate IGRF coefficients
|
|
648
|
+
coeff_fn : string, optional
|
|
649
|
+
filename of .shc file. Default is latest IGRF
|
|
650
|
+
min_degree : int, optional
|
|
651
|
+
lowest degree of expansion, min_degree >= 1
|
|
652
|
+
max_degree : int, optional
|
|
653
|
+
highest degree of expansion, 1 <= max_degree <= 13
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
Return
|
|
657
|
+
------
|
|
658
|
+
V : array
|
|
659
|
+
Magnetic potential (unit nT * km)
|
|
660
|
+
"""
|
|
661
|
+
|
|
662
|
+
if min_degree > max_degree:
|
|
663
|
+
print('Warning: Highest degree of expansion must be larger or equal to lowest degree.')
|
|
664
|
+
print('Reset to original range.')
|
|
665
|
+
min_degree, max_degree = 1, 13
|
|
666
|
+
|
|
667
|
+
# read coefficient file:
|
|
668
|
+
g, h = read_shc(coeff_fn)
|
|
669
|
+
|
|
670
|
+
if not hasattr(date, '__iter__'):
|
|
671
|
+
date = np.array([date])
|
|
672
|
+
else:
|
|
673
|
+
date = np.array(date)
|
|
674
|
+
|
|
675
|
+
if np.any(date > g.index[-1]) or np.any(date < g.index[0]):
|
|
676
|
+
print('Warning: You provided date(s) not covered by coefficient file \n({} to {})'.format(
|
|
677
|
+
g.index[0].date(), g.index[-1].date()))
|
|
678
|
+
|
|
679
|
+
# convert input to arrays in case they aren't
|
|
680
|
+
r, theta, phi = np.broadcast_arrays(r, theta, phi)
|
|
681
|
+
shape = r.shape
|
|
682
|
+
r, theta, phi = map(lambda x: x.flatten().reshape((-1 ,1)), [r, theta, phi]) # column vectors
|
|
683
|
+
|
|
684
|
+
# make row vectors of wave numbers n and m:
|
|
685
|
+
n, m = np.array([k for k in g.columns]).T
|
|
686
|
+
n, m = n.reshape((1, -1)), m.reshape((1, -1))
|
|
687
|
+
|
|
688
|
+
# get maximum N and maximum M:
|
|
689
|
+
N, M = np.max(n), np.max(m)
|
|
690
|
+
|
|
691
|
+
# get the legendre functions
|
|
692
|
+
P, dP = get_legendre(theta, g.keys())
|
|
693
|
+
|
|
694
|
+
# Append coefficients at desired times (skip if index is already in coefficient data frame):
|
|
695
|
+
index = g.index.union(date)
|
|
696
|
+
|
|
697
|
+
g = g.reindex(index).groupby(index).first() # reindex and skip duplicates
|
|
698
|
+
h = h.reindex(index).groupby(index).first() # reindex and skip duplicates
|
|
699
|
+
|
|
700
|
+
# interpolate and collect the coefficients at desired times:
|
|
701
|
+
g = g.interpolate(method = 'time').loc[date, :]
|
|
702
|
+
h = h.interpolate(method = 'time').loc[date, :]
|
|
703
|
+
|
|
704
|
+
# compute cosmlon and sinmlon:
|
|
705
|
+
cosmphi = np.cos(np.deg2rad(phi * m)) # shape (n_coords x n_model_params/2)
|
|
706
|
+
sinmphi = np.sin(np.deg2rad(phi * m))
|
|
707
|
+
|
|
708
|
+
# make versions of n and m that are repeated twice
|
|
709
|
+
nn, mm = np.tile(n, 2), np.tile(m, 2)
|
|
710
|
+
|
|
711
|
+
N_map = ((nn >= min_degree) & (nn <= max_degree)).astype(int)
|
|
712
|
+
|
|
713
|
+
# calculate Br:
|
|
714
|
+
G = N_map * RE * (RE / r) ** (nn + 1) * np.hstack((P * cosmphi, P * sinmphi))
|
|
715
|
+
V = G.dot(np.hstack((g.values, h.values)).T).T # shape (n_times, n_coords)
|
|
716
|
+
|
|
717
|
+
# reshape and return
|
|
718
|
+
outshape = tuple([V.shape[0]] + list(shape))
|
|
719
|
+
return V.reshape(outshape)
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
def get_inclination_declination(Be, Bn, Bu, degrees=True):
|
|
723
|
+
r"""
|
|
724
|
+
Compute the inclination and declination angles of the IGRF
|
|
725
|
+
|
|
726
|
+
The inclination angle is defined as the angle between the magnetic field
|
|
727
|
+
vector and the horizontal plane:
|
|
728
|
+
|
|
729
|
+
.. math::
|
|
730
|
+
|
|
731
|
+
I = \arctan \frac{-B_u}{\sqrt{B_e^2 + B_n^2}}
|
|
732
|
+
|
|
733
|
+
And the declination angle is defined as the azimuth of the projection of
|
|
734
|
+
the magnetic field vector onto the horizontal plane (starting from the
|
|
735
|
+
northing direction, positive to the east and negative to the west):
|
|
736
|
+
|
|
737
|
+
.. math::
|
|
738
|
+
|
|
739
|
+
D = \arcsin \frac{B_e}{\sqrt{B_e^2 + B_n^2}}
|
|
740
|
+
|
|
741
|
+
Parameters
|
|
742
|
+
----------
|
|
743
|
+
Be : float or array
|
|
744
|
+
Easting component of the IGRF magnetic vector.
|
|
745
|
+
Bn : float or array
|
|
746
|
+
Northing component of the IGRF magnetic vector.
|
|
747
|
+
Bu : float or array
|
|
748
|
+
Upward component of the IGRF magnetic vector.
|
|
749
|
+
degrees : bool (optional)
|
|
750
|
+
If True, the angles are returned in degrees.
|
|
751
|
+
If False, the angles are returned in radians.
|
|
752
|
+
Default True.
|
|
753
|
+
|
|
754
|
+
Returns
|
|
755
|
+
-------
|
|
756
|
+
inclination : float or array
|
|
757
|
+
Inclination angle of the IGRF magnetic vector. If ``degrees`` is True,
|
|
758
|
+
then the angle is returned in degrees. If ``degrees`` is False, then
|
|
759
|
+
it's returned in radians.
|
|
760
|
+
declination : float or array
|
|
761
|
+
Declination angle of the IGRF magnetic vector. If ``degrees`` is True,
|
|
762
|
+
then the angle is returned in degrees. If ``degrees`` is False, then
|
|
763
|
+
it's returned in radians.
|
|
764
|
+
"""
|
|
765
|
+
# Compute the horizontal component of B
|
|
766
|
+
H = np.sqrt(Be**2 + Bn**2)
|
|
767
|
+
# Compute the inclination and declination, accounting for special H=0 case
|
|
768
|
+
safe_division = np.divide(-Bu, H, where=H != 0)
|
|
769
|
+
inclination = np.where(H != 0, np.arctan(safe_division), -np.sign(Bu) * np.pi /2)
|
|
770
|
+
safe_division = np.divide(Be, H, where=H != 0)
|
|
771
|
+
declination = np.where(H != 0, np.arcsin(safe_division), 0)
|
|
772
|
+
# Convert to degrees if needed
|
|
773
|
+
if degrees:
|
|
774
|
+
inclination = np.degrees(inclination)
|
|
775
|
+
declination = np.degrees(declination)
|
|
776
|
+
return inclination, declination
|
|
777
|
+
|
|
599
778
|
|
|
600
779
|
if __name__ == '__main__':
|
|
601
780
|
|
|
@@ -606,18 +785,17 @@ if __name__ == '__main__':
|
|
|
606
785
|
lat = 60.39299 # degrees north
|
|
607
786
|
h = 0 # kilometers above sea level
|
|
608
787
|
date = datetime(2021, 3, 28)
|
|
609
|
-
Be, Bn, Bu =
|
|
788
|
+
Be, Bn, Bu = igrf(lon, lat, h, date) # returns east, north, up
|
|
610
789
|
|
|
611
790
|
# GEOCENTRIC
|
|
612
791
|
r = 6500 # kilometers from center of Earht
|
|
613
792
|
theta = 30 # colatitude in degrees
|
|
614
793
|
phi = 4 # degrees east (same as lon)
|
|
615
|
-
Br, Btheta, Bphi =
|
|
794
|
+
Br, Btheta, Bphi = igrf_gc(r, theta, phi, date) # returns radial, south, east
|
|
616
795
|
|
|
617
796
|
# GRID
|
|
618
797
|
lon = np.array([20, 120, 220])
|
|
619
798
|
lat = np.array([[60, 60, 60], [-60, -60, -60]])
|
|
620
799
|
h = 0
|
|
621
800
|
dates = [datetime(y, 1, 1) for y in np.arange(1960, 2021, 20)]
|
|
622
|
-
Be, Bn, Bu =
|
|
623
|
-
|
|
801
|
+
Be, Bn, Bu = igrf(lon, lat, h, dates)
|
|
@@ -1,11 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ppigrf
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: Pure Python IGRF
|
|
5
|
+
Author: Karl Laundal
|
|
6
|
+
Maintainer-email: Ashley Smith <ashley.smith@ed.ac.uk>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2021 Karl M. Laundal
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://github.com/IAGA-VMOD/ppigrf
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Topic :: Scientific/Engineering
|
|
32
|
+
Classifier: Intended Audience :: Science/Research
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Development Status :: 4 - Beta
|
|
38
|
+
Requires-Python: >=3.6
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Requires-Dist: numpy>=1.15
|
|
42
|
+
Requires-Dist: pandas>=1.0
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: pytest; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
1
47
|
# Pure Python International Geomagnetic Reference Field
|
|
2
48
|
[](https://zenodo.org/badge/latestdoi/352365168)
|
|
3
49
|
|
|
4
50
|
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
51
|
|
|
7
|
-
|
|
52
|
+
References:
|
|
53
|
+
- IAGA V-MOD WG and main IGRF website:
|
|
54
|
+
https://www.ncei.noaa.gov/products/international-geomagnetic-reference-field
|
|
55
|
+
- IGRF-13 (2020):
|
|
56
|
+
- 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)
|
|
57
|
+
- [EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf13)
|
|
58
|
+
- IGRF-14 (2025):
|
|
59
|
+
- International Association of Geomagnetism and Aeronomy. (2024). IGRF-14. Zenodo. https://doi.org/10.5281/zenodo.14012302
|
|
60
|
+
- (article in progress)
|
|
61
|
+
- [In progress: EPS Special issue detailing contributing models](https://www.springeropen.com/collections/igrf14)
|
|
62
|
+
- Evaluation code: https://github.com/IAGA-VMOD/IGRF14eval
|
|
8
63
|
|
|
64
|
+
**Note that this code now defaults to use IGRF-14**
|
|
9
65
|
|
|
10
66
|
## Install
|
|
11
67
|
The only dependencies are Numpy and Pandas. Install by either
|
|
@@ -55,6 +111,29 @@ Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates)
|
|
|
55
111
|
```
|
|
56
112
|
The output will have shape `(4, 2, 3)`.
|
|
57
113
|
|
|
114
|
+
## How to test?
|
|
115
|
+
|
|
116
|
+
It is possible to run some tests that corroborates that `ppigrf` works as
|
|
117
|
+
expected. To do so you need to install [`pytest`](https://docs.pytest.org). You
|
|
118
|
+
can do so through `pip`:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
pip install pytest
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Then you need to clone this repository and install `ppigrf`:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
python setup.py install
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Finally you can test the installed version of `ppigrf` with:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
pytest -v
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
|
|
58
137
|
## Why?
|
|
59
138
|
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
139
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
|
-
|
|
3
|
+
pyproject.toml
|
|
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,40 @@
|
|
|
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
|
+
[(np.array([0, 0, 1, -1, 1, 1, -2_938.0]),
|
|
23
|
+
np.array([0, 0, 1, 1, 1, 1, 16_308.1]),
|
|
24
|
+
np.array([-1, 1, 0, 0, -np.sqrt(2), np.sqrt(2), -52_741.9])),
|
|
25
|
+
np.array([90, -90, 0, 0, 45, -45, 72.5582]),
|
|
26
|
+
np.array([0, 0, 45, -45, 45, 45, -10.2126]),
|
|
27
|
+
],
|
|
28
|
+
],
|
|
29
|
+
)
|
|
30
|
+
def test_inclination_declination(degrees, geomagnetic_field, inclination, declination):
|
|
31
|
+
"""
|
|
32
|
+
Test inclination and declination with known values.
|
|
33
|
+
|
|
34
|
+
The last values were obtained by one of the online calculators.
|
|
35
|
+
"""
|
|
36
|
+
if not degrees:
|
|
37
|
+
inclination = np.radians(inclination)
|
|
38
|
+
declination = np.radians(declination)
|
|
39
|
+
inc, dec = get_inclination_declination(*geomagnetic_field, degrees=degrees)
|
|
40
|
+
npt.assert_allclose([inc, dec], [inclination, declination], rtol=5e-5)
|
ppigrf-1.0.2/setup.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import setuptools
|
|
2
|
-
|
|
3
|
-
# Howto
|
|
4
|
-
#
|
|
5
|
-
#This is how to upload a project to pipy. This is mainly a note to self, as this is the first project I have uplo#aded to pypi:
|
|
6
|
-
#
|
|
7
|
-
#python3 -m venv /tmp/venv
|
|
8
|
-
#source /tmp/venv/bin/activate
|
|
9
|
-
#pip install build
|
|
10
|
-
#pip install twine
|
|
11
|
-
#python3 -m build
|
|
12
|
-
#python3 -m twine upload dist/ppigrf-1.0.0.tar.gz
|
|
13
|
-
|
|
14
|
-
#Genrate long description using readme file
|
|
15
|
-
with open("README.md", "r", encoding="utf-8") as fh:
|
|
16
|
-
long_description = fh.read()
|
|
17
|
-
|
|
18
|
-
setuptools.setup(
|
|
19
|
-
name="ppigrf",
|
|
20
|
-
version="1.0.2",
|
|
21
|
-
author="Karl Laundal",
|
|
22
|
-
author_email="readme@file.md",
|
|
23
|
-
description="Pure Python IGRF",
|
|
24
|
-
long_description=long_description,
|
|
25
|
-
long_description_content_type="text/markdown",
|
|
26
|
-
classifiers=[
|
|
27
|
-
"Development Status :: 4 - Beta",
|
|
28
|
-
"Intended Audience :: Science/Research",
|
|
29
|
-
"Natural Language :: English",
|
|
30
|
-
"Programming Language :: Python :: 3",
|
|
31
|
-
],
|
|
32
|
-
install_requires=[
|
|
33
|
-
'numpy>=0.13.1',
|
|
34
|
-
'pandas>=1.3.5'
|
|
35
|
-
],
|
|
36
|
-
package_dir={"": "src"},
|
|
37
|
-
package_data={'':['IGRF13.shc']},
|
|
38
|
-
packages=setuptools.find_packages(where="src"),
|
|
39
|
-
python_requires=">=3.6",
|
|
40
|
-
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .ppigrf import igrf, igrf_gc
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|