public class TSAGeoMag
extends java.lang.Object
This is a class to generate the magnetic declination, magnetic field strength and inclination for any point on the earth. The true bearing = magnetic bearing + declination. This class is adapted from an Applet from the NOAA National Data Center at http://www.ngdc.noaa.gov/seg/segd.shtml. None of the calculations were changed. This class requires an input file named WMM-95.DAT, which must be in the same directory that the application is run from. NOTE: The original version of the applet, calculated the declination as a function of the date. This class assumes a date of 1 January 1999, using the 1995 geomagnetic data. The WMM-95.DAT file will probably be updated by NOAA in Dec 1999. This version assumes the calculation is wanted for an altitude of sea level. Using the correct date, the declination is accurate to about 0.5 degrees. This is the LANL D-3 version of the GeoMagnetic calculator from the NOAA National Data Center at http://www.ngdc.noaa.gov/seg/segd.shtml. Adapted by John St. Ledger, Los Alamos National Laboratory June 25, 1999 Verified by comparison to the source code downloaded from the web. The declination calculated by that source is exactly the same as this class. The applet on the web calculates a declination several minutes different than this class. Suspect this is the difference between the DOD model used in this class and the IGRF model of the magnetic field. Does not return the grid variation near the poles. These lines commented out, and can easily be restored. Version 2 Comments: The world magnetic model is updated every 5 years. The data for 2000 uses the same algorithm to calculate the magnetic field field variables. The only change is in the spherical harmonic coefficients in the input file. The input file has been renamed to WMM.COF. Once again, the date was fixed. This time to January 1, 2001. Also, a deprecated constructor for StreamTokenizer was replaced, and the error messages in the catch clause were changed. Methods to get the field strength and inclination were added.
Constructor and Description |
---|
TSAGeoMag()
Instantiates object by calling InitModel().
|
Modifier and Type | Method and Description |
---|---|
double |
getDeclination(double dlat,
double dlong)
Returns the declination from the 2005 Department of
Defense geomagnetic model and data, in degrees.
|
double |
getDeclination(double dlat,
double dlong,
double year,
double altitude)
Returns the declination from the 2005 Department of
Defense geomagnetic model and data, in degrees.
|
double |
getDip(double dlat,
double dlong)
Returns the magnetic field dip angle from the 2000
Department of Defense geomagnetic model and data,
in degrees.
|
double |
getDip(double dlat,
double dlong,
double year,
double altitude)
Returns the magnetic field dip angle from the 2000
Department of Defense geomagnetic model and data,
in degrees.
|
double |
getEastIntensity(double dlat,
double dlong)
Returns the easterly magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getEastIntensity(double dlat,
double dlong,
double year,
double altitude)
Returns the easterly magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getHorizontalIntensity(double dlat,
double dlong)
Returns the horizontal magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getHorizontalIntensity(double dlat,
double dlong,
double year,
double altitude)
Returns the horizontal magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getIntensity(double dlat,
double dlong)
Returns the magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getIntensity(double dlat,
double dlong,
double year,
double altitude)
Returns the magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getNorthIntensity(double dlat,
double dlong)
Returns the northerly magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getNorthIntensity(double dlat,
double dlong,
double year,
double altitude)
Returns the northerly magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getVerticalIntensity(double dlat,
double dlong)
Returns the vertical magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
double |
getVerticalIntensity(double dlat,
double dlong,
double year,
double altitude)
Returns the vertical magnetic field intensity from the 2005
Department of Defense geomagnetic model and data
in nano Tesla.
|
static void |
main(java.lang.String[] args)
Prints out a table of test values for verification
|
public double getDeclination(double dlat, double dlong)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.public double getDeclination(double dlat, double dlong, double year, double altitude)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.year
- The date as a decimial year.altitude
- The altitude in kilometers.public double getIntensity(double dlat, double dlong)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.public double getIntensity(double dlat, double dlong, double year, double altitude)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.year
- Date of the calculation in decimal years.altitude
- Altitude of the calculation in kilometers.public double getHorizontalIntensity(double dlat, double dlong)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.public double getHorizontalIntensity(double dlat, double dlong, double year, double altitude)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.year
- Date of the calculation in decimal years.altitude
- Altitude of the calculation in kilometers.public double getVerticalIntensity(double dlat, double dlong)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.public double getVerticalIntensity(double dlat, double dlong, double year, double altitude)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.year
- Date of the calculation in decimal years.altitude
- Altitude of the calculation in kilometers.public double getNorthIntensity(double dlat, double dlong)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.public double getNorthIntensity(double dlat, double dlong, double year, double altitude)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.year
- Date of the calculation in decimal years.altitude
- Altitude of the calculation in kilometers.public double getEastIntensity(double dlat, double dlong)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.public double getEastIntensity(double dlat, double dlong, double year, double altitude)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.year
- Date of the calculation in decimal years.altitude
- Altitude of the calculation in kilometers.public double getDip(double dlat, double dlong)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.public double getDip(double dlat, double dlong, double year, double altitude)
dlat
- Latitude in decimal degrees.dlong
- Longitude in decimal degrees.year
- Date of the calculation in decimal years.altitude
- Altitude of the calculation in kilometers.public static void main(java.lang.String[] args)