From 592f786456d70cf5ac486f8801d66fc9249c07ee Mon Sep 17 00:00:00 2001 From: Kristin Date: Thu, 28 Feb 2019 17:22:48 -0700 Subject: [PATCH 1/5] Add 32-bit ISIS Special Pixel Constants to ProcessExportPds4 --- .../ProcessExportPds4/ProcessExportPds4.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp index f449f51f13..5b9e8a48fe 100644 --- a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp +++ b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp @@ -754,6 +754,33 @@ namespace Isis { toString(base)); elementArrayElement.appendChild(offsetElement); } + + // Add the Special_Constants class to define ISIS special pixel values: + + // Assume 32-bit/Real for CaSSIS + QDomElement specialConstantElement = m_domDoc->createElement("Special_Constants"); + arrayImageElement.insertAfter(specialConstantElement, + arrayImageElement.lastChildElement("Axis_Array")); + + QDomElement nullElement = m_domDoc->createElement("missing_constant"); + PvlToXmlTranslationManager::setElementValue(nullElement, QString::number(NULL8, 'g', 18)); //toString(NULL8)); + specialConstantElement.appendChild(nullElement); + + QDomElement highInstrumentSatElement = m_domDoc->createElement("high_instrument_saturation"); + PvlToXmlTranslationManager::setElementValue(highInstrumentSatElement, QString::number(HIGH_INSTR_SAT8, 'g', 18)); + specialConstantElement.appendChild(highInstrumentSatElement); + + QDomElement highRepresentationSatElement = m_domDoc->createElement("high_representation_saturation"); + PvlToXmlTranslationManager::setElementValue(highRepresentationSatElement, QString::number(HIGH_REPR_SAT8, 'g', 18)); + specialConstantElement.appendChild(highRepresentationSatElement); + + QDomElement lowInstrumentSatElement = m_domDoc->createElement("low_instrument_saturation"); + PvlToXmlTranslationManager::setElementValue(lowInstrumentSatElement, QString::number(LOW_INSTR_SAT8, 'g', 18)); + specialConstantElement.appendChild(lowInstrumentSatElement); + + QDomElement lowRepresentationSatElement = m_domDoc->createElement("low_representation_saturation"); + PvlToXmlTranslationManager::setElementValue(lowRepresentationSatElement, QString::number(LOW_REPR_SAT8, 'g', 18)); + specialConstantElement.appendChild(lowRepresentationSatElement); } } From f752f7da4b673177a3deeb9ca604d30fea7bd098 Mon Sep 17 00:00:00 2001 From: Kristin Date: Thu, 28 Feb 2019 18:05:03 -0700 Subject: [PATCH 2/5] Add ability to set title and version id in exported PDS4 produce in tgocassisrdrgen and ProcessExportPds4 API --- .../ProcessExportPds4/ProcessExportPds4.cpp | 26 +++++++++++++++++++ .../ProcessExportPds4/ProcessExportPds4.h | 4 +++ isis/src/tgo/apps/tgocassisrdrgen/main.cpp | 10 +++++++ .../apps/tgocassisrdrgen/tgocassisrdrgen.xml | 20 ++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp index 5b9e8a48fe..c83aa60334 100644 --- a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp +++ b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp @@ -47,6 +47,9 @@ namespace Isis { ProcessExportPds4::ProcessExportPds4() { m_lid = ""; + m_versionId = ""; + m_title = ""; + m_imageType = StandardImage; qSetGlobalQHashSeed(1031); // hash seed to force consistent output @@ -319,6 +322,19 @@ namespace Isis { } +// FIXME docs needed + void ProcessExportPds4::setVersionId(QString versionId) { + m_versionId = versionId; + } + + void ProcessExportPds4::setTitle(QString title) { + m_title = title; + } + + + + + /** * Allows mission specific programs to use specified * versions of dictionaries. @@ -366,6 +382,16 @@ namespace Isis { QDomElement lidElement = identificationElement.firstChildElement("logical_identifier"); PvlToXmlTranslationManager::resetElementValue(lidElement, m_lid); + if (m_versionId != "") { + QDomElement versionElement = identificationElement.firstChildElement("version_id"); + PvlToXmlTranslationManager::resetElementValue(versionElement, m_versionId); + } + + if (m_title != "") { + QDomElement titleElement = identificationElement.firstChildElement("title"); + PvlToXmlTranslationManager::resetElementValue(titleElement, m_title); + } + // Get export history and add element. // These regular expressions match the pipe followed by the date from // the Application::Version() return value. diff --git a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h index 8dd72fdbdc..cd55f809ec 100644 --- a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h +++ b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h @@ -108,6 +108,8 @@ namespace Isis { QDomElement getElement(QStringList xmlPath, QDomElement parent=QDomElement()); void addHistory(QString description, QString date = "tbd", QString version = "1.0"); void setLogicalId(QString lid); + void setVersionId(QString versionId); + void setTitle(QString title); void setSchemaLocation(QString schema); void setImageType(ImageType imageType); @@ -131,6 +133,8 @@ namespace Isis { QDomDocument *m_domDoc; //!< XML label. QString m_schemaLocation; //!< QString with all schema locations required. QString m_lid; //!< QString with specified logical identifier. + QString m_versionId; //!< QString with specified version id. + QString m_title; //!< QString with specified title. ImageType m_imageType; //!< Type of image data to be written. }; diff --git a/isis/src/tgo/apps/tgocassisrdrgen/main.cpp b/isis/src/tgo/apps/tgocassisrdrgen/main.cpp index a2f17a8b71..10582800e6 100644 --- a/isis/src/tgo/apps/tgocassisrdrgen/main.cpp +++ b/isis/src/tgo/apps/tgocassisrdrgen/main.cpp @@ -86,6 +86,16 @@ void IsisMain() { logicalId += productId[0]; process.setLogicalId(logicalId); + // Set Title + if ( ui.WasEntered("TITLE") ) { + process.setTitle( ui.GetString("TITLE") ); + } + + // Set Version ID + if ( ui.WasEntered("VERSIONID") ) { + process.setVersionId( ui.GetString("VERSIONID") ); + } + // std PDS4 label process.StandardPds4Label(); diff --git a/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml b/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml index bde3b3deae..c2aff23e03 100644 --- a/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml +++ b/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml @@ -89,6 +89,26 @@ Update the default Product ID value. This value will be the last section of the PDS4 logical_identifier value. + + string + None + + Product ID value + + + Update the default Title value. + + + + string + None + + Product ID value + + + Update the default Version ID value. + + From 4f2222d1620869b54620b5c36801e1a17470f16b Mon Sep 17 00:00:00 2001 From: Kristin Date: Thu, 28 Feb 2019 19:56:29 -0700 Subject: [PATCH 3/5] Fix bug that occurs when exporting mosaics with Archive groups and fixed min/max lat/lon to east/west bounding box positive east flip bug --- .../objs/ProcessExportPds4/ProcessExportPds4.cpp | 11 ++++------- isis/src/tgo/apps/tgocassisrdrgen/main.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp index c83aa60334..0e6b526fa0 100644 --- a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp +++ b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp @@ -1033,11 +1033,10 @@ namespace Isis { double maxLon = inputMapping.findKeyword("MaximumLongitude"); double minLon = inputMapping.findKeyword("MinimumLongitude"); xmlPath.clear(); - xmlPath << "Product_Observational" + xmlPath << "Product_Observational" << "Observation_Area" - << "Discipline_Area" + << "Discipline_Area" << "cart:Cartography" - << "cart:Map_Projection" << "cart:Spatial_Domain" << "cart:Bounding_Coordinates"; QDomElement boundingCoordElement = getElement(xmlPath, baseElement); @@ -1046,18 +1045,16 @@ namespace Isis { // translation files currently handles Positive West case where east = min, west = max // so if positive east, swap min/max - if(QString::compare(lonDir, "Positive East", Qt::CaseInsensitive) == 0) { + if(QString::compare(lonDir, "PositiveEast", Qt::CaseInsensitive) == 0) { // west min, east max PvlToXmlTranslationManager::resetElementValue(eastElement, toString(maxLon), "deg"); PvlToXmlTranslationManager::resetElementValue(westElement, toString(minLon), "deg"); } } - - } - /** +/** * Convenience method to get an element given a path and its parent. * * @param xmlPath The XML path to the element to retrieve, diff --git a/isis/src/tgo/apps/tgocassisrdrgen/main.cpp b/isis/src/tgo/apps/tgocassisrdrgen/main.cpp index 10582800e6..30ce50c373 100644 --- a/isis/src/tgo/apps/tgocassisrdrgen/main.cpp +++ b/isis/src/tgo/apps/tgocassisrdrgen/main.cpp @@ -69,16 +69,16 @@ void IsisMain() { } else { // Get the observationId from the Archive Group, or the Mosaic group, if the input is a mosaic - QString observationId; + QString observationId; - if(label->findObject("IsisCube").hasGroup("Archive")){ - PvlGroup archiveGroup = label->findObject("IsisCube").findGroup("Archive"); - observationId = archiveGroup.findKeyword("ObservationId")[0]; - } - else if (label->findObject("IsisCube").hasGroup("Mosaic")) { + if (label->findObject("IsisCube").hasGroup("Mosaic")) { PvlGroup mosaicGroup = label->findObject("IsisCube").findGroup("Mosaic"); observationId = mosaicGroup.findKeyword("ObservationId")[0]; } + else if(label->findObject("IsisCube").hasGroup("Archive")){ + PvlGroup archiveGroup = label->findObject("IsisCube").findGroup("Archive"); + observationId = archiveGroup.findKeyword("ObservationId")[0]; + } productId.setValue(observationId); } From 8d655de01865610688dd4f7216e8f0e02a77f1c5 Mon Sep 17 00:00:00 2001 From: Kristin Date: Fri, 1 Mar 2019 10:09:29 -0700 Subject: [PATCH 4/5] Added docs. --- .../ProcessExportPds4/ProcessExportPds4.cpp | 28 ++++++++++++++++--- .../ProcessExportPds4/ProcessExportPds4.h | 3 ++ .../apps/tgocassisrdrgen/tgocassisrdrgen.xml | 4 +++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp index 0e6b526fa0..56260fc4d0 100644 --- a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp +++ b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp @@ -322,19 +322,39 @@ namespace Isis { } -// FIXME docs needed + /** + * Allows mission specific programs to set version_id + * required for PDS4 labels. This value is added to the xml file + * by the identificationArea() method. + * + * The input string should be colon separated string with 6 + * identifiers: + * + * @author 2019-03-01 Kristin Berry + * + * @param versiondId The version_id value required for PDS4 + * compliant labels. + */ void ProcessExportPds4::setVersionId(QString versionId) { m_versionId = versionId; } + + /** + * Allows mission specific programs to set the title + * required for PDS4 labels. This value is added to the xml file + * by the identificationArea() method. + * + * @author 2019-03-01 Kristin Berry + * + * @param title The title value required for PDS4 + * compliant labels. + */ void ProcessExportPds4::setTitle(QString title) { m_title = title; } - - - /** * Allows mission specific programs to use specified * versions of dictionaries. diff --git a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h index cd55f809ec..5631803c23 100644 --- a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h +++ b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.h @@ -75,6 +75,9 @@ namespace Isis { * attributes to elements. Matches pds validate tool specifations. * @history 2018-06-12 Kristin Berry - Added schema associated with the img class when it is * used. + * @history 2019-03-01 Kristin Berry - Added ability to set version_id and title, added + * Special_Constants to define ISIS special pixel values, fixed east/west + * bounding coordinates swap bug. Fixes git issue #2635. */ class ProcessExportPds4: public Isis::ProcessExport { diff --git a/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml b/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml index c2aff23e03..f363e57e6a 100644 --- a/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml +++ b/isis/src/tgo/apps/tgocassisrdrgen/tgocassisrdrgen.xml @@ -41,6 +41,10 @@ Updated to use the tgoCassisExportMosaic.trn translation file when the input cube is a mosaic. + + Added TITLE and VERSIONID optional parameters to specify these values in the exported PDS4 label. + Fixed bug that disabled reading of mosaics with Archive groups. + From 6e2be4fc99bb19e4fd7c8de04435a401f386bfe2 Mon Sep 17 00:00:00 2001 From: Kristin Date: Fri, 1 Mar 2019 11:07:48 -0700 Subject: [PATCH 5/5] Update schema to most recent versions and comment-out schema that isn't used (temporarily) in tgocassisrdrgen. --- .../ProcessExportPds4/ProcessExportPds4.cpp | 23 +++++++++---------- isis/src/tgo/apps/tgocassisrdrgen/main.cpp | 8 +++---- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp index 56260fc4d0..f6830d10cf 100644 --- a/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp +++ b/isis/src/base/objs/ProcessExportPds4/ProcessExportPds4.cpp @@ -64,10 +64,10 @@ namespace Isis { m_domDoc->appendChild(xmlHeader); // base pds4 schema location - m_schemaLocation = "http://pds.nasa.gov/pds4/pds/v1 http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1800.xsd"; + m_schemaLocation = "http://pds.nasa.gov/pds4/pds/v1 http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1B00.xsd"; QString xmlModel; - xmlModel += "href=\"http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1800.sch\" "; + xmlModel += "href=\"http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1B00.sch\" "; xmlModel += "schematypens=\"http://purl.oclc.org/dsdl/schematron\""; QDomProcessingInstruction header = m_domDoc->createProcessingInstruction("xml-model", xmlModel); @@ -432,18 +432,17 @@ namespace Isis { * the PDS4 labels. */ void ProcessExportPds4::displaySettings() { + // Add header info + addSchema("PDS4_DISP_1B00.sch", + "PDS4_DISP_1B00.xsd", + "xmlns:disp", + "http://pds.nasa.gov/pds4/disp/v1"); Pvl *inputLabel = InputCubes[0]->label(); FileName translationFileName; translationFileName = "$base/translations/pds4ExportDisplaySettings.trn"; PvlToXmlTranslationManager xlator(*inputLabel, translationFileName.expanded()); xlator.Auto(*m_domDoc); - - // Add header info - addSchema("PDS4_DISP_1700.sch", - "PDS4_DISP_1700.xsd", - "xmlns:disp", - "http://pds.nasa.gov/pds4/disp/v1"); } @@ -455,8 +454,8 @@ namespace Isis { Pvl *inputLabel = InputCubes[0]->label(); if ( !inputLabel->findObject("IsisCube").hasGroup("BandBin") ) return; // Add header info - addSchema("PDS4_IMG_1900.sch", - "PDS4_IMG_1900.xsd", + addSchema("PDS4_IMG_1A10_1510.sch", + "PDS4_IMG_1A10_1510.xsd", "xmlns:img", "http://pds.nasa.gov/pds4/img/v1"); @@ -977,8 +976,8 @@ namespace Isis { !(inputLabel->findObject("IsisCube").hasGroup("Mapping"))) return; PvlGroup &inputMapping = inputLabel->findGroup("Mapping", Pvl::Traverse); - addSchema("PDS4_CART_1700.sch", - "PDS4_CART_1700.xsd", + addSchema("PDS4_CART_1900.sch", + "PDS4_CART_1900.xsd", "xmlns:cart", "http://pds.nasa.gov/pds4/cart/v1"); diff --git a/isis/src/tgo/apps/tgocassisrdrgen/main.cpp b/isis/src/tgo/apps/tgocassisrdrgen/main.cpp index 30ce50c373..0619ae215b 100644 --- a/isis/src/tgo/apps/tgocassisrdrgen/main.cpp +++ b/isis/src/tgo/apps/tgocassisrdrgen/main.cpp @@ -99,7 +99,7 @@ void IsisMain() { // std PDS4 label process.StandardPds4Label(); - process.addSchema("PDS4_PSA_1000.sch", +/* process.addSchema("PDS4_PSA_1000.sch", "PDS4_PSA_1000.xsd", "xmlns:psa", "http://psa.esa.int/psa/v1"); @@ -107,12 +107,12 @@ void IsisMain() { process.addSchema("PDS4_PSA_EM16_CAS_1000.sch", "PDS4_PSA_EM16_CAS_1000.xsd", "xmlns", - "http://psa.esa.int/psa/em16/cas/v1"); + "http://psa.esa.int/psa/em16/cas/v1");*/ // Add geometry schema for mosaics if (label->findObject("IsisCube").hasGroup("Mosaic")) { - process.addSchema("PDS4_GEOM_1900_1510.sch", - "PDS4_GEOM_1900_1510.xsd", + process.addSchema("PDS4_GEOM_1B00_1610.sch", + "PDS4_GEOM_1B00_1610.xsd", "xmlns:geom", "https://pds.jpl.nasa.gov/datastandards/schema/released/geom/v1"); }