This function writes in sequential mode a type 103 segment (Chebyshev polynomials of the position and velocity ) in the time scale TCB to the SPK file associated to the ephemeris descriptor eph.
The polynomials array must be of size record_count*(deg+1)*6 and have the following structure :
X's 1st coef 1st record |
... |
X's (deg + 1)th coef 1st record |
Y's 1st coef 1st record |
... |
Y's (deg + 1)th coef 1st record |
Z's 1st coef 1st record |
... |
Z's (deg + 1)th coef 1st record |
dX's 1st coef 1st record |
... |
dX's (deg + 1)th coef 1st record |
dY's 1st coef 1st record |
... |
dY's (deg + 1)th coef 1st record |
dZ's 1st coef 1st record |
... |
dZ's (deg + 1)th coef 1st record |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
... |
X's 1st coef (record_count)th record |
... |
X's (deg + 1)th coef (record_count)th record |
Y's 1st coef (record_count)th record |
... |
Y's (deg + 1)th coef (record_count)th record |
Z's 1st coef (record_count)th record |
... |
Z's (deg + 1)th coef (record_count)th record |
dX's 1st coef (record_count)th record |
... |
dX's (deg + 1)th coef (record_count)th record |
dY's 1st coef (record_count)th record |
... |
dY's (deg + 1)th coef (record_count)th record |
dZ's 1st coef (record_count)th record |
... |
dZ's (deg + 1)th coef (record_count)th record |
The following example creates a new ephemeris file ephemeris.bsp with segment of type 3 for the heliocentric coordinates of Venus, in the timescale TCB.
t_writephbin *weph;
const char segid[] = "seg_planet";
weph = writeph_spk_create("ephemeris.bsp","planet_2", 0);
if (weph)
{
int len_timespan = 32; /* days */
int frame = 1; /* ICRF */
int record_count = 10;
int degree = 12;
double jd_start = 2460000;
double jd_end = jd_start+record_count*len_timespan;
double coefs[780]; /* size = 10*13*6 = record_count * (degree+1) * 6 components */
for (int k=0; k<record_count; k++)
{
double jd_startk = jd_start+k*len_timespan;
double jd_endk = jd_start+(k+1)*len_timespan;
/* ... fill the array coefs with the coefficients of the Chebychev polynomials ...
coefs[..] =...
*/
}
writeph_spk103_seq_write(weph, NAIFID_VENUS, NAIFID_SUN, frame, jd_start, 0.0, jd_end, 0.0,
len_timespan, coefs, record_count, degree+1, segid);
writeph_close(weph);
}