CssiSpaceWeatherData class Issue in python

Hello, I’m having some issues about the CssiSpaceWeatherData class in my python code for orbit propagation.

I get the following error: Traceback (most recent call last):
File “/home/aria/Orekit/Orekit/OREKIT_PROP.py”, line 70, in
cswl = CssiSpaceWeatherData(“SpaceWeather-All-v1.2.txt”)
orekit.JavaError: <super: <class ‘JavaError’>, >
Java stacktrace:
org.orekit.errors.OrekitIllegalArgumentException: too small number of cached neighbors: 0 (must be at least 2)
at org.orekit.utils.ImmutableTimeStampedCache.(ImmutableTimeStampedCache.java:96)
at org.orekit.models.earth.atmosphere.data.AbstractSolarActivityData$SolarActivityGenerator.(AbstractSolarActivityData.java:305)
at org.orekit.models.earth.atmosphere.data.AbstractSolarActivityData.(AbstractSolarActivityData.java:98)
at org.orekit.models.earth.atmosphere.data.CssiSpaceWeatherData.(CssiSpaceWeatherData.java:141)
at org.orekit.models.earth.atmosphere.data.CssiSpaceWeatherData.(CssiSpaceWeatherData.java:120)
at org.orekit.models.earth.atmosphere.data.CssiSpaceWeatherData.(CssiSpaceWeatherData.java:100)
at org.orekit.models.earth.atmosphere.data.CssiSpaceWeatherData.(CssiSpaceWeatherData.java:80)

I provide here the code:

Numerical Orbit Propagator using Orekit Python Library

import orekit
vm = orekit.initVM()
from orekit.pyhelpers import setup_orekit_curdir, absolutedate_to_datetime
setup_orekit_curdir(“/home/aria/Orekit/Orekit/orekit-data.zip”)
import numpy as np
import time
import os
from org.orekit.data import DataProvidersManager, ZipJarCrawler
from org.orekit.frames import FramesFactory, ITRFVersion
from org.orekit.time import AbsoluteDate, TimeScalesFactory
from org.orekit.orbits import OrbitType, CartesianOrbit, KeplerianOrbit
from org.orekit.utils import Constants, IERSConventions, PVCoordinates
from org.orekit.bodies import CelestialBodyFactory, OneAxisEllipsoid
from org.orekit.propagation import SpacecraftState
from org.orekit.propagation.numerical import NumericalPropagator
from org.hipparchus.ode.nonstiff import DormandPrince853Integrator, AdamsBashforthIntegrator
from org.orekit.propagation.conversion import AdamsBashforthIntegratorBuilder
from org.orekit.forces.gravity import HolmesFeatherstoneAttractionModel, ThirdBodyAttraction
from org.orekit.forces.drag import IsotropicDrag, DragForce
from org.orekit.forces.radiation import SolarRadiationPressure, IsotropicRadiationSingleCoefficient
from org.orekit.forces.gravity.potential import GravityFieldFactory, SHMFormatReader
from org.orekit.models.earth.atmosphere import NRLMSISE00, HarrisPriester
from org.hipparchus.geometry.euclidean.threed import Vector3D, SphericalCoordinates
from org.orekit.models.earth.atmosphere.data import CssiSpaceWeatherData, CssiSpaceWeatherDataLoader, MarshallSolarActivityFutureEstimation, SOLFSMYDataLoader

tdb = TimeScalesFactory.getTDB()
itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, True) # International Terrestrial Reference Frame, earth fixed
eci = FramesFactory.getEME2000() # Inertial Frame (EME2000)
icrf = FramesFactory.getICRF() # Inertial Frame (ICRF)

central_body = CelestialBodyFactory.getEarth()
earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
eci)
sun = CelestialBodyFactory.getSun()
mu = Constants.EIGEN5C_EARTH_MU # Earth’s gravitational parameter

initial_epoch = AbsoluteDate(2024, 2, 14, 0, 0, 0.0, tdb)
final_epoch = AbsoluteDate(2024, 2, 21, 0, 0, 0.0, tdb)

position = Vector3D(4040.434380, -4613.561453, -3749.278727) # m
velocity = Vector3D(11636.785000, -40548.435000, 62449.678000) # m/s

initial_state = CartesianOrbit(PVCoordinates(position, velocity), icrf, initial_epoch, mu)

m_sat = 48.0 # kg
Cd = 2.2
Cr = 1.131
A_sat = 0.05 # m^2

sc_srp = IsotropicRadiationSingleCoefficient(A_sat, Cr)

Data for the atmosphere

cswl = CssiSpaceWeatherData(“SpaceWeather-All-v1.2.txt”)

orbitType = OrbitType.CARTESIAN

minStep = 0.000001
maxStep = 100000.0
nSteps = 4
dP = 1e-09
integrator_builder = AdamsBashforthIntegratorBuilder(nSteps, minStep, maxStep, dP)
integrator = integrator_builder.buildIntegrator(initial_state, orbitType)

propagator = NumericalPropagator(integrator)
propagator.setOrbitType(orbitType)
propagator.setMu(Constants.EIGEN5C_EARTH_MU)

gravityProvider = GravityFieldFactory.getNormalizedProvider(80, 80)
holmesFeatherstone = HolmesFeatherstoneAttractionModel(itrf, gravityProvider)
propagator.addForceModel(holmesFeatherstone)

SRP = SolarRadiationPressure(sun, earth, sc_srp)
propagator.addForceModel(SRP)

propagator.addForceModel(ThirdBodyAttraction(CelestialBodyFactory.getMoon()))
propagator.addForceModel(ThirdBodyAttraction(CelestialBodyFactory.getSun()))

atmosphere = NRLMSISE00(cswl, sun, earth)
isotropic_drag = IsotropicDrag(A_sat, Cd)
drag_force = DragForce(atmosphere, isotropic_drag)
propagator.addForceModel(drag_force)

sc_state = SpacecraftState(initial_state, m_sat)
propagator.setInitialState(sc_state)

I tried checking if the data file had problems, was updated and other stuff, but none of them worked. Can you please help me?

Thank you so much for your time.

This error message probably means the CSSI space weather data file was not found. We should change this error message to make it meaningful though…

Are you sure your Orekit data zip contains the SpaceWeather-All-v1.2.txt file?

Hello, thanks for your answer.
Yes I am sure that the data folder has the file. I also tried extracting the space weather file and giving the code the specific path of the extracted file, but didn’t work and gave the exact same error.