Casting JArray_object

Hey all,

I am working on a IOD project and I want to get the numerical values from the state derivatives. So I have something like the following:

SCState = SpacecraftState(orbit)
rangeMeas = rangeObject[0] (Range Measurement object)
est = rangeMeas.estimate(1, 1, SCState)
drdX = est.getStateDerivatives(0)

I want the numerical values of drdX but these are of JArray<object> type. I tried using the JArray_object.cast_ but that didnt work, same for JArray_double.cast_

Thanks in advance!

Hi Niek!

Is it the content of the array drdX that are arrays and you would like to cast them? It should be castable with JArray_double.cast_(item[0]), see for example orekit_python_artifacts/test/SmallManeuverAnalyticalModelTest.py at 248d4fc784d3fab2d858f9c71dbcf82777d9c3e3 · petrushy/orekit_python_artifacts · GitHub

If that doesn’t work, please post the type of the drdX as well as on individual items. You could try to for through the array and cast them one by one for example.

1 Like

Hey Petrus,

You’re right, I needed to use > JArray_double.cast_(drdX[0])!

Thanks!