|
Isis 3.0 Object Programmers' Reference |
Home |
#include <Spice.h>
Inheritance diagram for Isis::Spice:


This class initializes standard NAIF SPICE kernels in order to allow queries of a spacecraft's position and attitude at a given time. It also allows for access to the position of the sun and transformation matrices from J2000 to a body-fixed reference frame for a given target (e.g., Mars). The constructor for this class expects a PVL object with the following minimum information:
Group = Instrument
TargetName = Mars
EndGroup
Group = Kernels
NaifFrameCode = -94030
LeapSecond = naif0007.tls
TargetAttitudeShape = pck00006.tpc
TargetPosition = de405.bsp
InstrumentPointing = (mgs_sc_ab1.bc,
Instrument = moc13.ti
SpacecraftClock = MGS_SCLKSCET.00045.tsc
InstrumentPosition = mgs_ab1.bsp
InstrumentAddendum = mocAddendum.ti
EndGroup
For internal use only.
Definition at line 151 of file Spice.h.
Public Member Functions | |
| Spice (Isis::Pvl &lab) | |
| Constructs a Spice object and loads SPICE kernels using information from the label object. | |
| ~Spice () | |
| Destroys the Spice object. | |
| void | SetEphemerisTime (const double time) |
| Sets the ephemeris time and reads the spacecraft and sun position from the kernels at that instant in time. | |
| void | InstrumentPosition (double p[3]) const |
| Returns the spacecraft position in body-fixed frame km units. | |
| void | SunPosition (double p[3]) const |
| Returns the sun position in either body-fixed or J2000 reference frame and km units. | |
| double | TargetCenterDistance () const |
| Calculates and returns the distance from the spacecraft to the target center. | |
| double | SolarLongitude () |
| Returns the solar longitude. | |
| void | InstrumentVelocity (double v[3]) const |
| Returns the spacecraft velocity in body-fixed frame km/sec units. | |
| double | EphemerisTime () const |
| Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions. | |
| void | Radii (double r[3]) const |
| Returns the radii of the body in km. | |
| void | CreateCache (const double startTime, const double endTime, const int size, double tol) |
| This method creates an internal cache of spacecraft and sun positions over a specified time range. | |
| void | CreateCache (const double time, double tol) |
| See previous CreateCache method. | |
| double | CacheStartTime () const |
| double | CacheEndTime () const |
| void | SubSpacecraftPoint (double &lat, double &lon) |
| Returns the sub-spacecraft latitude/longitude in universal coordinates (0-360 positive east, ocentric). | |
| void | SubSolarPoint (double &lat, double &lon) |
| Returns the sub-solar latitude/longitude in universal coordinates (0-360 positive east, ocentric). | |
| std::string | Target () const |
| Returns the string name of the target. | |
| bool | IsSky () const |
| Return if our target is the sky. | |
| SpicePosition * | SunPosition () const |
| SpicePosition * | InstrumentPosition () const |
| SpiceRotation * | BodyRotation () const |
| SpiceRotation * | InstrumentRotation () const |
| bool | HasKernels (Isis::Pvl &lab) |
| Returns true if the kernel group has kernel files. | |
| SpiceInt | NaifBodyCode () const |
| This returns the NAIF body code of the target indicated in the labels. | |
| SpiceInt | NaifSpkCode () const |
| This returns the NAIF SPK code to use when reading from SPK kernels. | |
| SpiceInt | NaifCkCode () const |
| This returns the NAIF CK code to use when reading from CK kernels. | |
| SpiceInt | NaifIkCode () const |
| This returns the NAIF IK code to use when reading from instrument kernels. | |
| SpiceInt | NaifSclkCode () const |
Static Public Member Functions | |
| static SpiceDouble | GetDouble (const std::string &key, int index=0) |
| This returns a value from the NAIF text pool. | |
| static SpiceInt | GetInteger (const std::string &key, int index=0) |
| This returns a value from the NAIF text pool. | |
| static std::string | GetString (const std::string &key, int index=0) |
| This returns a value from the NAIF text pool. | |
Protected Attributes | |
| SpiceDouble | p_uB [3] |
| This contains the sun position (u) in the bodyfixed reference frame (B). | |
| SpiceDouble | p_BJ [3][3] |
| This contains the transformation matrix from J2000 (J) to Body fixed (B). | |
| SpiceDouble | p_radii [3] |
| The radii of the target in kilometers. | |
Private Member Functions | |
| void | Load (Isis::PvlKeyword &key) |
| Load/furnish NAIF kernel(s). | |
| void | ComputeSolarLongitude (double et) |
Private Attributes | |
| SpiceDouble | p_solarLongitude |
| SpiceDouble | p_et |
| std::vector< std::string > | p_kernels |
| std::string | p_target |
| SpiceDouble | p_startTime |
| SpiceDouble | p_endTime |
| SpiceDouble | p_cacheSize |
| SpiceDouble | p_startTimePadding |
| SpiceDouble | p_endTimePadding |
| SpicePosition * | p_instrumentPosition |
| SpiceRotation * | p_instrumentRotation |
| SpicePosition * | p_sunPosition |
| SpiceRotation * | p_bodyRotation |
| bool | p_keepKernelsLoaded |
| bool | p_allowDownsizing |
| SpiceInt | p_bodyCode |
| SpiceInt | p_spkCode |
| SpiceInt | p_ckCode |
| SpiceInt | p_ikCode |
| SpiceInt | p_sclkCode |
| SpiceInt | p_spkBodyCode |
| bool | p_sky |
| Isis::Spice::Spice | ( | Isis::Pvl & | lab | ) |
Constructs a Spice object and loads SPICE kernels using information from the label object.
The constructor expects an Instrument and Kernels group to be in the labels.
| lab | Label containing Instrument and Kernels groups. |
For internal use only.
Definition at line 54 of file Spice.cpp.
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlContainer::HasKeyword(), Load(), Isis::SpicePosition::LoadCache(), Isis::iException::Message(), NaifBodyCode(), p_allowDownsizing, p_bodyCode, p_bodyRotation, p_cacheSize, p_ckCode, p_endTime, p_endTimePadding, p_et, p_ikCode, p_instrumentPosition, p_instrumentRotation, p_radii, p_sclkCode, p_sky, p_solarLongitude, p_spkBodyCode, p_spkCode, p_startTime, p_startTimePadding, p_sunPosition, p_target, SolarLongitude(), and Isis::PvlObject::Traverse.
| Isis::Spice::~Spice | ( | ) |
Destroys the Spice object.
Definition at line 262 of file Spice.cpp.
References Isis::NaifStatus::CheckErrors(), p_bodyRotation, p_instrumentPosition, p_instrumentRotation, p_kernels, and p_sunPosition.
| void Isis::Spice::CreateCache | ( | const double | time, | |
| double | tol | |||
| ) |
See previous CreateCache method.
This method simply invokes that one with the same start and end time and a cache size of one.
| time | Ephemeris time to cache |
Definition at line 383 of file Spice.cpp.
References CreateCache().
| void Isis::Spice::CreateCache | ( | const double | startTime, | |
| const double | endTime, | |||
| const int | size, | |||
| double | tol | |||
| ) |
This method creates an internal cache of spacecraft and sun positions over a specified time range.
The SPICE kernels are then immediately unloaded. This allows multiple instances of the Spice object to be created as the NAIF toolkit can clash if multiple sets of SPICE kernels are loaded. Note that the cache size is specified as an argument. Therefore, times requested via SetEphemerisTime which are not directly loaded in the cache will be interpolated.
| startTime | Starting ephemeris time to cache | |
| endTime | Ending ephemeris time to cache | |
| size | Size of the cache. |
| Isis::iException::Programmer |
Definition at line 297 of file Spice.cpp.
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), ComputeSolarLongitude(), Isis::SpicePosition::IsCached(), Isis::SpicePosition::LoadCache(), Isis::SpicePosition::Memcache2HermiteCache(), Isis::iException::Message(), p_bodyRotation, p_cacheSize, p_endTime, p_endTimePadding, p_et, p_instrumentPosition, p_instrumentRotation, p_kernels, p_startTime, p_startTimePadding, and p_sunPosition.
Referenced by CreateCache(), Isis::Camera::LoadCache(), Isis::Lro::MiniRF::MiniRF(), and Isis::Cassini::VimsCamera::VimsCamera().
| double Isis::Spice::EphemerisTime | ( | ) | const [inline] |
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
Definition at line 175 of file Spice.h.
References p_et.
Referenced by Isis::RadarSlantRangeMap::ComputeA(), Isis::ControlPoint::ComputeApriori(), Isis::LineScanCameraGroundMap::FindFocalPlane(), Isis::CameraPointInfo::GetPointInfo(), Isis::Camera::LoadCache(), Isis::VariableLineScanCameraDetectorMap::SetDetector(), Isis::RadarPulseMap::SetDetector(), Isis::LineScanCameraDetectorMap::SetDetector(), Isis::RadarSlantRangeMap::SetFocalPlane(), Isis::RadarSlantRangeMap::SetUndistortedFocalPlane(), and Qisis::AdvancedTrackTool::updateRow().
| SpiceDouble Isis::Spice::GetDouble | ( | const std::string & | key, | |
| int | index = 0 | |||
| ) | [static] |
This returns a value from the NAIF text pool.
It is a static convience method
| key | Name of NAIF keyword to obtain from the pool | |
| index | If the keyword is an array, the element to obtain. Defaults to 0 |
| Isis::iException::Io |
Definition at line 581 of file Spice.cpp.
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), Isis::iException::Message(), and value.
Referenced by Isis::Mro::CTXCamera::CTXCamera(), Isis::Mex::HrscCamera::HrscCamera(), Isis::CameraFocalPlaneMap::Init(), Isis::Lro::LroNarrowAngleCamera::LroNarrowAngleCamera(), Isis::Mro::MarciCamera::MarciCamera(), Isis::MarciDistortionMap::MarciDistortionMap(), Isis::Messenger::MdisCamera::MdisCamera(), Isis::TaylorCameraDistortionMap::SetDistortion(), Isis::Lro::LroNarrowAngleDistortionMap::SetDistortion(), Isis::Camera::SetFocalLength(), Isis::Camera::SetPixelPitch(), and Galileo::SsiCamera::SsiCamera().
| SpiceInt Isis::Spice::GetInteger | ( | const std::string & | key, | |
| int | index = 0 | |||
| ) | [static] |
This returns a value from the NAIF text pool.
It is a static convience
| key | Name of NAIF keyword to obtain from the pool | |
| index | If the keyword is an array, the element to obtain. Defaults to 0 |
| Isis::iException::Io |
Definition at line 553 of file Spice.cpp.
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), Isis::iException::Message(), and value.
| string Isis::Spice::GetString | ( | const std::string & | key, | |
| int | index = 0 | |||
| ) | [static] |
This returns a value from the NAIF text pool.
It is a static convience method
| key | Name of NAIF keyword to obtain from the pool | |
| index | If the keyword is an array, the element to obtain. Defaults to 0 |
| Isis::iException::Io |
Definition at line 610 of file Spice.cpp.
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), and Isis::iException::Message().
Referenced by Isis::Messenger::MdisCamera::MdisCamera().
| bool Isis::Spice::HasKernels | ( | Isis::Pvl & | lab | ) |
Returns true if the kernel group has kernel files.
| lab | Label containing Instrument and Kernels groups. |
Definition at line 789 of file Spice.cpp.
References Isis::PvlObject::FindGroup(), Isis::PvlContainer::HasKeyword(), Isis::PvlKeyword::Size(), and Isis::PvlObject::Traverse.
| void Isis::Spice::InstrumentPosition | ( | double | p[3] | ) | const |
Returns the spacecraft position in body-fixed frame km units.
| p[] | Spacecraft position |
Definition at line 420 of file Spice.cpp.
References _FILEINFO_, Isis::SpicePosition::Coordinate(), Isis::iException::Message(), p_bodyRotation, p_et, and p_instrumentPosition.
Referenced by Isis::BundleAdjust::AddPartials(), Isis::RadarGroundMap::ComputeXv(), Isis::LineScanCameraGroundMap::FindFocalPlane(), Isis::CameraPointInfo::GetPointInfo(), Isis::RadarGroundMap::SetFocalPlane(), Isis::RadarGroundMap::SetGround(), Isis::BundleAdjust::Solve(), Isis::BundleAdjust::SpVector(), Isis::BundleAdjust::Update(), and Qisis::AdvancedTrackTool::updateRow().
| void Isis::Spice::InstrumentVelocity | ( | double | v[3] | ) | const |
Returns the spacecraft velocity in body-fixed frame km/sec units.
| p[] | Spacecraft velocity |
Definition at line 438 of file Spice.cpp.
References _FILEINFO_, Isis::iException::Message(), p_bodyRotation, p_et, p_instrumentPosition, and Isis::SpicePosition::Velocity().
| bool Isis::Spice::IsSky | ( | ) | const [inline] |
Return if our target is the sky.
Definition at line 196 of file Spice.h.
References p_sky.
Referenced by Isis::Camera::LoadCache(), Isis::Sensor::Sensor(), Isis::Sensor::SetLookDirection(), and Isis::Sensor::SetUniversalGround().
| void Isis::Spice::Load | ( | Isis::PvlKeyword & | key | ) | [private] |
Load/furnish NAIF kernel(s).
Definition at line 238 of file Spice.cpp.
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), Isis::Filename::Expanded(), Isis::iException::Message(), p_kernels, and Isis::PvlKeyword::Size().
Referenced by Spice().
| SpiceInt Isis::Spice::NaifBodyCode | ( | ) | const |
This returns the NAIF body code of the target indicated in the labels.
| Isis::iException::Io |
Definition at line 497 of file Spice.cpp.
References _FILEINFO_, code, Isis::iException::Message(), and p_target.
Referenced by Spice().
| SpiceInt Isis::Spice::NaifCkCode | ( | ) | const |
| SpiceInt Isis::Spice::NaifIkCode | ( | ) | const |
This returns the NAIF IK code to use when reading from instrument kernels.
Definition at line 533 of file Spice.cpp.
References p_ikCode.
Referenced by Isis::Mro::CTXCamera::CTXCamera(), Clementine::HiresCamera::HiresCamera(), Isis::Mro::HiriseCamera::HiriseCamera(), Isis::Mex::HrscCamera::HrscCamera(), Cassini::IssNACamera::IssNACamera(), Cassini::IssWACamera::IssWACamera(), Isis::Lo::LoHighCamera::LoHighCamera(), Isis::Lo::LoMediumCamera::LoMediumCamera(), Isis::Lro::LroNarrowAngleCamera::LroNarrowAngleCamera(), Isis::Lro::LroWideAngleCamera::LroWideAngleCamera(), Clementine::LwirCamera::LwirCamera(), Isis::Mro::MarciCamera::MarciCamera(), Isis::Messenger::MdisCamera::MdisCamera(), Isis::Lro::MiniRF::MiniRF(), Isis::Mgs::MocNarrowAngleCamera::MocNarrowAngleCamera(), Isis::Mgs::MocWideAngleCamera::MocWideAngleCamera(), Clementine::NirCamera::NirCamera(), Isis::Camera::SetFocalLength(), Isis::Camera::SetPixelPitch(), Galileo::SsiCamera::SsiCamera(), Isis::Odyssey::ThemisIrCamera::ThemisIrCamera(), Isis::Odyssey::ThemisVisCamera::ThemisVisCamera(), Clementine::UvvisCamera::UvvisCamera(), Isis::VikingCamera::VikingCamera(), and Isis::Cassini::VimsCamera::VimsCamera().
| SpiceInt Isis::Spice::NaifSpkCode | ( | ) | const |
This returns the NAIF SPK code to use when reading from SPK kernels.
Definition at line 515 of file Spice.cpp.
References p_spkCode.
Referenced by Isis::Mro::CTXCamera::CTXCamera(), Isis::Messenger::MdisCamera::MdisCamera(), Isis::Mgs::MocNarrowAngleCamera::MocNarrowAngleCamera(), Isis::Mgs::MocWideAngleCamera::MocWideAngleCamera(), and Isis::Cassini::VimsCamera::VimsCamera().
| void Isis::Spice::Radii | ( | double | r[3] | ) | const |
Returns the radii of the body in km.
The radii are obtained from the appropriate SPICE kernel for the body specified by TargetName in the Instrument group of the labels.
| r[] | Radii of the target in kilometers |
Definition at line 484 of file Spice.cpp.
References p_radii.
Referenced by Isis::CameraPointInfo::GetPointInfo(), Isis::RadarGroundMap::GetRadius(), Isis::Camera::GroundRange(), Isis::Lro::MiniRF::MiniRF(), Isis::RadarGroundMap::RadarGroundMap(), Isis::RadarGroundMap::SetFocalPlane(), Isis::Cassini::VimsGroundMap::SetGround(), and Qisis::AdvancedTrackTool::updateRow().
| void Isis::Spice::SetEphemerisTime | ( | const double | et | ) |
Sets the ephemeris time and reads the spacecraft and sun position from the kernels at that instant in time.
| et | Ephemeris time(read NAIF documentation for a detailed description) |
| Isis::iException::Message |
For internal use only.
Reimplemented in Isis::Sensor.
Definition at line 399 of file Spice.cpp.
References ComputeSolarLongitude(), Isis::SpicePosition::Coordinate(), p_bodyRotation, p_et, p_instrumentPosition, p_instrumentRotation, p_sunPosition, p_uB, and Isis::SpicePosition::SetEphemerisTime().
Referenced by Isis::Sensor::SetEphemerisTime().
| double Isis::Spice::SolarLongitude | ( | ) |
Returns the solar longitude.
Definition at line 777 of file Spice.cpp.
References ComputeSolarLongitude(), p_et, and p_solarLongitude.
Referenced by Isis::CameraPointInfo::GetPointInfo(), Spice(), and Qisis::AdvancedTrackTool::updateRow().
| void Isis::Spice::SubSolarPoint | ( | double & | lat, | |
| double & | lon | |||
| ) |
Returns the sub-solar latitude/longitude in universal coordinates (0-360 positive east, ocentric).
| lat | Sub-solar latitude | |
| lon | Sub-solar longitude |
Definition at line 679 of file Spice.cpp.
References _FILEINFO_, a, b, c, Isis::NaifStatus::CheckErrors(), dist, Isis::iException::Message(), p_et, p_radii, p_uB, and Isis::PI().
Referenced by Isis::CameraPointInfo::GetPointInfo(), Isis::Sensor::LocalSolarTime(), and Isis::Camera::SunAzimuth().
| void Isis::Spice::SubSpacecraftPoint | ( | double & | lat, | |
| double & | lon | |||
| ) |
Returns the sub-spacecraft latitude/longitude in universal coordinates (0-360 positive east, ocentric).
| lat | Sub-spacecraft latitude | |
| lon | Sub-spacecraft longitude |
Definition at line 635 of file Spice.cpp.
References _FILEINFO_, a, b, c, Isis::NaifStatus::CheckErrors(), Isis::SpicePosition::Coordinate(), dist, Isis::iException::Message(), p_bodyRotation, p_et, p_instrumentPosition, p_radii, and Isis::PI().
Referenced by Isis::CameraPointInfo::GetPointInfo(), Isis::Camera::GroundRangeResolution(), Isis::Sensor::SpacecraftAltitude(), and Isis::Camera::SpacecraftAzimuth().
| void Isis::Spice::SunPosition | ( | double | p[3] | ) | const |
Returns the sun position in either body-fixed or J2000 reference frame and km units.
| p[] | Sun position |
Definition at line 456 of file Spice.cpp.
References _FILEINFO_, Isis::iException::Message(), p_et, and p_uB.
Referenced by Isis::CameraPointInfo::GetPointInfo().
| std::string Isis::Spice::Target | ( | ) | const [inline] |
Returns the string name of the target.
Definition at line 193 of file Spice.h.
References p_target.
Referenced by Isis::Camera::BasicMapping(), and ComputeSolarLongitude().
| double Isis::Spice::TargetCenterDistance | ( | ) | const |
Calculates and returns the distance from the spacecraft to the target center.
Definition at line 472 of file Spice.cpp.
References Isis::SpicePosition::Coordinate(), p_bodyRotation, and p_instrumentPosition.
Referenced by Isis::CameraPointInfo::GetPointInfo().
SpiceDouble Isis::Spice::p_BJ[3][3] [protected] |
This contains the transformation matrix from J2000 (J) to Body fixed (B).
Recall that the transpose of this matrix JB will convert from body-fixed to J2000. It is left in protected space so that conversions between double and SpiceDouble do not have to occur in inheriting classes.
SpiceDouble Isis::Spice::p_radii[3] [protected] |
The radii of the target in kilometers.
Definition at line 232 of file Spice.h.
Referenced by Isis::Camera::BasicMapping(), Isis::Camera::NorthAzimuth(), Radii(), Isis::Sensor::SetLookDirection(), Isis::Sensor::SetUniversalGround(), Isis::Sensor::SpacecraftAltitude(), Spice(), SubSolarPoint(), and SubSpacecraftPoint().
SpiceDouble Isis::Spice::p_uB[3] [protected] |
This contains the sun position (u) in the bodyfixed reference frame (B).
It is left protected so that conversions between double and SpiceDouble do not have to occur in inheriting classes. Units are km
Definition at line 220 of file Spice.h.
Referenced by Isis::Sensor::IncidenceAngle(), Isis::Sensor::PhaseAngle(), SetEphemerisTime(), SubSolarPoint(), and SunPosition().