org.orekit.bodies
Class JPLEphemeridesLoader

java.lang.Object
  extended by org.orekit.bodies.JPLEphemeridesLoader
All Implemented Interfaces:
CelestialBodyLoader, DataLoader

public class JPLEphemeridesLoader
extends java.lang.Object
implements CelestialBodyLoader

Loader for JPL ephemerides binary files (DE 405, DE 406).

JPL ephemerides binary files contain ephemerides for all solar system planets.

The JPL ephemerides binary files are recognized thanks to their base names, which must match the pattern unx[mp]####.ddd (or unx[mp]####.ddd.gz for gzip-compressed files) where # stands for a digit character and where ddd is an ephemeris type (typically 405 or 406).

Version:
$Revision:1665 $ $Date:2008-06-11 12:12:59 +0200 (mer., 11 juin 2008) $
Author:
Luc Maisonobe

Nested Class Summary
static class JPLEphemeridesLoader.EphemerisType
          List of supported ephemerides types.
 
Constructor Summary
JPLEphemeridesLoader(java.lang.String supportedNames, JPLEphemeridesLoader.EphemerisType generateType, AbsoluteDate centralDate)
          Create a loader for JPL ephemerides binary files.
 
Method Summary
 boolean foundData()
          Check if some data have already been loaded.
static double getAstronomicalUnit()
          Deprecated. as of 4.2, replaced by the non-static method getLoadedAstronomicalUnit()
static double getConstant(java.lang.String name)
          Deprecated. as of 4.2, replaced by the non-static method getLoadedConstant(String)
static double getEarthMoonMassRatio()
          Deprecated. as of 4.2, replaced by the non-static method getLoadedEarthMoonMassRatio()
static double getGravitationalCoefficient(JPLEphemeridesLoader.EphemerisType body)
          Deprecated. as of 4.2, replaced by the non-static method getLoadedGravitationalCoefficient(EphemerisType)
 double getLoadedAstronomicalUnit()
          Get astronomical unit.
 double getLoadedConstant(java.lang.String name)
          Get a constant defined in the ephemerides headers.
 double getLoadedEarthMoonMassRatio()
          Get Earth/Moon mass ratio.
 double getLoadedGravitationalCoefficient(JPLEphemeridesLoader.EphemerisType body)
          Get the gravitational coefficient of a body.
 double getMaxChunksDuration()
          Get the maximal chunks duration.
 java.lang.String getSupportedNames()
          Get the regular expression for supported PV coordinates files names.
 CelestialBody loadCelestialBody(java.lang.String name)
          Load celestial body.
 void loadData(java.io.InputStream input, java.lang.String name)
          Load data from a stream.
 boolean stillAcceptsData()
          Check if the loader still accepts new data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPLEphemeridesLoader

public JPLEphemeridesLoader(java.lang.String supportedNames,
                            JPLEphemeridesLoader.EphemerisType generateType,
                            AbsoluteDate centralDate)
                     throws OrekitException
Create a loader for JPL ephemerides binary files.

If the regular expression for supported names is null or is the empty string, a default value of "^unx[mp](\\d\\d\\d\\d)\\.(?:(?:405)|(?:406))$" supporting both DE405 and DE406 ephemerides is used.

The central date is used to load only a part of an ephemeris. If it is non-null, all data within a +/-50 days range around this date will be loaded. If it is null, an arbitrary 100 days range will be loaded, this is useful to load only data from the header like astronomical unit or gravity coefficients.

Parameters:
supportedNames - regular expression for supported files names (may be null)
generateType - ephemeris type to generate
centralDate - desired central date (may be null)
Throws:
OrekitException - if the header constants cannot be read
Method Detail

loadCelestialBody

public CelestialBody loadCelestialBody(java.lang.String name)
                                throws OrekitException
Load celestial body.

Specified by:
loadCelestialBody in interface CelestialBodyLoader
Parameters:
name - name of the celestial body
Returns:
loaded celestial body
Throws:
OrekitException - if the body cannot be loaded

foundData

public boolean foundData()
Check if some data have already been loaded.

Specified by:
foundData in interface CelestialBodyLoader
Returns:
true if some data have already been loaded

getSupportedNames

public java.lang.String getSupportedNames()
Get the regular expression for supported PV coordinates files names.

Specified by:
getSupportedNames in interface CelestialBodyLoader
Returns:
regular expression for supported PV coordinates files names

