Closed michaelaye closed 13 years ago
An example script that exposes the problem can be found here: https://gist.github.com/1074826 with the required meta-kernel to be loaded by the script here: https://gist.github.com/1074830 and a zip file for the required kernels here (124 MB): http://dl.dropbox.com/u/139035/spice_kernels.zip
In spicemodule.c, a comparison of spkpos (where a 2 element tuple is returned correctly) and subpnt (where a 3-element tuple fails) shows the generation failure:
/* variables for outputs */
SpiceDouble ptarg[3];
SpiceDouble lt;
[....]
/* put together the output buildvalue string */
strcat(buildvalue_string, "(ddd)");
strcat(buildvalue_string, "d");
PyObject *returnVal = Py_BuildValue(buildvalue_string, ptarg[0], ptarg[1], ptarg[2], lt);
/* variables for outputs */
SpiceDouble spoint[3];
SpiceDouble trgepc;
SpiceDouble srfvec[3];
/* put together the output buildvalue string */
strcat(buildvalue_string, "(ddd)");
strcat(buildvalue_string, "d");
strcat(buildvalue_string, "(ddd)");
PyObject *returnVal = Py_BuildValue(buildvalue_string, srfvec[0], srfvec[1], srfvec[2]);
As one can see the last Py_BuildValue is incomplete and misses spoint[3] and trgepc.
closed (see pull request)
subpnt should return
So, following the example on http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/IDL/info/mostused.html#K (the example for calculating sub-observer and sub-solar points in IDL one receives: IDL> print, scraft 2226.3949 -2455.4832 735.82877 (which makes sense in terms of known Mars' radius) IDL> print, trgepc 1.9194127e+08 IDL> print, srfvec -259.37184 286.06031 -86.741119 (which has a vector_norm (vnorm) of around 398 km, so very reasonable for MGS)
but in python, with the same kernels, one receives: In [19]: pnt = subpnt("Near point:ellipsoid",'Mars',et,'IAU_MARS','LT+S','MGS') In [20]: print pnt ((-259.3718430329991, 286.0603065386822, -86.74111942755394), 2.132997621e-314, (6.9532229752806e-310, 6.953222975366e-310, 6.95323682690823e-310))
I am using 64-bit python from Enthought.