Class FileDataLoader

java.lang.Object
gaiasky.data.orbit.FileDataLoader

public class FileDataLoader extends Object
Loads orbit data from an ASCII text file.

This loader parses files where each line represents a single data point in an orbit. The loader ignores blank lines and lines starting with the comment character #.

Data Format

Each data line must contain at least 4 tokens separated by whitespace:
  1. Time: The time of the observation. This can be in two formats:
    • A timestamp string compatible with Timestamp.valueOf(String), where underscores _ are treated as spaces (e.g., 2023-10-27_12:00:00).
    • A Julian Date as a double-precision floating-point number.
  2. X coordinate: The X position in kilometers.
  3. Y coordinate: The Y position in kilometers.
  4. Z coordinate: The Z position in kilometers.

Coordinates are automatically converted from kilometers to Gaia Sky's internal units using Constants.KM_TO_U.

If multiple consecutive lines have the same timestamp, only the first one is processed, and subsequent ones are ignored to prevent duplicate data points at the same time. Any additional tokens beyond the first four in a line are ignored.

  • Constructor Details

    • FileDataLoader

      public FileDataLoader()
  • Method Details

    • parseTime

      public long parseTime(String token)
      Parse a time string with the format FORMAT in UTC.
      Parameters:
      token - The string.
      Returns:
      The time as the number of seconds to epoch (see Instant).
    • load

      public PointCloudData load(InputStream data) throws Exception
      Loads the data in the input stream into an OrbitData object.
      Throws:
      Exception
    • parsef

      protected float parsef(String str)
    • parsed

      protected double parsed(String str)
    • parsei

      protected int parsei(String str)