getAstronomicalUnit

@Deprecated
public static double getAstronomicalUnit()
                                  throws OrekitException
Deprecated. as of 4.2, replaced by the non-static method getLoadedAstronomicalUnit()

Get astronomical unit.

This method loads its constants from the files using the default JPL names only.

Returns:
astronomical unit in meters
Throws:
OrekitException - if constants cannot be loaded

getLoadedAstronomicalUnit

public double getLoadedAstronomicalUnit()
                                 throws OrekitException
Get astronomical unit.

Returns:
astronomical unit in meters
Throws:
OrekitException - if constants cannot be loaded

getEarthMoonMassRatio

@Deprecated
public static double getEarthMoonMassRatio()
                                    throws OrekitException
Deprecated. as of 4.2, replaced by the non-static method getLoadedEarthMoonMassRatio()

Get Earth/Moon mass ratio.

This method loads its constants from the files using the default JPL names only.

Returns:
Earth/Moon mass ratio
Throws:
OrekitException - if constants cannot be loaded

getLoadedEarthMoonMassRatio

public double getLoadedEarthMoonMassRatio()
                                   throws OrekitException
Get Earth/Moon mass ratio.

Returns:
Earth/Moon mass ratio
Throws:
OrekitException - if constants cannot be loaded

getGravitationalCoefficient

@Deprecated
public static double getGravitationalCoefficient(JPLEphemeridesLoader.EphemerisType body)
                                          throws OrekitException
Deprecated. as of 4.2, replaced by the non-static method getLoadedGravitationalCoefficient(EphemerisType)

Get the gravitational coefficient of a body.

This method loads its constants from the files using the default JPL names only.

Parameters:
body - body for which the gravitational coefficient is requested
Returns:
gravitational coefficient in m3/s2
Throws:
OrekitException - if constants cannot be loaded

getLoadedGravitationalCoefficient

public double getLoadedGravitationalCoefficient(JPLEphemeridesLoader.EphemerisType body)
                                         throws OrekitException
Get the gravitational coefficient of a body.

Parameters:
body - body for which the gravitational coefficient is requested
Returns:
gravitational coefficient in m3/s2
Throws:
OrekitException - if constants cannot be loaded

getConstant

@Deprecated
public static double getConstant(java.lang.String name)
                          throws OrekitException
Deprecated. as of 4.2, replaced by the non-static method getLoadedConstant(String)

Get a constant defined in the ephemerides headers.

This method loads its constants from the files using the default JPL names only.

Note that since constants are defined in the JPL headers files, they are available as soon as one file is available, even if it doesn't match the desired central date. This is because the header must be parsed before the dates can be checked.

Parameters:
name - name of the constant
Returns:
value of the constant of NaN if the constant is not defined
Throws:
OrekitException - if constants cannot be loaded

getLoadedConstant

public double getLoadedConstant(java.lang.String name)
                         throws OrekitException
Get a constant defined in the ephemerides headers.

Note that since constants are defined in the JPL headers files, they are available as soon as one file is available, even if it doesn't match the desired central date. This is because the header must be parsed before the dates can be checked.

Parameters:
name - name of the constant
Returns:
value of the constant of NaN if the constant is not defined
Throws:
OrekitException - if constants cannot be loaded

getMaxChunksDuration

public double getMaxChunksDuration()
Get the maximal chunks duration.

Returns:
chunks maximal duration in seconds

stillAcceptsData

public boolean stillAcceptsData()
Check if the loader still accepts new data.

This method is used to speed up data loading by interrupting crawling the data sets as soon as a loader has found the data it was waiting for. For loaders that can merge data from any number of sources (for example JPL ephemerides or Earth Orientation Parameters that are split among several files), this method should always return true to make sure no data is left over.

Specified by:
stillAcceptsData in interface DataLoader
Returns:
true while the loader still accepts new data

loadData

public void loadData(java.io.InputStream input,
                     java.lang.String name)
              throws OrekitException,
                     java.io.IOException
Load data from a stream.

Specified by:
loadData in interface DataLoader
Parameters:
input - data input stream
name - name of the file (or zip entry)
Throws:
OrekitException - if some data is missing or if some loader specific error occurs
java.io.IOException - if data can't be read


Copyright © 2002-2010 CS Communication & Systèmes. All Rights Reserved.