LoadingSunEphemeris 4.1

De Wiki
Aller à : navigation, rechercher
public class LoadingSunEphemeris {
 
    public static void main(String[] args) throws PatriusException {
 
        // Patrius Dataset initialization
        PatriusDataset.addResourcesFromPatriusDataset() ;
 
        //String[] fileNames = { "unxp2000.405", "unxp1950.405", "unxp2700.406" };
        String[] fileNames = { "unxp.*.405" };
 
        // data for Sun coordinates output
        final TimeScale tuc = TimeScalesFactory.getUTC();       
        final AbsoluteDate date = new AbsoluteDate("2010-01-01T12:00:00.000", tuc);
        final Frame icrf = FramesFactory.getICRF();
 
        for (int i = 0; i < fileNames.length; i++) {
 
            final JPLEphemeridesLoader loader = new JPLEphemeridesLoader(fileNames[i], EphemerisType.SUN);
 
            CelestialBodyFactory.clearCelestialBodyLoaders();
            CelestialBodyFactory.addCelestialBodyLoader(CelestialBodyFactory.SUN, loader);
 
            // Using the loading theory
            final CelestialBody sun = loader.loadCelestialBody(CelestialBodyFactory.SUN);
 
            // Coordinates of the Sun at a given date and reference frame
            PVCoordinates pv = sun.getPVCoordinates(date, icrf);
 
            System.out.println("");
            System.out.println(pv.getPosition().getX());
            System.out.println(pv.getPosition().getY());
            System.out.println(pv.getPosition().getZ());
        }
 
    }
 
}