Write an SPK type 10 segment to the DAF open and attached to the input handle.
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- handle I The handle of a DAF file open for writing. body I The NAIF ID code for the body of the segment. center I The center of motion for body. frame I The inertial frame for this segment. first I The first epoch for which the segment is valid. last I The last epoch for which the segment is valid. segid I The string to use for segment identifier. consts I The array of geophysical constants for the segment n I The number of element/epoch pairs to be stored elems I The collection of "two-line" element sets. epochs I The epochs associated with the element sets.
handle is the file handle of an SPK file that has been opened for writing by spcopn, dafopn, or dafopw. body is the NAIF ID for the body whose states are to be recorded in an SPK file. center is the NAIF ID for the center of motion associated with body. frame is the reference frame that states are referenced to, for example "J2000". first are the bounds on the ephemeris times, expressed as last seconds past J2000, for which the states can be used to interpolate a state for body. segid is the segment identifier. An SPK segment identifier may contain up to 40 characters. consts are the geophysical constants needed for evaluation of the two line elements sets. The order of these constants must be: consts = J2 gravitational harmonic for earth consts = J3 gravitational harmonic for earth consts = J4 gravitational harmonic for earth consts = Square root of the GM for earth where GM is expressed in earth radii cubed per minutes squared consts = Equatorial radius of the earth in km consts = Low altitude bound for atmospheric model in km consts = High altitude bound for atmospheric model in km consts = Distance units/earth radius (normally 1) n is the number of "two-line" element sets and epochs to be stored in the segment. elems contains a time-ordered array of two-line elements as supplied in NORAD two-line element files. The i'th set of elements (where i ranges from 1 to n) should be stored as shown here: base = (i-1)*10 elems ( base + 0 ) = NDT20 elems ( base + 1 ) = NDD60 elems ( base + 2 ) = BSTAR elems ( base + 3 ) = INCL elems ( base + 4 ) = NODE0 elems ( base + 5 ) = ECC elems ( base + 6 ) = OMEGA elems ( base + 7 ) = MO elems ( base + 8 ) = NO elems ( base + 9 ) = EPOCH The meaning of these variables is defined by the format of the two-line element files available from NORAD. epochs contains the epochs (ephemeris seconds past J2000) corresponding to the elements in elems. The I'th epoch must equal the epoch of the I'th element set Epochs must form a strictly increasing sequence.
None. The data input is stored in an SPK segment in the DAF connected to the input handle.
This routine writes a type 10 SPK segment to the DAF open for writing that is attached to handle. A routine, GETELM, that reads two-line element data from files distributed by NORAD is available from NAIF.
Suppose that you have collected the two-line element data and geophysical constants as prescribed above. The following code fragment demonstrates how you could go about creating a type 10 SPK segment. #include "SpiceUsr.h" . . . /. Open a new SPK file using DAF and get a file handle. ./ body = <integer code for the body>; center = <integer code for central body for the trajectory>; frame = "J2000"; segid = <string that gives the bodies name>; fname = "SAMPLE.SPK"; ifname = "SAMPLE SPK FILE FOR PRIVATE USE"; ncomch = 0; void spkopn_c ( fname, ifname, ncomch, &handle ); /. Add the type 10 data. ./ spkw10_c ( handle, body, center, frame, first, last, segid, consts, n, elems, epochs ); /. Close the SPK properly. ./ spkcls_c ( handle );
1) Errors in the structure or content of the inputs must be diagnosed by routines called by this one. 2) File access errors are diagnosed by routines in the call tree of this routine. 3) If either the input frame or segment ID string pointer is null, the error SPICE(NULLPOINTER) is signaled. 4) If either the input frame or segment ID string is empty, the error SPICE(EMPTYSTRING) is signaled.
N.J. Bachman (JPL) W.L. Taber (JPL)
-CSPICE Version 1.0.0, 29-JUN-1999 (NJB) (WLT)
write a type_10 spk segment