This function begins the sequential writting of a type 14 segment (Chebyshev polynomials of the positions and velocities, with variable timesteps) to the SPK file associated to the ephemeris descriptor eph.
Once this function is called, no other segment can be written to the same file, and only writeph_spk14_add() can be used with eph, until writeph_spk14_end() is called.
The following example creates a new ephemeris file ephemeris.bsp with segment of type 3 for the heliocentric coordinates of Venus.
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 degree = 12;
double jd_start = 2460000;
double jd_end = 2460300;
double coefs[80]; /* size = 13*6+2 = (degree+1) * 6+2 components */
double epoch[1]; /* size = 1 date only */
writeph_spk14_begin(weph, NAIFID_VENUS, NAIFID_SUN, frame, jd_start, 0.0, jd_end, 0.0,
degree+1, segid);
for (int k=0; k<100; k++)
{
/* ... fill the array coefs with the epochs and coefficients of the Chebychev polynomials ...
epoch[k] = ...
coefs[..] =...
*/
/* write one record only */
writeph_spk14_add(weph, 1, coefs, epochs);
}
writeph_spk14_end(weph);
writeph_close(weph);
}