From ce2dd259f72bf0b5d750cb1e55676ff1a8926e7f Mon Sep 17 00:00:00 2001 From: Christine Kim Date: Wed, 23 Oct 2024 14:59:02 -0400 Subject: [PATCH] some fixes --- SpiceQL/db/base.json | 4 +++- SpiceQL/include/spice_types.h | 4 ++-- SpiceQL/src/inventoryimpl.cpp | 6 +----- SpiceQL/src/spice_types.cpp | 2 +- SpiceQL/src/utils.cpp | 16 +++++++++++++++- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/SpiceQL/db/base.json b/SpiceQL/db/base.json index c2af2ca..c551a87 100644 --- a/SpiceQL/db/base.json +++ b/SpiceQL/db/base.json @@ -4,7 +4,9 @@ "kernels" : ["naif[0-9]{4}.tls"] }, "spk" : { - "kernels" : ["^de[0-9]{3}.bsp$", "^mar[0-9]{3}.bsp$", "^nep[0-9]{3}.bsp$", "^sat[0-9]{3}.bsp$", "^ura[0-9]{3}.bsp$"] + "noquality" : { + "kernels" : ["^de[0-9]{3}.bsp$", "^mar[0-9]{3}.bsp$", "^nep[0-9]{3}.bsp$", "^sat[0-9]{3}.bsp$", "^ura[0-9]{3}.bsp$"] + } }, "pck" : { "kernels" : ["pck0000[0-9].tpc"] diff --git a/SpiceQL/include/spice_types.h b/SpiceQL/include/spice_types.h index 3cd0fd2..c047d92 100644 --- a/SpiceQL/include/spice_types.h +++ b/SpiceQL/include/spice_types.h @@ -43,12 +43,12 @@ namespace SpiceQL { * @brief Enumeration representing the different possible kernel qualities **/ enum class Quality { + NOQUALITY=0, // Either Quaility doesn't apply (e.g. text kernels) -or- + // we dont care about quality (e.g. CK of any quality) NADIR = 1, // Assumes Nadir pointing PREDICTED = 2, // Based on predicted future location of the spacecraft/body RECONSTRUCTED = 3, // Supplemented by real spacecraft/body data SMITHED = 4, // Controlled Kernels - NA = SMITHED // Either Quaility doesn't apply (e.g. text kernels) -or- - // we dont care about quality (e.g. CK of any quality) }; /** diff --git a/SpiceQL/src/inventoryimpl.cpp b/SpiceQL/src/inventoryimpl.cpp index 4f3b4e2..c26ca5b 100644 --- a/SpiceQL/src/inventoryimpl.cpp +++ b/SpiceQL/src/inventoryimpl.cpp @@ -150,10 +150,6 @@ namespace SpiceQL { for (auto &[mission, kernels] : json_kernels.items()) { fmt::print("mission: {}\n", mission); - if (mission == "Base") { - continue; - } - for(auto &[kernel_type, kernel_obj] : kernels.items()) { if (kernel_type == "ck" || kernel_type == "spk") { // we need to log the times @@ -255,7 +251,7 @@ namespace SpiceQL { } // iterate down the qualities - for(int i = (int)quality; i > 0 && !found; i--) { + for(int i = (int)quality; i >= 0 && !found; i--) { string key = instrument+"/"+Kernel::translateType(type)+"/"+Kernel::QUALITIES.at(i)+"/"+"kernels"; SPDLOG_DEBUG("Key: {}", key); quality = (Kernel::Quality)i; diff --git a/SpiceQL/src/spice_types.cpp b/SpiceQL/src/spice_types.cpp index 6427c18..a5e5200 100644 --- a/SpiceQL/src/spice_types.cpp +++ b/SpiceQL/src/spice_types.cpp @@ -47,7 +47,7 @@ namespace SpiceQL { "iak", "ik", "fk", "dsk", "pck", "ek"}; - const std::vector Kernel::QUALITIES = { "na", + const std::vector Kernel::QUALITIES = { "noquality", "predicted", "nadir", "reconstructed", diff --git a/SpiceQL/src/utils.cpp b/SpiceQL/src/utils.cpp index c706f77..e6392e5 100644 --- a/SpiceQL/src/utils.cpp +++ b/SpiceQL/src/utils.cpp @@ -209,17 +209,25 @@ namespace SpiceQL { json ephemKernels = {}; json lskKernels = {}; + json pckKernels = {}; + json spkKernels = {}; if (searchKernels) { ephemKernels = Inventory::search_for_kernelset(mission, {"sclk", "ck", "spk", "pck", "tspk"}, ets.front(), ets.back(), ckQuality, spkQuality); lskKernels = Inventory::search_for_kernelset("base", {"lsk"}); + pckKernels = Inventory::search_for_kernelset("base", {"pck"}); + spkKernels = Inventory::search_for_kernelset("base", {"spk"}, ets.front(), ets.back(), "noquality", "noquality"); SPDLOG_DEBUG("LSK Kernels : {}", lskKernels.dump(4)); - SPDLOG_DEBUG("{} Kernels : {}", mission, ephemKernels.dump(4)); + SPDLOG_DEBUG("{} Kernels : {}", mission, ephemKernels.dump(4)); + SPDLOG_DEBUG("PCK Kernels : {}", pckKernels.dump(4)); + SPDLOG_DEBUG("SPK Kernels : {}", spkKernels.dump(4)); } auto start = high_resolution_clock::now(); KernelSet ephemSet(ephemKernels); KernelSet lskSet(lskKernels); + KernelSet pckSet(pckKernels); + KernelSet spkSet(spkKernels); auto stop = high_resolution_clock::now(); auto duration = duration_cast(stop - start); SPDLOG_INFO("Time in microseconds to furnish kernel sets: {}", duration.count()); @@ -455,15 +463,18 @@ namespace SpiceQL { json ephemKernels = {}; json lskKernels = {}; + json pckKernels = {}; if (searchKernels) { ephemKernels = Inventory::search_for_kernelset(mission, {"sclk", "ck", "pck", "fk", "tspk"}, ets.front(), ets.back(), ckQuality, "na"); lskKernels = Inventory::search_for_kernelset("base", {"lsk"}); + pckKernels = Inventory::search_for_kernelset("base", {"pck"}); } auto start = high_resolution_clock::now(); KernelSet ephemSet(ephemKernels); KernelSet lskSet(lskKernels); + KernelSet pckSet(pckKernels); auto stop = high_resolution_clock::now(); auto duration = duration_cast(stop - start); SPDLOG_INFO("Time in microseconds to furnish kernel sets: {}", duration.count()); @@ -489,14 +500,17 @@ namespace SpiceQL { // json missionJson; json ephemKernels; json lskKernels; + json pckKernels; if (searchKernels) { ephemKernels = Inventory::search_for_kernelset(mission, {"sclk", "ck", "pck", "fk", "tspk"}, et, et, ckQuality, "na"); lskKernels = Inventory::search_for_kernelset("base", {"lsk"}); + pckKernels = Inventory::search_for_kernelset("base", {"pck"}); } KernelSet ephemSet(ephemKernels); KernelSet lskSet(lskKernels); + KernelSet pckSet(pckKernels); checkNaifErrors(); // The code for this method was extracted from the Naif routine rotget written by N.J. Bachman & -- GitLab