Package com.luciad.format.magneticnorth
Class TLcdIGRFMagneticNorthMap
java.lang.Object
com.luciad.format.magneticnorth.TLcdIGRFMagneticNorthMap
- All Implemented Interfaces:
ILcdMagneticNorthMap
,ILcdInputStreamFactoryCapable
This class maps the declination, inclination and total intensity of the magnetic north
vector to a given point and date.
Be sure to use the same TLcdIGRFMagneticNorthMap
for successive calculations since it performs caching.
The model used for the calculations has a limited life span. If you try to perform calculations outside this lifespan, an exception will be thrown.
The user of this class is responsible for setting the data file name of the model to use.
See TLcdIGRFModelDecoder
for more information about the supported data files.
Check out http://www.ngdc.noaa.gov/geomag/geomag.shtml for more info about the used terms.
Check out http://www.ngdc.noaa.gov/IAGA/vmod/igrf.html for more information about the used model.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
protected static final int
-
Constructor Summary
ConstructorDescriptionConstructs a newTLcdIGRFMagneticNorthMap
.TLcdIGRFMagneticNorthMap
(String aDataFileName) Constructs a newTLcdIGRFMagneticNorthMap
ready to use. -
Method Summary
Modifier and TypeMethodDescriptionclone()
static float
Converts aCalendar
to a decimal year format.static Calendar
convertDecimalTimeToCalendar
(float aDecimalTime) Converts a decimal year format to aCalendar
.Return the first date value for which this map can retrieve magnetic north.Return the file name of the data file used to base the calculations on.getDate()
Returns the current date set to this map.Return the last date value for which this map can retrieve magnetic north.Returns the input stream factory to load the data.Returns the name of the model.Returns the abbreviated model name.boolean
isValidDate
(Calendar aDate) Checks whether the given date is a valid date for this map.float
retrieveDeclinationAt
(ILcdPoint aPoint) Given a point (and implicitly a time value via setDate()), this method calculates the declination of the magnetic north vector.float
retrieveInclinationAt
(ILcdPoint aPoint) Given a point (and implicitly a time value via setDate()), this method calculates the inclination of the magnetic north vector.float
retrieveTotalIntensityAt
(ILcdPoint aPoint) Given a point (and implicitly a time value via setDate()), this method calculates the total intensity of the magnetic north vector.void
setDataFileName
(String aDataFileName) Sets the file name of the data file to be used.void
Sets the date to retrieve the magnetic north at.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory to load the data.
-
Field Details
-
DECLINATION
protected static final int DECLINATION- See Also:
-
INCLINATION
protected static final int INCLINATION- See Also:
-
TOTAL_INTENSITY
protected static final int TOTAL_INTENSITY- See Also:
-
-
Constructor Details
-
TLcdIGRFMagneticNorthMap
public TLcdIGRFMagneticNorthMap()Constructs a newTLcdIGRFMagneticNorthMap
. You have to set the data file before it can be fully used. -
TLcdIGRFMagneticNorthMap
Constructs a newTLcdIGRFMagneticNorthMap
ready to use.- Parameters:
aDataFileName
- The file name of the data file containing the data about the igrf model
-
-
Method Details
-
getDataFileName
Return the file name of the data file used to base the calculations on.- Returns:
- The file name of the data file used to base the calculations on
- See Also:
-
setDataFileName
Sets the file name of the data file to be used.- Parameters:
aDataFileName
- The file name relative to the classpath- See Also:
-
getModelName
Description copied from interface:ILcdMagneticNorthMap
Returns the name of the model.- Specified by:
getModelName
in interfaceILcdMagneticNorthMap
- Returns:
- the name of the model
- See Also:
-
getShortModelName
Description copied from interface:ILcdMagneticNorthMap
Returns the abbreviated model name.- Specified by:
getShortModelName
in interfaceILcdMagneticNorthMap
- Returns:
- the abbreviated model name
- See Also:
-
retrieveDeclinationAt
Description copied from interface:ILcdMagneticNorthMap
Given a point (and implicitly a time value via setDate()), this method calculates the declination of the magnetic north vector.- Specified by:
retrieveDeclinationAt
in interfaceILcdMagneticNorthMap
- Parameters:
aPoint
- The point on the globe, the reference is World Geodetic System 1984 (WGS 84)- Returns:
- the declination in degrees at the given point
-
retrieveInclinationAt
Description copied from interface:ILcdMagneticNorthMap
Given a point (and implicitly a time value via setDate()), this method calculates the inclination of the magnetic north vector.- Specified by:
retrieveInclinationAt
in interfaceILcdMagneticNorthMap
- Parameters:
aPoint
- The point on the globe, the reference is World Geodetic System 1984 (WGS 84)- Returns:
- the inclination in degrees at the given point
-
retrieveTotalIntensityAt
Description copied from interface:ILcdMagneticNorthMap
Given a point (and implicitly a time value via setDate()), this method calculates the total intensity of the magnetic north vector.- Specified by:
retrieveTotalIntensityAt
in interfaceILcdMagneticNorthMap
- Parameters:
aPoint
- The point on the globe, the reference is World Geodetic System 1984 (WGS 84)- Returns:
- the total intensity in nanoTesla (nT) at the given point
-
isValidDate
Description copied from interface:ILcdMagneticNorthMap
Checks whether the given date is a valid date for this map.- Specified by:
isValidDate
in interfaceILcdMagneticNorthMap
- Parameters:
aDate
- the date to check the validity for.- Returns:
- true if
getBeginValidDate() <= aDate <= getEndValidDate()
, false otherwise.
-
getBeginValidDate
Description copied from interface:ILcdMagneticNorthMap
Return the first date value for which this map can retrieve magnetic north.- Specified by:
getBeginValidDate
in interfaceILcdMagneticNorthMap
- Returns:
- the first date value for which this map can retrieve magnetic north
-
getEndValidDate
Description copied from interface:ILcdMagneticNorthMap
Return the last date value for which this map can retrieve magnetic north.- Specified by:
getEndValidDate
in interfaceILcdMagneticNorthMap
- Returns:
- the last date value for which this map can retrieve magnetic north
-
setDate
Description copied from interface:ILcdMagneticNorthMap
Sets the date to retrieve the magnetic north at.- Specified by:
setDate
in interfaceILcdMagneticNorthMap
- Parameters:
aDate
- The date, isValidDate(aDate) must be true.- See Also:
-
getDate
Description copied from interface:ILcdMagneticNorthMap
Returns the current date set to this map.- Specified by:
getDate
in interfaceILcdMagneticNorthMap
- Returns:
- The current date set to this map.
- See Also:
-
clone
- Specified by:
clone
in interfaceILcdMagneticNorthMap
- Throws:
CloneNotSupportedException
-
getInputStreamFactory
Returns the input stream factory to load the data.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory to load the data.
- See Also:
-
setInputStreamFactory
Sets the input stream factory to load the data.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- an InputStream factory that creates input streams to load the magnetic north data.- See Also:
-
getValidDateClosestToToday
-
convertCalendarToDecimalTime
Converts aCalendar
to a decimal year format. Only uses year, month and day. Hours and seconds are ignored. -
convertDecimalTimeToCalendar
Converts a decimal year format to aCalendar
. Only uses year. Month, day, hours and seconds are ignored.
-