On CssiSpaceWeatherDataLoader parsing SpaceWeather files

Hi everyone!

After recent discussion on reading SpaceWeather files from Agi and Celestrak on this topic, I have decided to look into Orekit source code (especially, CssiSpaceWeatherDataLoader class) to grasp how SpaceWeather files are read by it. I have found the following block of code inside CssiSpaceWeatherDataLoader class

                    if (line.equals("BEGIN MONTHLY_FIT")) {
                        lastDailyPredictedDate = set.last().getDate();
                    }

that seems to be responsible for assigning non-null value to lastDailyPredictedDate field. When I run a program (source code below) that prints lastDailyPredictedDate field value



import org.orekit.data.DataContext;
import org.orekit.data.DataProvidersManager;
import org.orekit.data.DirectoryCrawler;
import org.orekit.models.earth.atmosphere.data.CssiSpaceWeatherDataLoader;
import org.orekit.time.TimeScalesFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.ParseException;

public class Main {

    public static void main(String[] args) throws IOException, ParseException {
        final Path orekitDataPath = Path.of("C:\\path\\to\\orekit-data\\folder");

        final File orekitDataFile = orekitDataPath.toFile();
        final DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
        manager.addProvider(new DirectoryCrawler(orekitDataFile));

        final Path spWeather = orekitDataPath.resolve("CSSI-Space-Weather-Data\\SpaceWeather-All-v1.2.txt");
        final CssiSpaceWeatherDataLoader loader = new CssiSpaceWeatherDataLoader(TimeScalesFactory.getUTC());
        loader.loadData(Files.newInputStream(spWeather), "SpaceWeather-All-v1.2.txt");

        System.out.println(loader.getLastDailyPredictedDate());
    }
}

I got this output:
2096-10-01T00:00:00.000Z

After looking into SpaceWeather-All-v1.2.txt I have found out that it has 4 data section (listed from the top to the bottom): OBSERVED, DAILY_PREDICTED, MONTHLY_PREDICTED, MONTHLY_FIT. The last date of MONTHLY_PREDICTED block is
2096 10 01.

So my question is - is it expected behavior or it is supposed to read last date from DAILY_PREDICTED data section?

I use Orekit 13.1.2, Java 21 and use orekit-data folder from Orekit community repo.

Sorry for bothering :sweat_smile::sweat_smile::sweat_smile:

Have a nice day!

2 Likes

@yzokras do you mind to take a look? : )

The 01.10.2096 date for the end of monthly predictions is consistent with the CSSI space weather file: https://gitlab.orekit.org/orekit/orekit-data/-/raw/b011d6b14442c7b81139234ce5655d53af175d46/CSSI-Space-Weather-Data/SpaceWeather-All-v1.2.txt

1 Like

Thank you for your answer, @yzokras !

I agree that the end of monthly predictions is 01.10.2096. The question I refer to is why does this getter call returns this date:

loader.getLastDailyPredictedDate()

The getter name implies that it is the last daily (not monthly) predicted date. Do we consider the date from last line of MONTHLY_PREDICTED or MONTHLY_FIT data sections to be the lastDailyPredictedDate?

The last date from DAILY_PREDICTED section from Cssi space weather file is 12.05.2025 in the CSSI space weather file: https://gitlab.orekit.org/orekit/orekit-data/-/raw/b011d6b14442c7b81139234ce5655d53af175d46/CSSI-Space-Weather-Data/SpaceWeather-All-v1.2.txt

Indeed this is not the expected behaviour, can you open a gitlab issue?

Thank you very much!!!

I will do it as soon as my gitlab account be approved

Done!

The link

I believe this is a bug that breaks linear interpolation for the MONTHLY_PREDICTED data section in the CssiSpaceWeatherData class. As a result the NRLMSISE00 class may also be affected (if it’s instances take CssiSpaceWeatherData as implementations of NRLMSISE00InputData )

My considerations: Getter getLastDailyPredictedDate() from CssiSpaceWeatherDataLoader class seems to return last monthly predicted date, not daily predicted date as it's name implies (#1855) · Issues · Orekit / Orekit · GitLab

@Serrof would you mind taking a look? :pleading_face: