Calculate longitude and latitude coordinates based on the number of six tracks

Dear developer
Hello!
I am going to finish the task of converting the six numbers of tracks into longitude and latitude coordinates. The specific idea is to calculate the EME2000 coordinate system through the six numbers of tracks, and then convert the EME2000 coordinate system into the Earth Center Geostationary Coordinate System (ECFF). Then convert ECFF to specific longitude and latitude. But during this process, I encountered an issue where the error ‘Exception in thread “main” org. orekit. errors. OrekitException: no IERS UTC-TAI history data loaded’ was reported after the code was executed. May I ask how to resolve this issue.
Thank you, I wish you a pleasant work and life!

The source code is as follows:
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.frames.TopocentricFrame;
import org.orekit.orbits.KeplerianOrbit;
import org.orekit.orbits.Orbit;
import org.orekit.orbits.PositionAngle;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.PVCoordinates;

public class LatitudeAndLongitude {

public static void main(String[] args) {
    // 轨道根数
    double a = 7000.0 * 1000; // 半长轴 (m)
    double e = 0.1;           // 离心率
    double i = Math.toRadians(30.0); // 轨道倾角 (弧度)
    double argOfPerigee = Math.toRadians(45.0); // 升交点赤经 (弧度)
    double raan = Math.toRadians(60.0);  // 升交点赤纬 (弧度)
    double meanAnomaly = Math.toRadians(15.0); // 真近点角 (弧度)

    // 计算J2000坐标系
    Frame J2000 = FramesFactory.getEME2000();

    // 计算ECFF坐标系
    Frame ecff = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    
    // gravitation coefficient
    final double mu =  3.986004415e+14;
    
    // 计算PV坐标
    final TimeScale utc = TimeScalesFactory.getUTC();
    final AbsoluteDate initialDate = new AbsoluteDate(2023, 10, 05, 8, 54, 01.10, utc);
    final Orbit initialOrbit = new KeplerianOrbit(a, e, i, argOfPerigee, raan, meanAnomaly, PositionAngle.MEAN,
            J2000, initialDate, mu);
    
    PVCoordinates pvCoordinates = initialOrbit.getPVCoordinates(J2000);

    // 转换到ECFF坐标系
    PVCoordinates pvInECFF = J2000.getTransformTo(ecff, initialDate).transformPVCoordinates(pvCoordinates);

    // 获取地球中心的坐标
    double x = pvInECFF.getPosition().getX();
    double y = pvInECFF.getPosition().getY();
    double z = pvInECFF.getPosition().getZ();

    // 计算经纬度
    double longitude = Math.atan2(y, x);
    double latitude = Math.atan2(z, Math.sqrt(x * x + y * y));
    double altitude = Math.sqrt(x * x + y * y + z * z) - Constants.WGS84_EARTH_EQUATORIAL_RADIUS;
    		

    // 将经度和纬度从弧度转换为度
    double longitudeDegrees = Math.toDegrees(longitude);
    double latitudeDegrees = Math.toDegrees(latitude);

    System.out.println("经度 (degrees): " + longitudeDegrees);
    System.out.println("纬度 (degrees): " + latitudeDegrees);
    System.out.println("高度 (meters): " + altitude);
}

}

Exception in thread “main” org.orekit.errors.OrekitException: no IERS UTC-TAI history data loaded
at org.orekit.time.LazyLoadedTimeScales.getUTC(LazyLoadedTimeScales.java:188)
at org.orekit.frames.AbstractEopLoader.getUtc(AbstractEopLoader.java:56)
at org.orekit.frames.BulletinBFilesLoader.fillHistory(BulletinBFilesLoader.java:238)
at org.orekit.frames.LazyLoadedEop.getEOPHistory(LazyLoadedEop.java:311)
at org.orekit.frames.LazyLoadedFrames.getEOPHistory(LazyLoadedFrames.java:182)
at org.orekit.frames.AbstractFrames.getCIRF(AbstractFrames.java:400)
at org.orekit.frames.AbstractFrames.getTIRF(AbstractFrames.java:353)
at org.orekit.frames.AbstractFrames.getITRF(AbstractFrames.java:278)
at org.orekit.frames.FramesFactory.getITRF(FramesFactory.java:415)
at LatitudeAndLongitude.main(LatitudeAndLongitude.java:30)

Blockquote

Hi @YangYang

Welcome to the Orekit forum! :slight_smile:

You have this exception because you didn’t set up the orekit data. Orekit data are used to provide Orekit the minimum set of data to be ran (e.g. EOPs, atmosphere data, Earth geo potential terms, etc.).

You can download the orekit data here.

In your code, you shall add the following line at the beginning of the main method

File orekitData = new File(“/path/to/the/folder/orekit-data”);
DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new DirectoryCrawler(orekitData));

Best regards,
Bryan

Under your guidance, the problem has been resolved. Thank you!