Skip to content

Commit

Permalink
Replace the coeffs in IGRF-13. Now results after 2010 may be differen…
Browse files Browse the repository at this point in the history
…t from IGRF-12. The last year that can be calculated extends to 2030.
  • Loading branch information
zzyztyy committed Jan 13, 2020
1 parent 2338638 commit f27c2bb
Show file tree
Hide file tree
Showing 4 changed files with 211 additions and 211 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pyIGRF
## What is pyIGRF?
This is a package of IGRF-12 (International Geomagnetic Reference Field) about python version.
This is a package of IGRF-13 (International Geomagnetic Reference Field) about python version.
We can calculate magnetic field intensity and transform coordinate between GeoGraphical and GeoMagnetic.
It don't need any Fortran compiler. But it needs NumPy package.

Expand Down Expand Up @@ -28,14 +28,14 @@ the response is 7 float number about magnetic filed which is:
- F: total intensity
*unit: degree or nT*

If you want to use IGRF-12 more flexibly, you can use module *calculate*.
If you want to use IGRF-13 more flexibly, you can use module *calculate*.
There is two function which is closer to Fortran. You can change it for different coordination.
>```from pyIGRF import calculate```
Another module *loadCoeffs* can be used to get *g[m][n]* or *h[m][n]* same as that in formula.
>```from pyIGRF.loadCoeffs import getCoeffs```
Another module *load_coeffs* can be used to get *g[m][n]* or *h[m][n]* same as that in formula.
>```from pyIGRF.load_coeffs import get_coeffs```


## Model Introduction and igrf12-coeffs File Download
## Model Introduction and igrf13-coeffs File Download
https://www.ngdc.noaa.gov/IAGA/vmod/igrf.html
14 changes: 7 additions & 7 deletions pyIGRF/loadCoeffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def load_coeffs(filename):
return gh


gh = load_coeffs(os.path.dirname(os.path.abspath(__file__)) + '/src/igrf12coeffs.txt')
gh = load_coeffs(os.path.dirname(os.path.abspath(__file__)) + '/src/igrf13coeffs.txt')


def get_coeffs(date):
Expand All @@ -42,17 +42,17 @@ def get_coeffs(date):
:param date: float
:return: list: g, list: h
"""
if date < 1900.0 or date > 2025.0:
if date < 1900.0 or date > 2030.0:
print('This subroutine will not work with a date of ' + str(date))
print('Date must be in the range 1900.0 <= date <= 2025.0')
print('Date must be in the range 1900.0 <= date <= 2030.0')
print('On return [], []')
return [], []
elif date >= 2015.0:
if date > 2020.0:
elif date >= 2020.0:
if date > 2025.0:
# not adapt for the model but can calculate
print('This version of the IGRF is intended for use up to 2020.0.')
print('This version of the IGRF is intended for use up to 2025.0.')
print('values for ' + str(date) + ' will be computed but may be of reduced accuracy')
t = date - 2015.0
t = date - 2020.0
tc = 1.0
# pointer for last coefficient in pen-ultimate set of MF coefficients...
ll = 3060
Expand Down
Loading

0 comments on commit f27c2bb

Please sign in to comment.