CssiSpaceWeatherData constructors throw exception when instantiated

Hi,

I’m currently implementing the available orekit atmospheric models in my program.
I’ve noticed that CssiSpaceWeatherData class systematically throws an exception when instantiated with its two constructors :

String supportedNames = “DEFAULT_SUPPORTED_NAMES”;
DataProvidersManager dataProvidersManager = new DataProvidersManager();
TimeScale utc = TimeScalesFactory.getUTC();

CssiSpaceWeatherData cssiSpaceData = new CssiSpaceWeatherData(supportedNames, dataProvidersManager, utc);

and

CssiSpaceWeatherData cssiSpaceData = new CssiSpaceWeatherData(supportedNames);

The thrown exception is : “org.orekit.errors.OrekitIllegalArgumentException: too small number of cached neighbors: 0 (must be at least 2)”

When investigating this, it appears that CssiSpaceWeatherData constructor instantiate the following data variable:

data = new ImmutableTimeStampedCache<>(N_NEIGHBORS, loader.getDataSet());

from which originates the thrown exception.
loader.getDataSet() is the CssiSpaceWeatherDataLoader instance retrieving an empty list.
The data set is a sorted TimeStamped list of ChronologicalComparator instance, but ChronologicalComparator() constructor is empty.

I’ve also checked that the orekit-data is proprely imported in my test scenario and that CssiSpaceWeatherDataLoader manages to access it (via the feed() method)

From what i’ve understood, it seems like that the empty ChronologicalComparator constructors causes the exception throw.

I might be missing something hear. Have you ever encountered this issue before ?
Any help would be highly appreciated.

Hi @Gueorguy,

The error comes from the statement:
String supportedNames = "DEFAULT_SUPPORTED_NAMES";
which makes CssiSpaceWeatherData look for a file named DEFAULT_SUPPORTED_NAMES which does not exist.
You should use:
String supportedNames = CssiSpaceWeatherData.DEFAULT_SUPPORTED_NAMES;
because CssiSpaceWeatherData.DEFAULT_SUPPORTED_NAMES defines the expected name for the data file to be read.

Regards,
Pascal

Hi @Pascal

Thanks for your answer and correction.

The exception still occurs with this new implementation.
Again, the blocking points seems to be coming from the CssiSpaceWeatherDataLoader set variable, of size 0.

You’'ll find my script below:

DataContext.getDefault().getDataProvidersManager().addProvider(new ClasspathCrawler(“orekit-data.zip”));

String supportedNames = CssiSpaceWeatherData.DEFAULT_SUPPORTED_NAMES;
DataProvidersManager dataProvidersManager = new DataProvidersManager();
TimeScale utc = TimeScalesFactory.getUTC();

CssiSpaceWeatherData cssiSpaceData = new CssiSpaceWeatherData(supportedNames, dataProvidersManager, utc);

The thrown exception:
Exception in thread “main” org.orekit.errors.OrekitIllegalArgumentException: too small number of cached neighbors: 0 (must be at least 2)

  •    at org.orekit.utils.ImmutableTimeStampedCache.<init>(ImmutableTimeStampedCache.java:89)*
    
  •    at org.orekit.models.earth.atmosphere.data.CssiSpaceWeatherData.<init>(CssiSpaceWeatherData.java:125)*

Hi @Gueorguy,

This time, the error seems to be due to the DataProvidersManager which you actually declared twice:

  1. in the default data context (first line of your script), to access the data in the orekit-data.zip file in your application classpath,
  2. in the 3rd line of your script, you define an empty DataProvidersManager, which in practice provides nothing, and give it as input to the CssiSpaceWeatherData.

To simply access the default data context, i.e. the data in the orekit-data.zip file located in your classpath, you simply declare :
CssiSpaceWeatherData cssiSpaceData = new CssiSpaceWeatherData(supportedNames);

Regards

Hi @Pascal,

Thanks for your answer, i understand the issue now.

Wish you a good day