From dbd3d59e9ed441c306300193aeb82254a72a4a66 Mon Sep 17 00:00:00 2001 From: Austin Sanders Date: Wed, 31 Jul 2024 10:04:07 -0600 Subject: [PATCH 1/4] Updated kaguyasp2ascii to support newer (detached) data (#5568) * Modified to work with new (detached) data * Updated changelog * Allow data specification outside current directory --- CHANGELOG.md | 1 + .../apps/kaguyasp2ascii/kaguyasp2ascii.xml | 4 +- isis/src/kaguya/apps/kaguyasp2ascii/main.cpp | 37 +++++++++++++------ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c7e58bff4..42141b1750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ release. - Added backplane options for SunIllumination and SurfaceObliqueDetectorResolution to phocube [#5467](https://github.com/DOI-USGS/ISIS3/issues/5467) ### Changed +- Modified kaguyasp2isis to work with new (detached) data [#5436](https://github.com/DOI-USGS/ISIS3/issues/5436) - Added jigsaw error message for csminit'd images without csm parameters[#5486](https://github.com/DOI-USGS/ISIS3/issues/5486) - Changed `qwt` dependency version to 6.2.0 or below [#5498](https://github.com/DOI-USGS/ISIS3/issues/5498) - Pinned `suitesparse` dependency version to maximum not including 7.7.0 [#5496](https://github.com/DOI-USGS/ISIS3/issues/5496) diff --git a/isis/src/kaguya/apps/kaguyasp2ascii/kaguyasp2ascii.xml b/isis/src/kaguya/apps/kaguyasp2ascii/kaguyasp2ascii.xml index 52cb9fe6cd..a33636c6cd 100644 --- a/isis/src/kaguya/apps/kaguyasp2ascii/kaguyasp2ascii.xml +++ b/isis/src/kaguya/apps/kaguyasp2ascii/kaguyasp2ascii.xml @@ -80,10 +80,10 @@ Input Kaguya SP file - This is the input Kaguya SP file + This is the input Kaguya SP file. For an attached label, use the .spc file, or for a detached label, use the .lbl file. - *.spc + *.lbl *.spc diff --git a/isis/src/kaguya/apps/kaguyasp2ascii/main.cpp b/isis/src/kaguya/apps/kaguyasp2ascii/main.cpp index 7fa27fab97..ac42ba6e28 100644 --- a/isis/src/kaguya/apps/kaguyasp2ascii/main.cpp +++ b/isis/src/kaguya/apps/kaguyasp2ascii/main.cpp @@ -25,8 +25,20 @@ void IsisMain() { ProcessImportPds p; UserInterface &ui = Application::GetUserInterface(); - FileName inFile = ui.GetFileName("FROM"); - Pvl lab(inFile.expanded()); + QString inFile = ui.GetFileName("FROM"); + Pvl lab(inFile); + QString dataFile = lab.findKeyword("FILE_NAME")[0]; + + // Detached labels use format keyword = "dataFile" value + int keywordIndex = 1; + + if (FileName(inFile).baseName() == FileName(dataFile).baseName()){ + // data files usually do not include path information. If input basename matches datafile basename, include path information + // this allows users to specify data that is not in the current directory. + dataFile = inFile; + // Attached labels use format keyword = value + keywordIndex = 0; + } ofstream os; QString outFile = FileName(ui.GetFileName("TO")).expanded(); @@ -59,32 +71,32 @@ void IsisMain() { int qaptr = 0; if (lab.hasKeyword("^SP_SPECTRUM_WAV")) { - wavptr = toInt(lab.findKeyword("^SP_SPECTRUM_WAV")[0]) - 1; + wavptr = toInt(lab.findKeyword("^SP_SPECTRUM_WAV")[keywordIndex]) - 1; } if (lab.hasKeyword("^SP_SPECTRUM_RAW")) { - rawptr = toInt(lab.findKeyword("^SP_SPECTRUM_RAW")[0]) - 1; + rawptr = toInt(lab.findKeyword("^SP_SPECTRUM_RAW")[keywordIndex]) - 1; } if (lab.hasKeyword("^SP_SPECTRUM_RAD")) { - radptr = toInt(lab.findKeyword("^SP_SPECTRUM_RAD")[0]) - 1; + radptr = toInt(lab.findKeyword("^SP_SPECTRUM_RAD")[keywordIndex]) - 1; } //older-format file without calibrated NIR2 data if (lab.hasKeyword("^SP_SPECTRUM_REF")) { - refptr1 = toInt(lab.findKeyword("^SP_SPECTRUM_REF")[0]) - 1; + refptr1 = toInt(lab.findKeyword("^SP_SPECTRUM_REF")[keywordIndex]) - 1; } //newer-format file with calibrated NIR2 data and 2 different Reflectances if (lab.hasKeyword("^SP_SPECTRUM_REF1")) { - refptr1 = toInt(lab.findKeyword("^SP_SPECTRUM_REF1")[0]) - 1; + refptr1 = toInt(lab.findKeyword("^SP_SPECTRUM_REF1")[keywordIndex]) - 1; } if (lab.hasKeyword("^SP_SPECTRUM_REF2")) { - refptr2 = toInt(lab.findKeyword("^SP_SPECTRUM_REF2")[0]) - 1; + refptr2 = toInt(lab.findKeyword("^SP_SPECTRUM_REF2")[keywordIndex]) - 1; } if (lab.hasKeyword("^SP_SPECTRUM_QA")) { - qaptr = toInt(lab.findKeyword("^SP_SPECTRUM_QA")[0]) - 1; + qaptr = toInt(lab.findKeyword("^SP_SPECTRUM_QA")[keywordIndex]) - 1; } FILE *spcptr; - if ((spcptr = fopen(inFile.expanded().toLatin1().data(),"rb")) == 0) { - QString msg = "Error opening input Kaguya SP file [" + inFile.expanded() + "]"; + if ((spcptr = fopen(dataFile.toLatin1().data(),"rb")) == 0) { + QString msg = "Error opening input Kaguya SP file [" + dataFile + "]"; throw IException(IException::User, msg, _FILEINFO_); } @@ -101,7 +113,7 @@ void IsisMain() { if (!lab.hasObject("SP_SPECTRUM_WAV") || !lab.hasObject("SP_SPECTRUM_QA") || !lab.hasObject("SP_SPECTRUM_RAD") || !(lab.hasObject("SP_SPECTRUM_REF") || (lab.hasObject("SP_SPECTRUM_REF1") && lab.hasObject("SP_SPECTRUM_REF2")))) { - QString msg = "Input file [" + inFile.expanded() + "] is not a valid "; + QString msg = "Input file [" + inFile + "] is not a valid "; msg += "Kaguya Spectral Profiler file"; throw IException(IException::User, msg, _FILEINFO_); } @@ -261,6 +273,7 @@ void IsisMain() { PvlObject refobj; PvlObject refobj2; + if (lab.hasKeyword("^SP_SPECTRUM_REF")) { refobj = lab.findObject("SP_SPECTRUM_REF"); } From 736648d172adc0d7fcdb9c0440f2cf5e41a1c542 Mon Sep 17 00:00:00 2001 From: acpaquette Date: Wed, 31 Jul 2024 10:11:33 -0700 Subject: [PATCH 2/4] Fixes vector copy in NaifDskShape unit test (#5569) --- isis/src/base/objs/NaifDskShape/unitTest.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/isis/src/base/objs/NaifDskShape/unitTest.cpp b/isis/src/base/objs/NaifDskShape/unitTest.cpp index 21ee7ff783..f27810526f 100755 --- a/isis/src/base/objs/NaifDskShape/unitTest.cpp +++ b/isis/src/base/objs/NaifDskShape/unitTest.cpp @@ -158,14 +158,16 @@ int main(int argc, char *argv[]) { qDebug() << "Try to calculate norms using valid shape model..."; shapeModelFromPvlElevation.setLocalNormalFromIntercept(); qDebug() << "Has intercept normal? " << shapeModelFromPvlElevation.hasLocalNormal(); + std::vector normal = shapeModelFromPvlElevation.localNormal(); qDebug() << "Normal set from Intercept: " - << QVector(shapeModelFromPvlElevation.localNormal().begin(), shapeModelFromPvlElevation.localNormal().end()); + << QVector(normal.begin(), normal.end()); // no need to call calculateSurfaceNormal() or ellipsoidNormal() // directly. these methods are called by calculateDefaultNormal() shapeModelFromPvlElevation.calculateDefaultNormal(); qDebug() << "Has default normal? " << shapeModelFromPvlElevation.hasNormal(); + normal = shapeModelFromPvlElevation.normal(); qDebug() << "Default normal: " - << QVector(shapeModelFromPvlElevation.normal().begin(), shapeModelFromPvlElevation.normal().end()); + << QVector(normal.begin(), normal.end()); QVector cornerNeighborPoints; double point[3]; @@ -173,8 +175,9 @@ int main(int argc, char *argv[]) { cornerNeighborPoints.push_back(point); shapeModelFromPvlElevation.calculateLocalNormal(cornerNeighborPoints); qDebug() << "Has local normal? " << shapeModelFromPvlElevation.hasLocalNormal(); + normal = shapeModelFromPvlElevation.localNormal(); qDebug() << "Local normal from neighbor points: " - << QVector(shapeModelFromPvlElevation.localNormal().begin(), shapeModelFromPvlElevation.localNormal().end()); + << QVector(normal.begin(), normal.end()); qDebug() << ""; qDebug() << "================================= Error Throws =================================="; From cbdd9a527d00ba33ff150418dc19eba14f224364 Mon Sep 17 00:00:00 2001 From: Amy Stamile <74275278+amystamile-usgs@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:18:56 -0700 Subject: [PATCH 3/4] Adds PR bot comment. (#5567) --- .github/workflows/gitlab-codebuild.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/gitlab-codebuild.yml b/.github/workflows/gitlab-codebuild.yml index ab0661fd11..1cfad11b00 100644 --- a/.github/workflows/gitlab-codebuild.yml +++ b/.github/workflows/gitlab-codebuild.yml @@ -26,4 +26,15 @@ jobs: git commit -a -m "$PR_NUMBER" git push origin PR_$PR_NUMBER --force + comment-bot: + permissions: write-all + runs-on: [ubuntu-latest] + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Comment PR + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + The build and test suite have started for your pull request. View [build logs](https://us-west-2.codebuild.aws.amazon.com/project/eyJlbmNyeXB0ZWREYXRhIjoiNDJNZ2MxbHFKTkwxV1RyQUxJekdJY3FIanNqU29rMHB4Nk1YUzk4REIrZUZDeEtEaW9HQlZ1dTZOSHpML2VUTGVDekYydmVFcU9sUHJKN20wQzd1Q0UzSzJscnB0MElDb1M3Ti9GTlJYR1RuMWJTV3V1SkJTa3NoYmc9PSIsIml2UGFyYW1ldGVyU3BlYyI6IjF3U2NTSGlDcEtCc29YVnEiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D) for results. \ No newline at end of file From 778e471c0370b37d3085ea51f35ec2a23a6ff8d7 Mon Sep 17 00:00:00 2001 From: Amy Stamile <74275278+amystamile-usgs@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:00:32 -0700 Subject: [PATCH 4/4] Fixed gllssi2isis to support V1.1 data (#5570) --- CHANGELOG.md | 1 + isis/src/galileo/apps/gllssi2isis/main.cpp | 21 ++++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42141b1750..81fc6e90e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ release. - Fixed CSMSerialNumber.trn typo [#5485](https://github.com/DOI-USGS/ISIS3/issues/5485) - Fixed CSMSerialNumber.trn to be PVL compliant [#5484](https://github.com/DOI-USGS/ISIS3/issues/5484) - Fixed hrsc2isis to support level 3 hrsc images [#5497](https://github.com/DOI-USGS/ISIS3/issues/5497) +- Fixed gllssi2isis to support V1.1 data [#5396](https://github.com/DOI-USGS/ISIS3/issues/5396) ### Added - Added versioned default values to lrowacphomap's PHOALGO and PHOPARCUBE parameters and updated lrowacphomap to handle them properly. [#5452](https://github.com/DOI-USGS/ISIS3/pull/5452) diff --git a/isis/src/galileo/apps/gllssi2isis/main.cpp b/isis/src/galileo/apps/gllssi2isis/main.cpp index 59a9457e35..09d8bfe6e0 100644 --- a/isis/src/galileo/apps/gllssi2isis/main.cpp +++ b/isis/src/galileo/apps/gllssi2isis/main.cpp @@ -56,20 +56,15 @@ void IsisMain() { throw IException(IException::Io, msg, _FILEINFO_); } - // data set id value must contain "SSI-2-REDR-V1.0"(valid SSI image) - // or "SSI-4-REDR-V1.0"(reconstructed from garbled SSI image) + // data set id value must contain "SSI-2-REDR-V1.0" or "SSI-2-REDR-V1.1" (valid SSI image) + // or "SSI-4-REDR-V1.0" or "SSI-4-REDR-V1.1"(reconstructed from garbled SSI image) QString dataSetId; dataSetId = (QString)lab["DATA_SET_ID"]; - try { - if(!dataSetId.contains("SSI-2-REDR-V1.0") - && !dataSetId.contains("SSI-4-REDR-V1.0") ) { - QString msg = "Invalid DATA_SET_ID [" + dataSetId + "]"; - throw IException(IException::Unknown, msg, _FILEINFO_); - } - } - catch(IException &e) { - QString msg = "Unable to read [DATA_SET_ID] from input file [" + - inFile.expanded() + "]"; + + if(!dataSetId.contains("SSI-2-REDR-V1.0") && !dataSetId.contains("SSI-2-REDR-V1.1") + && !dataSetId.contains("SSI-4-REDR-V1.0") && !dataSetId.contains("SSI-4-REDR-V1.1") ) { + QString msg = "Invalid DATA_SET_ID [" + dataSetId + "]" + + " from input file [" + inFile.expanded() + "]"; throw IException(IException::Unknown, msg, _FILEINFO_); } @@ -79,7 +74,7 @@ void IsisMain() { // reconstructed images are 800x800 (i.e. not summed) // even though they have frame duration of 2.333 // (which ordinarily indicates a summed image) - if(dataSetId.contains("SSI-4-REDR-V1.0")) { + if(dataSetId.contains("SSI-4-REDR-V1.0") || dataSetId.contains("SSI-4-REDR-V1.1")) { summed = false; } else if (frameDuration > 2.0 && frameDuration < 3.0) {