Unverified Commit e926548c authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by GitHub
Browse files

updated with new isd format (#3839)

* updated with new isd format

* removed missed debug prints

* changed header stuff for ale

* updated env
parent 4e0ace32
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ channels:
  - defaults

dependencies:
  - ale >=0.7.1
  - ale >=0.8.0
  - boost=1.68.0
  - armadillo
  - blas
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
#   ALE_LIBRARY

find_path(ALE_INCLUDE_DIR
    NAMES ale.h
    NAMES Isd.h
    PATH_SUFFIXES ale
)

+9 −10
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@

#include <getSpkAbCorrState.hpp>

#include <ale.h>
#include <ale/Load.h>

#include <nlohmann/json.hpp>
using json = nlohmann::json;
@@ -120,8 +120,8 @@ namespace Isis {
  void Spice::init(Pvl &lab, bool noTables, json isd) {
    NaifStatus::CheckErrors();
    // Initialize members
    
    m_solarLongitude = new Longitude;
    
    m_et = NULL;
    m_kernels = new QVector<QString>;

@@ -197,7 +197,7 @@ namespace Isis {
          isd = ale::load(lab.fileName().toStdString(), props.dump(), "isis");
        }
        
        json aleNaifKeywords = isd["NaifKeywords"];
        json aleNaifKeywords = isd["naif_keywords"];
        m_naifKeywords = new PvlObject("NaifKeywords", aleNaifKeywords);
        
        // Still need to load clock kernels for now 
@@ -379,8 +379,8 @@ namespace Isis {
    // Check to see if we have nadir pointing that needs to be computed &
    // See if we have table blobs to load 
    if (m_usingAle) {
      m_sunPosition->LoadCache(isd["SunPosition"]);
      m_bodyRotation->LoadCache(isd["BodyRotation"]);
      m_sunPosition->LoadCache(isd["sun_position"]);
      m_bodyRotation->LoadCache(isd["body_rotation"]);
      solarLongitude();
    }
    else if (kernels["TargetPosition"][0].toUpper() == "TABLE") {
@@ -421,7 +421,7 @@ namespace Isis {
      m_instrumentRotation = new SpiceRotation(*m_ikCode, *m_spkBodyCode);
    }
    else if (m_usingAle) {
     m_instrumentRotation->LoadCache(isd["InstrumentPointing"]);
     m_instrumentRotation->LoadCache(isd["instrument_pointing"]);
    }
    else if (kernels["InstrumentPointing"][0].toUpper() == "TABLE") {
      Table t("InstrumentPointing", lab.fileName(), lab);
@@ -436,7 +436,7 @@ namespace Isis {
    }
    
    if (m_usingAle) {
      m_instrumentPosition->LoadCache(isd["InstrumentPosition"]);
      m_instrumentPosition->LoadCache(isd["instrument_position"]);
    }
    else if (kernels["InstrumentPosition"][0].toUpper() == "TABLE") {
      Table t("InstrumentPosition", lab.fileName(), lab);
@@ -965,8 +965,7 @@ namespace Isis {


  /**
   * This returns the PvlObject that stores all of the requested Naif data
   *   and can be a replacement for furnishing text kernels.
   * This returns the PvlObject that stores all of the requested Naif data  *   and can be a replacement for furnishing text kernels.
   */
  PvlObject Spice::getStoredNaifKeywords() const {
    return *m_naifKeywords;
+7 −7
Original line number Diff line number Diff line
@@ -354,22 +354,22 @@ namespace Isis {
    }

    // Load the full cache time information from the label if available
    p_fullCacheStartTime = isdPos["SpkTableStartTime"].get<double>();
    p_fullCacheEndTime = isdPos["SpkTableEndTime"].get<double>();
    p_fullCacheSize = isdPos["SpkTableOriginalSize"].get<double>();
    p_cacheTime = isdPos["EphemerisTimes"].get<std::vector<double>>();
    p_fullCacheStartTime = isdPos["spk_table_start_time"].get<double>();
    p_fullCacheEndTime = isdPos["spk_table_end_time"].get<double>();
    p_fullCacheSize = isdPos["spk_table_original_size"].get<double>();
    p_cacheTime = isdPos["ephemeris_times"].get<std::vector<double>>();

    for (auto it = isdPos["Positions"].begin(); it != isdPos["Positions"].end(); it++) {
    for (auto it = isdPos["positions"].begin(); it != isdPos["positions"].end(); it++) {
      std::vector<double> pos = {it->at(0).get<double>(), it->at(1).get<double>(), it->at(2).get<double>()};
      p_cache.push_back(pos);
    }

    p_cacheVelocity.clear();

    bool hasVelocityKey = isdPos.find("Velocities") != isdPos.end();
    bool hasVelocityKey = isdPos.find("velocities") != isdPos.end();

    if (hasVelocityKey) {
      for (auto it = isdPos["Velocities"].begin(); it != isdPos["Velocities"].end(); it++) {
      for (auto it = isdPos["velocities"].begin(); it != isdPos["velocities"].end(); it++) {
        std::vector<double> vel = {it->at(0).get<double>(), it->at(1).get<double>(), it->at(2).get<double>()};
        p_cacheVelocity.push_back(vel);
      }
+6 −6
Original line number Diff line number Diff line
@@ -296,11 +296,11 @@ int main(int argc, char *argv[]) {

  // Test loading cache from an ALE ISD without velocities
  cout << "Test loading cache from an ALE ISD with velocities" << endl;
  json aleIsd = {{"SpkTableStartTime"    , -10.0},
                 {"SpkTableEndTime"      , 10.0},
                 {"SpkTableOriginalSize" , 3},
                 {"EphemerisTimes"       , {-10.0, 0.0, 10.0}},
                 {"Positions"            , {{-10.0, -10.0, -10.0},
  json aleIsd = {{"spk_table_start_time"    , -10.0},
                 {"spk_table_end_time"      , 10.0},
                 {"spk_table_original_size" , 3},
                 {"ephemeris_times"       , {-10.0, 0.0, 10.0}},
                 {"positions"            , {{-10.0, -10.0, -10.0},
                                            {0.0,  0.0,  0.0},
                                            {10.0,  10.0,  10.0}}}};
  SpicePosition alePos(-94, 499);
@@ -319,7 +319,7 @@ int main(int argc, char *argv[]) {
  // Test loading cache from an ALE ISD with velocities
  cout << "Test loading cache from an ALE ISD with velocities" << endl;
  json aleVelIsd = aleIsd;
  aleVelIsd["Velocities"] = {{1.0, 1.0, 1.0},
  aleVelIsd["velocities"] = {{1.0, 1.0, 1.0},
                             {1.0, 1.0, 1.0},
                             {1.0, 1.0, 1.0}};
  SpicePosition aleVelPos(-94, 499);
Loading