- java.lang.Object
-
- spice.basic.DAF
-
- spice.basic.SPK
-
public class SPK extends DAF
Class SPK provides methods for writing, summarizing, and conducting low-level read operations on SPK files.To make SPK data available to programs for state or position computations, use the method
KernelDatabase.load(java.lang.String)
.State or position vectors are normally computed via methods of the classes
StateVector
,StateRecord
,PositionVector
, orPositionRecord
.Version 1.0.0 04-JAN-2010 (NJB)
-
-
Constructor Summary
Constructors Modifier Constructor Description private
SPK(java.lang.String fileName)
Construct an SPK instance representing a file.
-
Method Summary
Modifier and Type Method Description int[]
getBodies()
Obtain a set of ID codes of objects for which an SPK file contains data.int[]
getBodies(int[] initialSet)
Obtain a set of ID codes of objects for which an SPK file contains data, merged with an existing set of ID codes.SpiceWindow
getCoverage(int body)
Obtain a SpiceWindow representing the time coverage provided by this SPK for a given object.SpiceWindow
getCoverage(int body, SpiceWindow cover)
Return a SpiceWindow representing the union of a given SPICE coverage window with the time coverage provided by this SPK for a given object.static SPK
openForRead(java.lang.String fileName)
Open an existing SPK file for read access.private void
openNew(java.lang.String internalFileName, int nCommentChars)
Open a new SPK file.static SPK
openNew(java.lang.String fileName, java.lang.String internalFileName, int nCommentChars)
Create a new SPK file.The file must not exist prior to this method call.void
writeType02Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, TDBDuration intlen, int n, int polydg, double[][][] ChebyCoeffs, Time btime)
Write a type 2 segment to an SPK file.void
writeType03Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, TDBDuration intlen, int n, int polydg, double[][][] ChebyCoeffs, Time btime)
Write a type 3 segment to an SPK file.void
writeType05Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, double gm, int n, StateVector[] states, Time[] epochs)
Write a type 5 segment to an SPK file.void
writeType09Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, int degree, int n, StateVector[] states, Time[] epochs)
Write a type 9 segment to an SPK file.void
writeType13Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, int degree, int n, StateVector[] states, Time[] epochs)
Write a type 13 segment to an SPK file.-
Methods inherited from class spice.basic.DAF
addComments, beginBackwardSearch, beginForwardSearch, close, countSegments, deleteComments, findNextArray, findPreviousArray, getArrayName, getDoubleSummaryComponent, getFileName, getHandle, getIntegerSummaryComponent, getInternalFileName, getND, getNI, isReadable, isWritable, openForWrite, readComments
-
-
-
-
Method Detail
-
openNew
private void openNew(java.lang.String internalFileName, int nCommentChars) throws SpiceException
Open a new SPK file. The file must not exist prior to this method call.- Throws:
SpiceException
-
openNew
public static SPK openNew(java.lang.String fileName, java.lang.String internalFileName, int nCommentChars) throws SpiceException
Create a new SPK file.The file must not exist prior to this method call.- Parameters:
fileName
- StringnCommentChars
- intinternalFileName
- String- Returns:
- SPK
- Throws:
SpiceException
- exception
-
openForRead
public static SPK openForRead(java.lang.String fileName) throws SpiceException
Open an existing SPK file for read access.- Parameters:
fileName
- String- Returns:
- SPK
- Throws:
SpiceException
- exception
-
getBodies
public int[] getBodies() throws SpiceException
Obtain a set of ID codes of objects for which an SPK file contains data.- Returns:
- int[]
- Throws:
SpiceException
- exception
-
getBodies
public int[] getBodies(int[] initialSet) throws SpiceException
Obtain a set of ID codes of objects for which an SPK file contains data, merged with an existing set of ID codes.The result is returned in a new set.
- Parameters:
initialSet
- int[]- Returns:
- int[]
- Throws:
SpiceException
- exception
-
getCoverage
public SpiceWindow getCoverage(int body) throws SpiceException
Obtain a SpiceWindow representing the time coverage provided by this SPK for a given object.The returned window contains times expressed as seconds past J2000 TDB.
- Parameters:
body
- int- Returns:
- SpiceWindow
- Throws:
SpiceException
- exception
-
getCoverage
public SpiceWindow getCoverage(int body, SpiceWindow cover) throws SpiceException
Return a SpiceWindow representing the union of a given SPICE coverage window with the time coverage provided by this SPK for a given object.The returned window contains times expressed as seconds past J2000 TDB.
- Parameters:
body
- intcover
- SpiceWindow- Returns:
- SpiceWindoe
- Throws:
SpiceException
- exception
-
writeType02Segment
public void writeType02Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, TDBDuration intlen, int n, int polydg, double[][][] ChebyCoeffs, Time btime) throws SpiceException
Write a type 2 segment to an SPK file.- Parameters:
body
- Bodybtime
- Timecenter
- BodyChebyCoeffs
- double[][][]frame
- ReferenceFramepolydg
- intfirst
- Timen
- intlast
- Timeintlen
- TDBDurationsegid
- String- Throws:
SpiceException
- exception
-
writeType03Segment
public void writeType03Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, TDBDuration intlen, int n, int polydg, double[][][] ChebyCoeffs, Time btime) throws SpiceException
Write a type 3 segment to an SPK file.- Parameters:
body
- Bodybtime
- Timecenter
- BodyChebyCoeffs
- double[][][]frame
- ReferenceFramepolydg
- intfirst
- Timen
- intlast
- Timeintlen
- TDBDurationsegid
- String- Throws:
SpiceException
- exception
-
writeType05Segment
public void writeType05Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, double gm, int n, StateVector[] states, Time[] epochs) throws SpiceException
Write a type 5 segment to an SPK file.- Parameters:
body
- Bodyepochs
- Time[]center
- Bodystates
- StateVector[]frame
- ReferenceFramen
- intfirst
- Timegm
- doublelast
- Timesegid
- String- Throws:
SpiceException
- exception
-
writeType09Segment
public void writeType09Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, int degree, int n, StateVector[] states, Time[] epochs) throws SpiceException
Write a type 9 segment to an SPK file.- Parameters:
body
- Bodyepochs
- Time[]center
- Bodystates
- StateVector[]frame
- ReferenceFramen
- intfirst
- Timedegree
- intlast
- Timesegid
- String- Throws:
SpiceException
- exception
-
writeType13Segment
public void writeType13Segment(Body body, Body center, ReferenceFrame frame, Time first, Time last, java.lang.String segid, int degree, int n, StateVector[] states, Time[] epochs) throws SpiceException
Write a type 13 segment to an SPK file.- Parameters:
body
- Bodyepochs
- Time[]center
- Bodystates
- StateVector[]frame
- ReferenceFramen
- intfirst
- Timedegree
- intlast
- Timesegid
- String- Throws:
SpiceException
- exception
-
-