Hi all!
I have a basic CSV file that contains PV information. For each PV entry, I am converting it to LLA and then calling the WMM model to generate the Magnetic Field Value. As a result, I call the model in a for loop, but that throws an error. I writing this code on Linux Ubuntu using Orekit Python package.
The snippet of my code is below:
elif LLAFlag == False:
for index,sample in tm.iterrows():
t = Time(pd.to_datetime(sample['SatelitePosition_Meas_UnixTime'],unit='s'))
time = t.get_absolutedate()
posx = sample['SatelitePosition_Meas_ro_m_0']
posy = sample['SatelitePosition_Meas_ro_m_1']
posz = sample['SatelitePosition_Meas_ro_m_2']
position = utils.list_to_vector3d([posx,posy,posz])
gp = earth.transform(position,earth.getBodyFrame(),time)
lat_rad = float(gp.getLatitude())
long_rad = float(gp.getLongitude())
alt_m = float(gp.getAltitude())
igrf = model.calculateField(lat_rad,long_rad,alt_m)
igrf = igrf.getFieldVector()
But I get a JavaStack Trace Error saying:
JavaError Traceback (most recent call last)
/tmp/ipykernel_53959/680486638.py in <module>
2 sunpv = []
3 igrfyear = GeoMagneticField.getDecimalYear(1,4,2024)
----> 4 model = GeoMagneticFieldFactory.getWMM(igrfyear)
5 fr_gcrf = frames.get_earth_GCRF()
6 earth = OneAxisEllipsoid(C.EARTH_RADIUS,C.EARTH_FLATTENING,frames.get_earth_GCRF())
JavaError: <super: <class 'JavaError'>, <JavaError object>>
Java stacktrace:
org.orekit.errors.OrekitException: unable to find resource ^WMM\.COF$ in classpath
at org.orekit.models.earth.LazyLoadedGeoMagneticFields.loadModels(LazyLoadedGeoMagneticFields.java:117)
at org.orekit.models.earth.LazyLoadedGeoMagneticFields.getWMM(LazyLoadedGeoMagneticFields.java:85)
at org.orekit.models.earth.GeoMagneticFieldFactory.getWMM(GeoMagneticFieldFactory.java:92)
Any suggestions on how to circumvent the issue? Thanks!