Skip to content
Snippets Groups Projects
Unverified Commit 96e715d9 authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

ALE Related ISIS Fixes (#5021)

* Small changes for ale spiceinit

* Fixed double precision when converting json to pvl

* Fixed unnecessary changes

* Expanded if statement

* Added history entry to copylabel

* Fixed typo in description
parent 0c80be2a
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,11 @@
<change name="Mackenzie Boyd" date="2011-04-27">
Original version.
</change>
<change name="Adam Paquette" date="2022-08-02">
Added the ability to directly request objects from a cubes
label to be copied to the new cube. Similarly to how the
GROUPS argument functions.
</change>
</history>
<category>
......@@ -202,12 +207,24 @@
Copy the given groups, in CSV format
</brief>
<description>
Copy and given groups over to the FROM cube, groups must exist in the
Copy any given groups over to the FROM cube, groups must exist in the
IsisCube Object to be copied, and must be specified with exact spelling,
comma separated.
</description>
</parameter>
<parameter name="OBJECTS">
<type>string</type>
<internalDefault>none</internalDefault>
<brief>
Copy the given objects, in CSV format
</brief>
<description>
Copy any given objects over to the FROM cube, groups must be specified
with exact spelling, and be comma separated.
</description>
</parameter>
<parameter name="BLOBS">
<type>string</type>
<internalDefault>none</internalDefault>
......
......@@ -17,6 +17,7 @@ using namespace std;
using namespace Isis;
bool copyGroup(Pvl * source, Pvl * mergeTo, QString name);
bool copyObject(Pvl *source, Pvl *mergeTo, QString name);
bool copyBlob(Cube *from, Cube *to, QString type, QString name, QString fname);
void IsisMain() {
......@@ -194,6 +195,19 @@ void IsisMain() {
}
}
// Any other requested objects
if (ui.WasEntered("Objects")) {
QString objs = QString(ui.GetString("Objects")).remove(" ");
QStringList list = objs.split(",");
QString obj;
foreach (obj, list) {
if (obj.size() != 0) {
bool success = copyObject(source, mergeTo, obj);
results += PvlKeyword(obj, success ? "true" : "false");
}
}
}
// Any other requested blobs
// Expected format is: <Object name>:<Name keyword>
if (ui.WasEntered("Blobs")) {
......@@ -255,6 +269,26 @@ bool copyGroup(Pvl * source, Pvl * mergeTo, QString name) {
}
}
// Copy an Object from the IsisCube pvl in one cube to the other
// If it exists in the source, we'll copy it, if it exists in the
// mergeTo Pvl, we'll overwrite it.
bool copyObject(Pvl *source, Pvl *mergeTo, QString name)
{
try
{
// The call we're looking to get an exception on is the one just below.
PvlObject &toCopy = source->findObject(name, Pvl::Traverse);
if (mergeTo->hasObject(name))
mergeTo->deleteGroup(name);
mergeTo->addObject(toCopy);
return true;
}
catch (IException &)
{
return false;
}
}
bool copyBlob(Cube * from, Cube * to, QString name, QString type, QString fname) {
try {
Blob blob(name, type, fname);
......
......@@ -66,7 +66,7 @@ namespace Isis {
if (it.value().is_array()) {
keyword.setName(QString::fromStdString(it.key()));
for(auto ar = it.value().begin(); ar!=it.value().end();ar++) {
keyword += QString::number(ar->get<double>());
keyword += QString::number(ar->get<double>(), 'g', 16);
}
}
else if(it.value().is_number()) {
......
......@@ -350,7 +350,7 @@ namespace Isis {
else {
// JAA - Modified to store and look for the frame body code in the cube labels
SpiceInt frameCode;
if ((m_usingNaif) || (!m_naifKeywords->hasKeyword("BODY_FRAME_CODE"))) {
if ((m_usingNaif) && (!m_naifKeywords->hasKeyword("BODY_FRAME_CODE"))) {
char frameName[32];
SpiceBoolean found;
cidfrm_c(*m_spkBodyCode, sizeof(frameName), &frameCode, frameName, &found);
......@@ -463,9 +463,6 @@ namespace Isis {
if (m_usingAle) {
m_instrumentPosition->LoadCache(isd["instrument_position"]);
if (m_instrumentPosition->cacheSize() > 3) {
m_instrumentPosition->Memcache2HermiteCache(0.01);
}
}
else if (kernels["InstrumentPosition"][0].toUpper() == "TABLE") {
Table t("InstrumentPosition", lab.fileName(), lab);
......@@ -704,6 +701,13 @@ namespace Isis {
cacheSize);
if (cacheSize > 3) m_instrumentPosition->Memcache2HermiteCache(tol);
}
else if (m_instrumentPosition->GetSource() == SpicePosition::Memcache) {
int aleCacheSize = m_instrumentPosition->cacheSize();
if (aleCacheSize > 3) {
m_instrumentPosition->Memcache2HermiteCache(tol);
}
}
if (!m_sunPosition->IsCached()) {
int sunPositionCacheSize = cacheSize;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment