pygmi.mag.igrf#
IGRF calculations.
This code is based on the GEOMAG software, with information given below. It was translated into Python from the GEOMAG code.
Classes#
IGRF field calculation. |
Functions#
|
Calculate IGRF. |
|
Read spherical harmonic coefficients from the specified model. |
|
Extrapolate a spherical harmonic model. |
|
Temporal Interpolation between two spherical harmonic models. |
|
Calculate field components from spherical harmonic (sh) models. |
|
Compute the geomagnetic d, i, h, and f from x, y, and z. |
Module Contents#
- class pygmi.mag.igrf.IGRF(parent=None)#
Bases:
pygmi.misc.BasicModule
IGRF field calculation.
This produces two datasets. The first is an IGRF dataset for the area of interest, defined by some input magnetic dataset. The second is the IGRF corrected form of that input magnetic dataset.
To do this, the input dataset must be reprojected from its local projection to degrees, where the IGRF correction will take place. This is done within this class.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- setupui()#
Set up UI.
- Return type:
None.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool, optional) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- Return type:
None.
- pygmi.mag.igrf.calc_igrf(data, sdate, *, sen_alt=100, wkt=None, igrfonly=True, piter=iter, showlog=print)#
Calculate IGRF.
- Parameters:
data (pygmi.raster.datatypes.Data) – Input DTM data.
sdate (Date) – Survey date.
sen_alt (float, optional) – Sensor clearance. The default is 100.
wkt (str, optional) – WKT projection. The default is None.
igrfonly (bool, optional) – Output IGRF only. The default is True.
piter (function, optional) – Progress bar iterator. The default is iter.
showlog (function, optional) – Display information. The default is print.
- Returns:
outdata (list) – List of output PyGMI Data (pygmi.raster.datatypes.Data).
fmean (float) – Total intensity mean.
imean (float) – Inclination mean.
dmean (float) – Declination mean.
- pygmi.mag.igrf.getshc(file, iflag, strec, nmax_of_gh, igh, gh)#
Read spherical harmonic coefficients from the specified model.
Reads spherical harmonic coefficients from the specified model into an array (Schmidt quasi-normal internal spherical harmonic coefficients).
FORTRAN: Bill Flanagan, NOAA CORPS, DESDIS, NGDC, 325 Broadway,Boulder CO. 80301C: C. H. Shaffer, Lockheed Missiles and Space Company, Sunnyvale CA- Parameters:
file (file) – reference to a file object
iflag – Flag for SV equal to 1 or not equal to 1 for designated read statements
strec (int) – Starting record number to read from model
nmax_of_gh (int) – Maximum degree and order of model
igh (int) – Index for Schmidt quasi-normal internal spherical harmonic coefficients.
gh (numpy array) – Schmidt quasi-normal internal spherical harmonic coefficients.
- Returns:
gh – Schmidt quasi-normal internal spherical harmonic coefficients.
- Return type:
numpy array
- pygmi.mag.igrf.extrapsh(date, dte1, nmax1, nmax2, igh, gh)#
Extrapolate a spherical harmonic model.
Extrapolates linearly a spherical harmonic model with a rate-of-change model. Updates Schmidt quasi-normal internal spherical harmonic coefficients.
FORTRAN : A. Zunde, USGS, MS 964, box 25046 Federal Center, Denver,CO. 80225C : C. H. Shaffer, Lockheed Missiles and Space Company, Sunnyvale CA- Parameters:
date (float) – date of resulting model (in decimal year)
dte1 (float) – date of base model
nmax1 (int) – maximum degree and order of base model
nmax2 (int) – maximum degree and order of rate-of-change model
igh (int) – Index of gh.
gh (numpy array) – Schmidt quasi-normal internal spherical harmonic coefficients of base model and rate-of-change model
- Returns:
nmax (int) – maximum degree and order of resulting model
gh (numpy array) – Schmidt quasi-normal internal spherical harmonic coefficients of base model and rate-of-change model
- pygmi.mag.igrf.interpsh(date, dte1, nmax1, dte2, nmax2, igh, gh)#
Temporal Interpolation between two spherical harmonic models.
Interpolates linearly, in time, between two spherical harmonic models.
Updates Schmidt quasi-normal internal spherical harmonic coefficients.
FORTRAN : A. Zunde, USGS, MS 964, box 25046 Federal Center, Denver,CO. 80225C : C. H. Shaffer, Lockheed Missiles and Space Company, Sunnyvale CA- Parameters:
date (float) – date of resulting model (in decimal year)
dte1 (float) – date of earlier model
nmax1 (int) – maximum degree and order of earlier model
dte2 (float) – date of later model
nmax2 (int) – maximum degree and order of later model
gh (numpy array) – Schmidt quasi-normal internal spherical harmonic coefficients of earlier model and internal model
- Returns:
nmax (int) – maximum degree and order of resulting model
gh (numpy array) – Schmidt quasi-normal internal spherical harmonic coefficients of earlier model and internal model
- pygmi.mag.igrf.shval3(igdgc, flat, flon, elev, nmax, igh, gh)#
Calculate field components from spherical harmonic (sh) models.
This routine updates self.x, self.y, self.z (Northward, Eastward and vertically downward components respectively NED)
Based on subroutine ‘igrf’ by D. R. Barraclough and S. R. C. Malin, report no. 71/1, institute of geological sciences, U.K.
FORTRAN : Norman W. Peddie, USGS, MS 964, box 25046 Federal Center,Denver, CO. 80225C : C. H. Shaffer, Lockheed Missiles and Space Company, Sunnyvale CA- Parameters:
igdgc (int) – indicates coordinate system used set equal to 1 if geodetic, 2 if geocentric
flat (float) – north latitude, in degrees
flon (float) – east longitude, in degrees
elev (float) – WGS84 altitude above ellipsoid (igdgc=1), or radial distance from earth’s center (igdgc=2)
nmax (int) – maximum degree and order of coefficients
gh (numpy array) – Schmidt quasi-normal internal spherical harmonic coefficients of earlier model and internal model
- Returns:
x (float) – Northward component (NED)
y (float) – Eastward component (NED)
z (float) – Vertically downward component (NED)
- pygmi.mag.igrf.dihf(x, y, z)#
Compute the geomagnetic d, i, h, and f from x, y, and z.
This updates self.d, self.i, self.h and self.f (declination, inclination, horizontal intensity and total intensity).
FORTRAN : A. Zunde, USGS, MS 964, box 25046 Federal Center, Denver,CO. 80225C : C. H. Shaffer, Lockheed Missiles and Space Company, Sunnyvale CA- Parameters:
x (float) – northward component
y (float) – eastward component
z (float) – vertically-downward component
- Returns:
h (float) – Horizontal Intensity
f (float) – Total Intensity
i (float) – Inclination
d (float) – Declination