[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Users] Passing 2D arrays to orekit functions in python



Hi Piyush,

Not sure about the 2D arrays, I don't think I have tried it. I think it should be done with the JArray interface. I guess you already seen the JCC page http://lucene.apache.org/pylucene/jcc/features.html which has some info about arrays.


Note that a python generator will create a python list of java objects, you somehow need to make a java list of the objects also. For example, for a 1-D List I use

...
state = [eck_prop.propagate(tt) for tt in t]
...

fitter.toTLE(Arrays.asList(state), positionTolerance, positionOnly, withBStar)

But I think the JArray should be usable directly somehow.

Best Regards
/petrus


On 26 dec 2012, at 05:06, <piyush@gps.caltech.edu> wrote:

> ###Code
> 
> PotlProvider = orekit.GravityFieldFactory.getProvider()
> Cnm = PotlProvider.getC()
> Snm = PotlProvider.getS()
> orb_prop.addForceModel(orekit.DSSTCentralBody(w, ae, mu, Cnm, Snm)
> 
> 
> Orekit doesn't seem to like the format of Cnm and Snm which are of type
> JArray_object. Assuming it was looking for a list of lists, I converted the
> JArray_object to a 2D list as 
> 
> Cnm_l = [[orekit.JArray_double.cast_(kkk)[0]] for kk in Cnm]
> Snm_l = [[orekit.JArray_double.cast_(kkk)[0]] for kk in Snm]
> 
> 
> It still doesn't seem to like the inputs. How do I pass 2D arrays to orekit
> functions in python?
> 
> Thanks
> Piyush