Package org.orekit.models.earth
Class GeoMagneticField
- java.lang.Object
-
- org.orekit.models.earth.GeoMagneticField
-
public class GeoMagneticField extends Object
Used to calculate the geomagnetic field at a given geodetic point on earth. The calculation is estimated using spherical harmonic expansion of the geomagnetic potential with coefficients provided by an actual geomagnetic field model (e.g. IGRF, WMM).Based on original software written by Manoj Nair from the National Geophysical Data Center, NOAA, as part of the WMM 2010 software release (WMM_SubLibrary.c)
- Author:
- Thomas Neidhart
- See Also:
- World Magnetic Model Overview, WMM Software Downloads
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GeoMagneticField(String modelName, double epoch, int maxN, int maxNSec, double validityStart, double validityEnd)
Create a new geomagnetic field model with the given parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GeoMagneticElements
calculateField(double latitude, double longitude, double height)
Calculate the magnetic field at the specified geodetic point identified by latitude, longitude and altitude.static double
getDecimalYear(int day, int month, int year)
Utility function to get a decimal year for a given day.double
getEpoch()
Returns the epoch for this magnetic field model.String
getModelName()
Returns the model name.protected void
setMainFieldCoefficients(int n, int m, double gnm, double hnm)
Set the given main field coefficients.protected void
setSecularVariationCoefficients(int n, int m, double dgnm, double dhnm)
Set the given secular variation coefficients.boolean
supportsTimeTransform()
Indicates whether this model supports time transformation or not.GeoMagneticField
transformModel(double year)
Time transform the model coefficients from the base year of the model using secular variation coefficients.GeoMagneticField
transformModel(GeoMagneticField otherModel, double year)
Time transform the model coefficients from the base year of the model using a linear interpolation with a second model.double
validFrom()
Returns the start of the validity period for this model.double
validTo()
Returns the end of the validity period for this model.
-
-
-
Constructor Detail
-
GeoMagneticField
protected GeoMagneticField(String modelName, double epoch, int maxN, int maxNSec, double validityStart, double validityEnd)
Create a new geomagnetic field model with the given parameters. Internal structures are initialized according to the specified degrees of the main and secular variations.- Parameters:
modelName
- the model nameepoch
- the epoch of the modelmaxN
- the maximum degree of the main modelmaxNSec
- the maximum degree of the secular variationsvalidityStart
- validity start of this modelvalidityEnd
- validity end of this model
-
-
Method Detail
-
getEpoch
public double getEpoch()
Returns the epoch for this magnetic field model.- Returns:
- the epoch
-
getModelName
public String getModelName()
Returns the model name.- Returns:
- the model name
-
validFrom
public double validFrom()
Returns the start of the validity period for this model.- Returns:
- the validity start as decimal year
-
validTo
public double validTo()
Returns the end of the validity period for this model.- Returns:
- the validity end as decimal year
-
supportsTimeTransform
public boolean supportsTimeTransform()
Indicates whether this model supports time transformation or not.- Returns:
true
if this model can be transformed within its validity period,false
otherwise
-
setMainFieldCoefficients
protected void setMainFieldCoefficients(int n, int m, double gnm, double hnm)
Set the given main field coefficients.- Parameters:
n
- the n indexm
- the m indexgnm
- the g coefficient at position n,mhnm
- the h coefficient at position n,m
-
setSecularVariationCoefficients
protected void setSecularVariationCoefficients(int n, int m, double dgnm, double dhnm)
Set the given secular variation coefficients.- Parameters:
n
- the n indexm
- the m indexdgnm
- the dg coefficient at position n,mdhnm
- the dh coefficient at position n,m
-
calculateField
public GeoMagneticElements calculateField(double latitude, double longitude, double height)
Calculate the magnetic field at the specified geodetic point identified by latitude, longitude and altitude.- Parameters:
latitude
- the WGS84 latitude in radianslongitude
- the WGS84 longitude in radiansheight
- the height above the WGS84 ellipsoid in meters- Returns:
- the
GeoMagneticElements
at the given geodetic point
-
transformModel
public GeoMagneticField transformModel(double year)
Time transform the model coefficients from the base year of the model using secular variation coefficients.- Parameters:
year
- the year to which the model shall be transformed- Returns:
- a time-transformed magnetic field model
-
transformModel
public GeoMagneticField transformModel(GeoMagneticField otherModel, double year)
Time transform the model coefficients from the base year of the model using a linear interpolation with a second model. The second model is required to have an adjacent validity period.- Parameters:
otherModel
- the other magnetic field modelyear
- the year to which the model shall be transformed- Returns:
- a time-transformed magnetic field model
-
getDecimalYear
public static double getDecimalYear(int day, int month, int year)
Utility function to get a decimal year for a given day.- Parameters:
day
- the day (1-31)month
- the month (1-12)year
- the year- Returns:
- the decimal year represented by the given day
-
-