Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detached label support for kaguyasp2ascii #5607

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@
{
"name": "Miller-Ribelin, Elizabeth"
},
{
"affiliation": "Japan Aerospace Exploration Agency, Institute of Space and Astronautical Science",
"name": "Murakami, Shin-ya",
"orcid": "0000-0002-7137-4849"
{
"affiliation": "United States Geological Survey, Astro Geology Science Center",
"name": "Nelson, Gavin"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ release.

## [Unreleased]

### Fixed

- Fixed a bug in kaguyasp2isis that doesn't work for data with a detached label.

## [8.3.0] - 2024-08-16

### Added
Expand Down
15 changes: 12 additions & 3 deletions isis/src/kaguya/apps/kaguyasp2ascii/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ find files of those names at the top level of this repository. **/
#include <bitset>
#include <cstdio>
#include <QString>
#include <QDir>

#include "ProcessImportPds.h"

Expand All @@ -32,12 +33,20 @@ void IsisMain() {
// Detached labels use format keyword = "dataFile" value <unit>
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.
// Determine label for inFile is attached label or detached label
if (FileName(inFile).name() == FileName(dataFile).name()){
// If input filename matches datafile filename without path information,
// one assumes label file for inFile is attached label, otherwise
// detached label.
dataFile = inFile;
// Attached labels use format keyword = value <units>
keywordIndex = 0;
} else {
// data files specification in label usually do not include path
// information. If label is detached label, data file is located at
// the same directory as label file.
// this allows users to specify data that is not in the current directory.
dataFile = FileName(inFile).dir().path() + "/" + dataFile;
}

ofstream os;
Expand Down