Commit 8e1761d6 authored by Jeannie Backer's avatar Jeannie Backer
Browse files

Add observationId to tgo import.

parent 10663193
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -105,18 +105,18 @@ namespace Isis {
   * Creates all parent PVL containers for an output keyword. If any parent
   * containers already exist then they will not be recreated.
   *
   * @param nName The name of the output keyword. The OutputPosition keyword
   *              in the translation group for nName will be used to determine
   * @param translationGroupName The name of the output keyword. The OutputPosition keyword
   *              in the translation group for translationGroupName will be used to determine
   *              which containers are made.
   * @param pvl The PVL file to create the containers in.
   *
   * @return @b PvlContainer The immediate parent container for nName.
   * @return @b PvlContainer The immediate parent container for translationGroupName.
   */
  PvlContainer *LabelTranslationManager::CreateContainer(const QString nName,
  PvlContainer *LabelTranslationManager::CreateContainer(const QString translationGroupName,
                                                         Pvl &pvl) {

    // Get the array of Objects/Groups from the OutputName keyword
    PvlKeyword np = OutputPosition(nName);
    PvlKeyword np = OutputPosition(translationGroupName);

    PvlObject *obj = &pvl;

+3 −3
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ namespace Isis {

      // Attempt to translate the requested output name to output value
      // using the input name and value/default value
      virtual QString Translate(QString nName, int findex = 0) = 0;
      virtual QString Translate(QString translationGroupName, int findex = 0) = 0;

      // Translate all translation table groups which contain "Auto"
      virtual void Auto(Pvl &outputLabel);
@@ -76,8 +76,8 @@ namespace Isis {
      virtual QStringList parseSpecification(QString specification) const;
    protected:

      virtual PvlKeyword DoTranslation(const QString nName);
      virtual PvlContainer *CreateContainer(const QString nName, Pvl &pvl);
      virtual PvlKeyword DoTranslation(const QString translationGroupName);
      virtual PvlContainer *CreateContainer(const QString translationGroupName, Pvl &pvl);
  };
};

+214 −185
Original line number Diff line number Diff line
@@ -408,37 +408,49 @@ namespace Isis {
  void ProcessExportPds4::standardBandBin() {
    Pvl *inputLabel = InputCubes[0]->label(); 
    if ( !inputLabel->findObject("IsisCube").hasGroup("BandBin") ) return;
    // Add header info
    addSchema("PDS4_IMG_1900.sch", 
              "PDS4_IMG_1900.xsd",
              "xmlns:img", 
              "http://pds.nasa.gov/pds4/img/v1"); 
    
    // Spectra
    // Get the input Isis cube label and find the BandBin group if it has one
    QString translationFile = "$base/translations/";
    if (m_imageType == StandardImage) {
      translationFile += "pds4ExportBandBinImage.trn";
      imageBandBin();
    }
    else if (m_imageType == UniformlySampledSpectrum) {
      translationFile += "pds4ExportBandBinSpectrumUniform.trn";
    else {
      // Add header info
      addSchema("PDS4_SP_1100.sch", 
                "PDS4_SP_1100.xsd",
                "xmlns:sp", 
                "http://pds.nasa.gov/pds4/sp/v1");
      if (m_imageType == UniformlySampledSpectrum) {
        imageBandBinSpectrum();
      }
      else if (m_imageType == BinSetSpectrum) {
      translationFile += "pds4ExportBandBinSpectrumBinSet.trn";
        imageBandBinSpectrumBinSet();
      }
    }
  }


  void ProcessExportPds4::translateBandBinImage() {
    QString translationFile = "$base/translations/";
    translationFile += "pds4ExportBandBinImage.trn";
    FileName translationFileName(translationFile);
    PvlToXmlTranslationManager xlator(*inputLabel, translationFileName.expanded());
    xlator.Auto(*m_domDoc);

    if (m_imageType == StandardImage) {
      // Add header info
      addSchema("PDS4_IMG_1900.sch", 
                "PDS4_IMG_1900.xsd",
                "xmlns:img", 
                "http://pds.nasa.gov/pds4/img/v1"); 
  }
    else { // spectral


  void ProcessExportPds4::translateBandBinSpectrumUniform() {
    QString translationFile = "$base/translations/";
    translationFile += "pds4ExportBandBinSpectrumUniform.trn";
    FileName translationFileName(translationFile);
    PvlToXmlTranslationManager xlator(*inputLabel, translationFileName.expanded());
    xlator.Auto(*m_domDoc);

    PvlGroup bandBinGroup = inputLabel->findObject("IsisCube").findGroup("BandBin");
      // Add header info
      addSchema("PDS4_SP_1100.sch", 
                "PDS4_SP_1100.xsd",
                "xmlns:sp", 
                "http://pds.nasa.gov/pds4/sp/v1");
    // fix multi-valued bandbin info
    QStringList xmlPath;
    xmlPath << "Product_Observational"
@@ -452,7 +464,6 @@ namespace Isis {
    // required - bin_sequence_number, center_value, bin_width
    // optional - detector_number, grating_position, original_bin_number, scaling_factor, value_offset, Filter
    // ... see schema for more...
      if (m_imageType == BinSetSpectrum) {
    PvlKeyword center;
    if (bandBinGroup.hasKeyword("Center")) {
      center = bandBinGroup["Center"];
@@ -567,8 +578,27 @@ namespace Isis {
        }
      }
    }
    
  }
      else if (m_imageType == UniformlySampledSpectrum) {


  void ProcessExportPds4::translateBandBinSpectrumBinSet() {
    QString translationFile = "$base/translations/";
    translationFile += "pds4ExportBandBinSpectrumBinSet.trn";
    FileName translationFileName(translationFile);
    PvlToXmlTranslationManager xlator(*inputLabel, translationFileName.expanded());
    xlator.Auto(*m_domDoc);

    PvlGroup bandBinGroup = inputLabel->findObject("IsisCube").findGroup("BandBin");
    // fix multi-valued bandbin info
    QStringList xmlPath;
    xmlPath << "Product_Observational"
            << "Observation_Area"
            << "Discipline_Area"
            << "sp:Spectral_Characteristics";
    QDomElement baseElement = m_domDoc->documentElement();
    QDomElement spectralCharElement = getElement(xmlPath, baseElement);

    // Axis_Uniformly_Sampled
    // required - sampling_parameter_type (frequency, wavelength, wavenumber)
    //            sampling_interval (units Hz, Angstrom, cm**-1, respectively)
@@ -610,8 +640,7 @@ namespace Isis {
    QDomElement lastCenterElement = m_domDoc->createElement("sp:last_center_value");
    PvlToXmlTranslationManager::setElementValue(lastCenterElement, lastCenter);
    spectralCharElement.appendChild(lastCenterElement);
      }
    }
    
  }


+3 −0
Original line number Diff line number Diff line
@@ -125,6 +125,9 @@ namespace Isis {
      QString PDS4PixelType(PixelType pixelType, ByteOrder endianType);
      static QMap<QString, QString> createUnitMap(Pvl configPvl);
      static void translateChildUnits(QDomElement parent, QMap<QString, QString> transMap);
      void translateBandBinImage();
      void translateBandBinSpectrumUniform();
      void translateBandBinSpectrumBinSet();

      QDomDocument *m_domDoc;               //!< XML label.
      QString m_schemaLocation;             //!< QString with all schema locations required.
+3 −3
Original line number Diff line number Diff line
@@ -74,17 +74,17 @@ namespace Isis {

      // Attempt to translate the requested output name to output value
      // using the input name and value/default value
      virtual QString Translate(QString nName, int inputIndex = 0);
      virtual QString Translate(QString translationGroupName, int inputIndex = 0);

      // Translate all translation table groups which contain "Auto"
      void Auto(QDomDocument &outputLabel);
      void Auto(Pvl &inputLabel, QDomDocument &outputLabel);

      // Return the ith input value associated with a output name
      virtual const PvlKeyword &InputKeyword(const QString nName) const;
      virtual const PvlKeyword &InputKeyword(const QString translationGroupName) const;

      // Return true if the input lable contains the translated group and key names
      virtual bool InputHasKeyword(const QString nName);
      virtual bool InputHasKeyword(const QString translationGroupName);

      void SetLabel(Pvl &inputLabel);
      
Loading