Commit 963d7888 authored by Kristin's avatar Kristin Committed by Summer Stapleton
Browse files

tgocassisrdrgen exported label re-order. (#3135)

* Add 32-bit ISIS Special Pixel Constants to ProcessExportPds4

* Add ability to set title and version id in exported PDS4 produce in tgocassisrdrgen and ProcessExportPds4 API

* 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

* Added docs.

* Update schema to most recent versions and comment-out schema that isn't used (temporarily) in tgocassisrdrgen.

* Added reorder function to ProcessExportPds4 to reorder xml files generated in the wrong order for PDS4 and added cassis-specific schema
parent 6a535174
Loading
Loading
Loading
Loading
+63 −5
Original line number Diff line number Diff line
@@ -235,7 +235,6 @@ namespace Isis {
            QString timeValue = stopTime.text();
            PvlToXmlTranslationManager::resetElementValue(stopTime, timeValue + "Z");
          }
      
        }
      
        QDomElement obsSysNode = obsAreaNode.firstChildElement("Observing_System");
@@ -277,14 +276,12 @@ namespace Isis {
      // move target to just below Observing_System. 
      QDomElement targetIdNode = obsAreaNode.firstChildElement("Target_Identification");
      obsAreaNode.insertAfter(targetIdNode, obsAreaNode.firstChildElement("Observing_System"));

    }
    else if (inputLabel->findObject("IsisCube").hasGroup("Mapping")) {

      translationFileName = "$base/translations/pds4ExportTargetFromMapping.trn"; 
      PvlToXmlTranslationManager targXlator(*inputLabel, translationFileName.expanded());
      targXlator.Auto(*m_domDoc);

    }
    else {
      throw IException(IException::Unknown, "Unable to find a target in input cube.", _FILEINFO_);
@@ -292,11 +289,72 @@ namespace Isis {
  }


 /**
   * This method reorders the existing m_domDoc to follow PDS4 standards and fixes time formatting
   * if needed.
   */
  void ProcessExportPds4::reorder() {
      QDomElement obsAreaNode = m_domDoc->documentElement().firstChildElement("Observation_Area");
      if ( !obsAreaNode.isNull() ) {

        // fix start/stop times, if needed
        QDomElement timeNode = obsAreaNode.firstChildElement("Time_Coordinates");
        if (!timeNode.isNull()) {
          QDomElement startTime = timeNode.firstChildElement("start_date_time");
          if (startTime.text() == "") {
            startTime.setAttribute("xsi:nil", "true");
          }
          else {
            QString timeValue = startTime.text();
            PvlToXmlTranslationManager::resetElementValue(startTime, timeValue + "Z");
          }
          QDomElement stopTime  = timeNode.firstChildElement("stop_date_time"); 
          if (stopTime.text() == "") {
            stopTime.setAttribute("xsi:nil", "true");
          }
          else {
            QString timeValue = stopTime.text();
            PvlToXmlTranslationManager::resetElementValue(stopTime, timeValue + "Z");
          }
        }
        QDomElement investigationAreaNode = obsAreaNode.firstChildElement("Investigation_Area");
        obsAreaNode.insertAfter(investigationAreaNode, obsAreaNode.firstChildElement("Time_Coordinates"));

        QDomElement obsSystemNode = obsAreaNode.firstChildElement("Observing_System");
        obsAreaNode.insertAfter(obsSystemNode, obsAreaNode.firstChildElement("Investigation_Area"));

        QDomElement targetIdNode = obsAreaNode.firstChildElement("Target_Identification");
        obsAreaNode.insertAfter(targetIdNode, obsAreaNode.firstChildElement("Observing_System"));

        QDomElement missionAreaNode = obsAreaNode.firstChildElement("Mission_Area");
        obsAreaNode.insertAfter(missionAreaNode, obsAreaNode.firstChildElement("Target_Identification"));

        QDomElement disciplineAreaNode = obsAreaNode.firstChildElement("Discipline_Area");
        obsAreaNode.insertAfter(disciplineAreaNode, obsAreaNode.firstChildElement("Mission_Area"));
      }

      QDomElement identificationAreaNode = m_domDoc->documentElement().firstChildElement("Identification_Area");
      if ( !identificationAreaNode.isNull() ) {
        QDomElement aliasListNode = identificationAreaNode.firstChildElement("Alias_List");
        identificationAreaNode.insertAfter(aliasListNode, identificationAreaNode.firstChildElement("product_class"));
      }

      QDomElement fileAreaObservationalNode = m_domDoc->documentElement().firstChildElement("File_Area_Observational");
      QDomElement array2DImageNode = fileAreaObservationalNode.firstChildElement("Array_2D_Image");
      if ( !array2DImageNode.isNull() ) {
        QDomElement descriptionNode = array2DImageNode.firstChildElement("description");
        array2DImageNode.insertAfter(descriptionNode, array2DImageNode.firstChildElement("axis_index_order"));
      }
  }

  /**
   * Allows mission specific programs to set logical_identifier 
   * required for PDS4 labels. This value is added to the xml file 
   * by the identificationArea() method. 
   *  
   * The input value will be converted to all-lowercase if not already 
   * in line with PDS4 requirements.  
   *  
   * The input string should be colon separated string with 6 
   * identifiers: 
   *  
@@ -318,7 +376,7 @@ namespace Isis {
   *            compliant labels.
   */
  void ProcessExportPds4::setLogicalId(QString lid) {
    m_lid = lid;
    m_lid = lid.toLower();
  }


+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ namespace Isis {

      static void translateUnits(QDomDocument &label,
                                 QString transMapFile = "$base/translations/pds4ExportUnits.pvl");

      void reorder();
      void addSchema(QString sch, QString xsd, QString xmlns, QString xmlnsURI) ;
    protected:
      void identificationArea();
+5 −1
Original line number Diff line number Diff line
@@ -109,6 +109,10 @@ void IsisMain() {
                    "xmlns",
                    "http://psa.esa.int/psa/em16/cas/v1");*/

  process.addSchema("CASSIS_1010.sch", 
                    "CASSIS_1010.xsd",
                    "xmlns:cassis",
                    "local");
  // Add geometry schema for mosaics
  if (label->findObject("IsisCube").hasGroup("Mosaic")) {
    process.addSchema("PDS4_GEOM_1B00_1610.sch", 
@@ -117,7 +121,6 @@ void IsisMain() {
                      "https://pds.jpl.nasa.gov/datastandards/schema/released/geom/v1");
  }


 /*
  * Add additional pds label data here
  */
@@ -135,6 +138,7 @@ void IsisMain() {
  cubeLab.Auto(pdsLabel);

  ProcessExportPds4::translateUnits(pdsLabel);
  process.reorder(); 

  QString outFile = ui.GetFileName("TO");