diff --git a/isis/src/mro/apps/hidtmgen/hidtmgen.cpp b/isis/src/mro/apps/hidtmgen/hidtmgen.cpp new file mode 100644 index 0000000000..5a8d145cb5 --- /dev/null +++ b/isis/src/mro/apps/hidtmgen/hidtmgen.cpp @@ -0,0 +1,826 @@ +#include +#include +#include + +#include "hidtmgen.h" +#include "Cube.h" +#include "CubeAttribute.h" +#include "FileName.h" +#include "FileList.h" +#include "IString.h" +#include "ProcessExportPds.h" +#include "TProjection.h" +#include "ProjectionFactory.h" +#include "Pvl.h" +#include "PvlFormatPds.h" +#include "PvlKeyword.h" +#include "PvlObject.h" +#include "SpecialPixel.h" +#include "Statistics.h" +#include "UserInterface.h" + +using namespace std; + + +namespace Isis{ + /** + * Indicates the type of file currently being processed for export to PDS. + */ + enum FileType { DTM, /**< The output file for the current process is a DTM.*/ + Orthorectified /**< The output file for the current process is an Ortho.*/ + }; + + + /** + * This enumeration is used to determine how to set the special pixel types + * selected by the user. + * + * If the output data is non-negative, then Both is set. This means that Null, + * Lrs, and Lis (if selected) will be given the values of the lower boundary + * (i.e. beginning at 0) and that His and Hrs (if selected) will be given the + * values of the upper boundary (i.e. for 8bit, values near 255 and for 16bit, + * values near 65535). + * + * If the output data is signed integer data, then Negative is set. This means + * that all special pixels (if selected) will be given values of the lower + * boundary (i.e. beginning -32768). + * + * If the output data is real-valued, then Default is set. This means that the + * special pixels defined in Isis::SpecialPixel will be used. + * + */ + enum SpecialPixelBoundary { Both, /**< Both the upper and lower boundaries may be used to save + off special pixel values. This option is used for + unsigned bit integer valued output data types + (i.e. 8bit and unsigned 16bit)*/ + Negative, /**< Only the lower (negative) boundary may be used to save + off special pixel values. This option is used for signed + 16 bit integer valued output data.*/ + Default /**< This option is used for real valued output data types + (i.e. 32bit). In this case pre-defined + Isis::SpecialPixel values are dedicated to the selected + pixel types.*/ + }; + + + // -------------------------Function Prototypes ------------------------------------ + // cube processing + void setUpProcessPixels(const UserInterface &ui, + ProcessExportPds &pdsExportProcess, + FileType fileType); + void setRangeAndPixels(const UserInterface &ui, + ProcessExportPds &pdsExportProcess, + double &min, + double &max, + SpecialPixelBoundary ptype); + void processCube(ProcessExportPds &pdsExportProcess, + const FileName &outputPdsFile); + // projection information and viewing parameters + void setProjectionInformation(Cube *inCube, + Pvl &pdsLabel, + PvlObject &mappingObject, + const QString &projectionType); + void setEquirectangularRadii(Cube *inCube, + PvlObject &mappingObject); + double polarStereoGraphicNorthAzimuth(const PvlObject &mappingObject); + // find codes needed for product id + char mapScaleCode(double scale); + QString dtmSourceOrbitAndTargetCodes(const PvlKeyword &sourceKeyword); + QString versionNumber(const Pvl ¶msPvl, + const UserInterface &ui); + QString producingInstitution(const Pvl ¶msPvl, + const UserInterface &ui); + QString orthoContentColorCode(const FileName &orthoFileName); + // find/set values needed for output labels + void setIdentificationInformation(Pvl &pdsLabel, + const QString &productId, + PvlKeyword sourceProductId, + const Pvl ¶msPvl, + const UserInterface &ui); + // dtm specific calls + void verifyDTM(Cube *inCube, + const FileName &inputCubeFile); + void customizeDtmLabels(Cube *inCube, + Pvl &dtmPdsLabel, + PvlObject &mappingObject); + // ------------------------- end Function Prototypes --------------------------------- + + + // Main + void hidtmgen(UserInterface &ui) { + try { + // -------------------------------------------------------------------------// + // Get required global ui... + // -------------------------------------------------------------------------// + Pvl paramsPvl(ui.GetFileName("PARAMSPVL")); + bool defaultNames = ui.GetBoolean("DEFAULTNAMES"); + + // parameters: + // * DTM (not required) if entered, set as input cube in process + // * ORTHOFROMLIST (not required) if entered, set as input cubes in process + // + // * DEFAULTNAMES (required) if true, generates output file names and product ids + // * OUTPUTDIR (not required) only used (still not required) if defaultnames=true + // * DTMTO (not required) required when defaultnames=false and dtm was given. + // * ORTHOTOLIST (not required) required when DEFAULTNAMES=false and ORTHOFROMLIST was given. + // if entered, size must match ORTHOFROMLIST + // + // * PARAMSPVL (required) + // * DTM_PRODUCT_ID (not required) required if DTM given and DEFAULTNAMES=false + // * ORTHOPRODUCTIDLIST (not required) required if DTM given and DEFAULTNAMES=false + // if entered, size must match ORTHOFROMLIST + // * ORTHOSEQUENCENUMBERLIST (not required) required if DTM given and DEFAULTNAMES=false + // if entered, size must match ORTHOFROMLIST + // + // * ENDIAN (required) + // + // * DTMBITTYPE required if DTM + // * ORTHOBITTYPE required if ORTHOFROMLIST + // * NULL (not required) + // * LRS (not required) + // * LIS (not required) + // * HIS (not required) + // * HRS (not required) + + + // -------------------------------------------------------------------------// + // Set up Process... + // -------------------------------------------------------------------------// + ProcessExportPds pdsExportProcess; + // Set ExportType and Endian for all output + pdsExportProcess.SetExportType(ProcessExportPds::Fixed); + if (ui.GetString("ENDIAN") == "MSB") { + pdsExportProcess.SetOutputEndian(Isis::Msb); + } + else if (ui.GetString("ENDIAN") == "LSB") { + pdsExportProcess.SetOutputEndian(Isis::Lsb); + } + // -------------------------------------------------------------------------// + // -------------------------------------------------------------------------// + + // The output directory will be used for DTM and ortho images when defaultNames=true + // this directory won't be used if defaultNames=false but will be used for + // both DTM and ortho if defaultNames=true. + FileName outFile; + QString outDirString; + FileName outDir = FileName(ui.GetString("OUTPUTDIR")); + if (!outDir.fileExists()) { + outDir.dir().mkpath("."); + } + outDirString = outDir.expanded(); + if (outDirString.mid(outDirString.size()-1, 1) != "/") { + outDirString += "/"; + outDir = FileName(outDirString); + } + outDirString = outDir.expanded(); + + // if DTM provided, PRODUCT_ID will also be used for ortho SOURCE_PRODUCT_IDs + QString dtmProductId = ""; + if (ui.WasEntered("DTM")) { + setUpProcessPixels(ui, pdsExportProcess, DTM); + // set the input cube to process + CubeAttributeInput inAttribute; + Cube *inCube = pdsExportProcess.SetInputCube(ui.GetFileName("DTM"), inAttribute); + verifyDTM(inCube, ui.GetFileName("DTM")); + + // These are our output labels, will be modifying heavily + Pvl &pdsLabel = pdsExportProcess.StandardPdsLabel(ProcessExportPds::Image); + PvlObject &mappingObject = pdsLabel.findObject("IMAGE_MAP_PROJECTION"); + QString projectionType = mappingObject["MAP_PROJECTION_TYPE"][0]; + setProjectionInformation(inCube, pdsLabel, mappingObject, projectionType); + customizeDtmLabels(inCube, pdsLabel, mappingObject); + + // if the DTM was given, use the SOURCE_PRODUCT_ID supplied by the user. + PvlKeyword source = paramsPvl.findKeyword("DTM_SOURCE_PRODUCT_ID", PvlObject::Traverse); + source.setName("SOURCE_PRODUCT_ID"); + + if (defaultNames) { + dtmProductId = "DT"; + dtmProductId += "E";// for now this is hard-coded to E for elevations (see xml doc) + dtmProductId += projectionType[0].toUpper(); + dtmProductId += mapScaleCode(mappingObject.findKeyword("MAP_SCALE")); + dtmProductId += "_"; + dtmProductId += dtmSourceOrbitAndTargetCodes(source); + // Get the 1-character producing institution code from the PARAMSPVL and add it + dtmProductId += producingInstitution(paramsPvl, ui); + // Get the 2-character version number from the PARAMSPVL and add it + dtmProductId += versionNumber(paramsPvl, ui); + + outFile = FileName(outDirString + dtmProductId + ".IMG"); + } + else { + dtmProductId = ui.GetString("DTM_PRODUCT_ID"); + outFile = FileName(ui.GetFileName("DTMTO")); + } // End scope of defaultNames true + + // identification labels that are pretty set in stone + setIdentificationInformation(pdsLabel, dtmProductId, source, paramsPvl, ui); + processCube(pdsExportProcess, outFile); + if (!outFile.fileExists()) { + throw IException(IException::Unknown, + QString("DTM file [%1] failed to be created.").arg(outFile.expanded()), + _FILEINFO_); + } + } // end if DTM was entered + else if (!ui.WasEntered("ORTHOFROMLIST")) { + throw IException(IException::User, + "User must supply DTM or ORTHOFROMLIST or both.", + _FILEINFO_); + } + + /* + * End of DTM work. Labels are complete, names complete, it's written out. + */ + + + // Now we take care of ortho images, if given. + // Get the list of ortho input cubes + if (ui.WasEntered("ORTHOFROMLIST")) { + + FileList orthoFromList; + orthoFromList.read(FileName(ui.GetFileName("ORTHOFROMLIST"))); + if(orthoFromList.size() == 0) { + throw IException(IException::User, "Input ortho list is empty.", _FILEINFO_); + } + + // check corresponding input lists for matching sizes... + FileList orthoToList, orthoProductIdList, orthoSequenceNumberList; + if (defaultNames) { + // if creating default output file names and product ids then we need to get the list of + // ortho sequence numbers + orthoSequenceNumberList.read(FileName(ui.GetFileName("ORTHOSEQUENCENUMBERLIST"))); + if(orthoFromList.size() != orthoSequenceNumberList.size()) { + throw IException(IException::User, "Output sequence number list must " + "correspond to the input ortho list.", _FILEINFO_); + } + } + else { + // if not creating default names, get the lists of ortho output cube names and product ids + orthoToList.read(FileName(ui.GetFileName("ORTHOTOLIST"))); + orthoProductIdList.read(FileName(ui.GetFileName("ORTHOPRODUCTIDLIST"))); + if(orthoFromList.size() != orthoToList.size() + || orthoFromList.size() != orthoProductIdList.size()) { + throw IException(IException::User, + "Output ortho list and product id list must " + "correspond to the input ortho list.", + _FILEINFO_); + } + } + + ProcessExportPds orthoExportProcess; + // Set ExportType and Endian for all output + orthoExportProcess.SetExportType(ProcessExportPds::Fixed); + if (ui.GetString("ENDIAN") == "MSB") { + orthoExportProcess.SetOutputEndian(Isis::Msb); + } + else if (ui.GetString("ENDIAN") == "LSB") { + orthoExportProcess.SetOutputEndian(Isis::Lsb); + } + + setUpProcessPixels(ui, orthoExportProcess, Orthorectified); + + // Loop through all ortho images + for (int i = 0; i < orthoFromList.size(); i++) { + + // set the input cube to process + CubeAttributeInput att(orthoFromList[i]); + Cube *inCube = orthoExportProcess.SetInputCube(orthoFromList[i].expanded(), att); + + // get the cube label and set identification info + Pvl &pdsLabel = orthoExportProcess.StandardPdsLabel(ProcessExportPds::Image); + + // set map projection information + PvlObject &mappingObject = pdsLabel.findObject("IMAGE_MAP_PROJECTION"); + QString projectionType = mappingObject["MAP_PROJECTION_TYPE"][0]; + setProjectionInformation(inCube, pdsLabel, mappingObject, projectionType); + + QString productId = ""; + QString orthoId = ""; + if (defaultNames) { + orthoId = orthoFromList[i].baseName().left(15); + productId = orthoId; + productId += "_"; + productId += orthoContentColorCode(orthoFromList[i]); + productId += "_"; + productId += mapScaleCode(mappingObject.findKeyword("MAP_SCALE")); + productId += "_"; + productId += orthoSequenceNumberList[i].expanded(); + productId += "_"; + productId += "ORTHO"; + + // output file path is the same as the dtm + outFile = FileName(outDirString + productId + ".IMG"); + } + else { + productId = orthoProductIdList[i].expanded(); + outFile = orthoToList[i]; + orthoId = productId; + } + + // for ortho images, source product ID is the DTM product ID followed by the + // ORTHO product ID + PvlKeyword source("SOURCE_PRODUCT_ID"); + if (dtmProductId.isEmpty()) { + source += paramsPvl["ORTHO_SOURCE_DTM_ID"]; + } + else { + source += dtmProductId; + } + source += orthoId; + setIdentificationInformation(pdsLabel, productId, source, paramsPvl, ui); + + processCube(orthoExportProcess, outFile); + if (!outFile.fileExists()) { + throw IException(IException::Unknown, + QString("DTM file [%1] failed to be created.").arg(outFile.expanded()), + _FILEINFO_); + } + + } // End scope of for loop for ortho images + } + } + catch (IException &e) { + throw IException(e, IException::Unknown, "hidtmgen: Unable to HiRISE generate pds products.", _FILEINFO_); + } + }// end main + + + void setUpProcessPixels(const UserInterface &ui, + ProcessExportPds &pdsExportProcess, + FileType fileType) { + double min = -DBL_MAX; + double max = DBL_MAX; + + // Setup output type + QString parameterPrefix = "DTM"; + if (fileType == Orthorectified) { + parameterPrefix = "ORTHO"; + } + QString bitType = ui.GetString(parameterPrefix + "BITTYPE"); + if (bitType == "8BIT") { + pdsExportProcess.SetOutputType(Isis::UnsignedByte); + min = 0.0; + max = 255.0; + setRangeAndPixels(ui, pdsExportProcess, min, max, Both); + } + else if (bitType == "S16BIT") { + pdsExportProcess.SetOutputType(Isis::SignedWord); + min = -32768.0; + max = 32767.0; + setRangeAndPixels(ui, pdsExportProcess, min, max, Negative); + } + else if (bitType == "U16BIT") { + pdsExportProcess.SetOutputType(Isis::UnsignedWord); + min = 0.0; + max = 65535.0; + setRangeAndPixels(ui, pdsExportProcess, min, max, Both); + } + else { // default 32 bit + pdsExportProcess.SetOutputType(Isis::Real); + pdsExportProcess.SetOutputNull(Isis::NULL4); + pdsExportProcess.SetOutputLrs(Isis::LOW_REPR_SAT4); + pdsExportProcess.SetOutputLis(Isis::LOW_INSTR_SAT4); + pdsExportProcess.SetOutputHrs(Isis::HIGH_REPR_SAT4); + pdsExportProcess.SetOutputHis(Isis::HIGH_INSTR_SAT4); + setRangeAndPixels(ui, pdsExportProcess, min, max, Default); + } + + } + + + //Sets up special pixels and valid pixel ranges + void setRangeAndPixels(const UserInterface &ui, + ProcessExportPds &pdsExportProcess, + double &min, double &max, + SpecialPixelBoundary ptype) { + + if (ptype == Negative) { + // if we are dedicating the passed in min to be null, + // 1. set output null to that value + // 2. update the min to min+1 + // i.e. for SignedWord, null=-32768.0, min=-32767.0 + if (ui.GetBoolean("NULL")) { + pdsExportProcess.SetOutputNull(min++); + } + // if we are dedicating the current min value to be lrs, + // 1. set output lrs to that value + // 2. update the min to min+1 + if (ui.GetBoolean("LRS")) { + pdsExportProcess.SetOutputLrs(min++); + } + if (ui.GetBoolean("LIS")) { + pdsExportProcess.SetOutputLis(min++); + } + if (ui.GetBoolean("HIS")) { + pdsExportProcess.SetOutputHis(min++); + } + if (ui.GetBoolean("HRS")) { + pdsExportProcess.SetOutputHrs(min++); + } + } + else if (ptype == Both) { + // if we are dedicating the passed in min to be null, + // 1. set output null to that value + // 2. update the min to min+1 + if (ui.GetBoolean("NULL")) { + pdsExportProcess.SetOutputNull(min++); + } + // if we are dedicating the current min value to be lrs, + // 1. set output lrs to that value + // 2. update the min to min+1 + if (ui.GetBoolean("LRS")) { + pdsExportProcess.SetOutputLrs(min++); + } + // if we are dedicating the current min value to be lis, + // 1. set output lis to that value + // 2. update the min to min+1 + if (ui.GetBoolean("LIS")) { + pdsExportProcess.SetOutputLis(min++); + } + // if we are dedicating the max value to be hrs, + // 1. set output hrs to that value + // 2. update the max to max-1 + if (ui.GetBoolean("HRS")) { + pdsExportProcess.SetOutputHrs(max--); + } + // if we are dedicating the current max value to be his, + // 1. set output his to that value + // 2. update the max to max-1 + if (ui.GetBoolean("HIS")) { + pdsExportProcess.SetOutputHis(max--); + } + } + pdsExportProcess.SetOutputRange(min, max); + } + + + void processCube(ProcessExportPds &pdsExportProcess, const FileName &outputPdsFile) { + ofstream pdsOut(outputPdsFile.expanded().toLatin1().data()); + pdsExportProcess.OutputLabel(pdsOut); + pdsExportProcess.StartProcess(pdsOut); + pdsOut.close(); + pdsExportProcess.EndProcess(); + pdsExportProcess.ClearInputCubes(); + } + + + void setProjectionInformation(Cube *inCube, Pvl &pdsLabel, + PvlObject &mappingObject, const QString &projectionType) { + + // set map projection information + mappingObject.addKeyword(PvlKeyword("^DATA_SET_MAP_PROJECTION", "DSMAP.CAT")); + // initialize the azimuth to a Null value so we can check whether it was set. + double northAzimuth = Isis::Null; + // now find the northAzimuth based on projection type + if (QString::compare(projectionType, "EQUIRECTANGULAR", Qt::CaseInsensitive) == 0) { + setEquirectangularRadii(inCube, mappingObject); + mappingObject["MAP_PROJECTION_TYPE"].setValue("\"EQUIRECTANGULAR\""); + northAzimuth = 270; + pdsLabel.setFormatTemplate("$ISISROOT/appdata/translations/MroHirisePdsDTMEqui.pft"); + } + else if (QString::compare(projectionType, "POLAR STEREOGRAPHIC", Qt::CaseInsensitive) == 0) { + northAzimuth = polarStereoGraphicNorthAzimuth(mappingObject); + pdsLabel.setFormatTemplate("$ISISROOT/appdata/translations/MroHirisePdsDTMPolar.pft"); + } + else { + QString msg = "The projection type [" + + projectionType + + "] is not supported"; + throw IException(IException::User, msg, _FILEINFO_); + } + + PvlObject viewingParameters("VIEWING_PARAMETERS"); + if (northAzimuth != Isis::Null) { + viewingParameters.addKeyword(PvlKeyword("NORTH_AZIMUTH", toString(northAzimuth), "DEG")); + } + else { + viewingParameters.addKeyword(PvlKeyword("NORTH_AZIMUTH", "N/A")); + } + pdsLabel.addObject(viewingParameters); + + } + + + void setEquirectangularRadii(Cube *inCube, PvlObject &mappingObject) { + TProjection *proj = (TProjection *) ProjectionFactory::CreateFromCube(*inCube); + double newRadius = proj->LocalRadius((double)mappingObject["CENTER_LATITUDE"]); + newRadius /= 1000; + mappingObject.findKeyword("A_AXIS_RADIUS").setValue(toString(newRadius)); + mappingObject.findKeyword("A_AXIS_RADIUS").setUnits("KM"); + mappingObject.findKeyword("B_AXIS_RADIUS").setValue(toString(newRadius)); + mappingObject.findKeyword("B_AXIS_RADIUS").setUnits("KM"); + mappingObject.findKeyword("C_AXIS_RADIUS").setValue(toString(newRadius)); + mappingObject.findKeyword("C_AXIS_RADIUS").setUnits("KM"); + } + + + double polarStereoGraphicNorthAzimuth(const PvlObject &mappingObject) { + + double northAzimuth = Isis::Null; + if (mappingObject.hasKeyword("MINIMUM_LATITUDE") + && mappingObject.hasKeyword("MAXIMUM_LATITUDE") + && mappingObject.hasKeyword("EASTERNMOST_LONGITUDE") + && mappingObject.hasKeyword("WESTERNMOST_LONGITUDE")) { + + // find the center latitude of this set of images + // (not the same as the center lat for the projection) + double clat = ((toDouble(mappingObject["MAXIMUM_LATITUDE"][0]) - + toDouble(mappingObject["MINIMUM_LATITUDE"][0])) / 2) + + toDouble(mappingObject["MINIMUM_LATITUDE"][0]); + // find the center longitude of this set of images + // (not the same as the center lon for the projection) + double clon = ((toDouble(mappingObject["EASTERNMOST_LONGITUDE"][0]) - + toDouble(mappingObject["WESTERNMOST_LONGITUDE"][0])) / 2) + + toDouble(mappingObject["WESTERNMOST_LONGITUDE"][0]); + + if (clat > 0.0 && clon < 270.0) { // Northern Hemisphere, 0 to 270 lon + northAzimuth = 270.00 - clon; + } + else if (clat > 0.0 && clon >= 270.0) { // Northern Hemisphere, 270 to 360 lon + northAzimuth = 360.00 + (270.00 - clon); + } + else if (clat < 0.0 && clon < 90.0) { // Southern Hemisphere, 0 to 90 lon + northAzimuth = 270.00 + clon; + } + else if (clat < 0.0 && clon >= 90.0) { // Southern Hemisphere, 90 to 360 lon + northAzimuth = -(360.00 - (270.00 + clon)); + } + } + return northAzimuth; + + } + + + /* + * Scale letter of the image, A = 0.25, B = 0.5, C = 1.0, and so on. + * We are using a 10% fudge range. + */ + char mapScaleCode(double scale) { + int steps = 0; + double matchNum = 0.25; + double epsilon = matchNum * 0.1; // = 10% of matchNum + + bool bounded = false; + while (!bounded) { + if ((scale + epsilon) > matchNum && (scale - epsilon) < matchNum) { + bounded = true; + } + else { + steps++; + } + + // Increase to next possible scale and increase epsilon + matchNum *= 2; + epsilon *= 2; + + if (matchNum > 129) { // Max allowed is J, 128, before skipping to Z + bounded = true; + steps = 25; // Get us to 'Z' + } + } + char scaleLetter = 'A'; + // For however many steps we took, increase the letter. + scaleLetter += steps; + // 0.25 = A, 0.5 = B, 1.0 = C... + return scaleLetter; + } + + + QString dtmSourceOrbitAndTargetCodes(const PvlKeyword &sourceKeyword) { + // we use the source product id for the DTM to get the orbit IDs and target code + // for the source products (i.e. the stereo pair) + return sourceKeyword[0].mid(4,11) + "_" + + sourceKeyword[1].mid(4,12) + "_"; + } + + + QString versionNumber(const Pvl ¶msPvl, const UserInterface &ui) { + double version = toDouble(paramsPvl["PRODUCT_VERSION_ID"]); + + // Format the version for the output name: + // Only important thing to note is that a #.0 number is converted to 0# + // for the name, otherwise, it is predictable, always 2 greatest numbers: + // ##. + // >10, takes first two digits + // The number found here is used in ortho images as well. + QString vers = ""; + if (version >= 10.0) { + vers = toString(version).left(2); + } + else if (version >= 1.0) { + vers = toString(version); + bool wasInt = false; + // Checking for integer values, if so, make #.0 into 0# + // necessary because in DTMgen version 1.0 corresponded to a 01 in names. + if (vers.size() == 3) { + if (vers.at(2) == '0') { + vers = "0" + vers.left(1); + wasInt = true; + } + } + // Wasn't int, make #.# into ## + if (!wasInt) { + vers = toString(version).remove(QChar('.')); + if (vers.size() > 2) { + vers = vers.left(2); + } + } + } + // 0 - <1, if 0.#, is 0#, is 0.#####, is first two ## + else if (version >= 0.001) { // Any less and we get E... not dealing with that. + vers = toString(version).remove(QChar('.')); + int nonZero = vers.lastIndexOf("0"); + if (vers.size() > 2) { + vers = vers.mid(nonZero+1, 2); + } + } + // It was negative, or something else crazy? + else { + QString msg = "Version number [" + toString(version) + "] is invalid"; + throw IException(IException::User, msg, _FILEINFO_); + } + return vers; + } + + + QString producingInstitution(const Pvl ¶msPvl, const UserInterface &ui) { + QString producing = paramsPvl["PRODUCING_INSTITUTION"][0]; + if (producing.size() > 1) { + QString msg = "PRODUCING_INSTITUTION value [" + producing + "] in the PARAMSPVL file must be a " + "single character. See hidtmgen documentation for these character codes."; + throw IException(IException::User, msg, _FILEINFO_); + } + return producing; + } + + + QString orthoContentColorCode(const FileName &orthoFileName) { + QString colorCode = ""; + Cube orthoCube(orthoFileName, "r"); + if (orthoCube.bandCount() == 1) { + colorCode = "RED"; + } + else if (orthoCube.bandCount() == 3) { + colorCode = "IRB"; + } + else { + QString msg = "The file [" + orthoFileName.expanded() + "] found in the ORTHOFROMLIST " + "is not a valid orthorectified image. Band count must be 1 (RED) or 3 (color)."; + throw IException(IException::User, msg, _FILEINFO_); + } + return colorCode; + } + + + void setIdentificationInformation(Pvl &pdsLabel, + const QString &productId, + PvlKeyword sourceProductId, + const Pvl ¶msPvl, + const UserInterface &ui) { + // These come from the user (PARAMSPVL) + pdsLabel.addKeyword(paramsPvl["DATA_SET_ID"]); + pdsLabel.addKeyword(paramsPvl["DATA_SET_NAME"]); + pdsLabel.addKeyword(paramsPvl["PRODUCER_INSTITUTION_NAME"]); + pdsLabel.addKeyword(paramsPvl["PRODUCER_ID"]); + pdsLabel.addKeyword(paramsPvl["PRODUCER_FULL_NAME"]); + + // given product id + pdsLabel.addKeyword(PvlKeyword("PRODUCT_ID", productId)); + + // This comes from the user (PARAMSPVL) + pdsLabel.addKeyword(paramsPvl["PRODUCT_VERSION_ID"]); + + // always the same value + pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_HOST_NAME", "MARS RECONNAISSANCE ORBITER")); + pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_HOST_ID", "MRO")); + pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_NAME", "HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT")); + pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_ID", "HIRISE")); + + // sourceProductId + pdsLabel.addKeyword(sourceProductId); + + // These come from the user (PARAMSPVL) + pdsLabel.addKeyword(paramsPvl["RATIONALE_DESC"]); + pdsLabel.addKeyword(paramsPvl["SOFTWARE_NAME"]); + } + + + /** + * + * @param inCube + * + */ + void verifyDTM(Cube *inCube, const FileName &inputCubeFile) { + if (inCube->bandCount() > 1 || + inCube->label()->hasObject("Instrument")) { + QString msg = "Input cube [" + inputCubeFile.expanded() + "] does not appear " + + "to be a DTM"; + throw IException(IException::User, msg, _FILEINFO_); + } + } + + + /** + * + * @param inCube + * @param dtmPdsLabel + * @param mappingObject + * + */ + void customizeDtmLabels(Cube *inCube, Pvl &dtmPdsLabel, PvlObject &mappingObject) { + + // sets format for dtm label + Pvl format; + // Have to do things this way to get an array of values + PvlKeyword validMin("VALID_MINIMUM", "REAL"); + validMin += "2"; + format.addKeyword(validMin); + PvlKeyword validMax("VALID_MAXIMUM", "REAL"); + validMax += "2"; + format.addKeyword(validMax); + format.addKeyword(PvlKeyword("SAMPLE_BIT_MASK", "BINARY")); + // Aiming for MISSING_CONSTANT = (HEX, 4); Two separate items. + PvlKeyword mc("MISSING_CONSTANT", "HEX"); + mc += "4"; + format.addKeyword(mc); + PvlFormat *form = dtmPdsLabel.format(); + form->add(format); + dtmPdsLabel.setFormat(form); + + QString note = "Pixel values in this file represent elevations in meters " + "above the martian equipotential surface (Mars 2000 Datum) defined by " + "Smith, et al. (2001). Conversion from pixel units to geophysical " + "units is given by the keyvalues for SCALING_FACTOR and OFFSET. This " + "DTM was produced using ISIS and SOCET Set (copyright BAE Systems) " + "software as described in Kirk et al. (2008)."; + dtmPdsLabel.findObject("IMAGE").addKeyword(PvlKeyword("NOTE", note)); + + // Label records should always be 1, my example didn't included it, so we won't. + dtmPdsLabel.deleteKeyword("LABEL_RECORDS"); + + // Delete or change unneeded keywords in image object + PvlObject &image = dtmPdsLabel.findObject("IMAGE"); + image.findKeyword("CORE_NULL").setName("MISSING_CONSTANT"); + image.deleteKeyword("BAND_STORAGE_TYPE"); + image.deleteKeyword("CORE_LOW_REPR_SATURATION"); + image.deleteKeyword("CORE_LOW_INSTR_SATURATION"); + image.deleteKeyword("CORE_HIGH_REPR_SATURATION"); + image.deleteKeyword("CORE_HIGH_INSTR_SATURATION"); + + // Create statistics and add to image group + Statistics *stat = inCube->statistics(); + image.addKeyword(PvlKeyword("VALID_MINIMUM", toString(stat->Minimum()))); + image.addKeyword(PvlKeyword("VALID_MAXIMUM", toString(stat->Maximum()))); + + // delete unneeded keywords in map object + mappingObject.deleteKeyword("FIRST_STANDARD_PARALLEL"); + mappingObject.deleteKeyword("SECOND_STANDARD_PARALLEL"); + + } + + + /* + * For orthorectified images, + * PRODUCT_ID = mSP_xxxxxx_xxxx_ccc_s_nn_ORTHO + * m is the map projection code + * E for equirectangular + * P for polar stereographic + * xxxxx_xxxx is the HiRISE source observation ID (mission phase orbit number target code) + * ccc is the color content + * RED for visible red, 1 band images + * IRB for 3 band enhanced color images (IR, RED, or BG) + * s is the grid spacing (i.e. map scale) code + * A for 0.25 m + * B for 0.5 m + * C for 1.0 m + * D for 2.0 m + * nn is the sequence number to distinguish between ortho rectified images + * from the same HiRISE observation that may be created from different DTMs + * ORTHO indicates that the image has been orthorectified + * + * For DTMs, + * PRODUCT_ID = DTems_xxxxxx_xxxx_xxxxxx_xxxx_vnn + * e is the code for the type of elevation data + * E for areoid elevations + * R for radii + * (hidtmgen does not currently support this option) + * m is the map projection code + * E for equirectangular + * P for polar stereographic + * s is the grid spacing (i.e. map scale) code + * A for 0.25 m + * B for 0.5 m + * C for 1.0 m + * D for 2.0 m + * xxxxx_xxxx_xxxxx_xxxx is the HiRISE source observation ID for the stereo pairs + * v is the code for the producing institution + * U for USGS + * A for University of Arizona + * C for CalTech + * N for NASA Ames + * J for JPL + * O for Ohio State + * Z for other + * nn is the 2 digit product version ID number + */ + } diff --git a/isis/src/mro/apps/hidtmgen/hidtmgen.h b/isis/src/mro/apps/hidtmgen/hidtmgen.h new file mode 100644 index 0000000000..f3fde729d0 --- /dev/null +++ b/isis/src/mro/apps/hidtmgen/hidtmgen.h @@ -0,0 +1,11 @@ +#ifndef hidtmgen_h // Change this to your app name in all lower case suffixed with _h (e.g. campt_h, cam2map_h etc.) +#define hidtmgen_h + +#include "Cube.h" +#include "UserInterface.h" + +namespace Isis{ + extern void hidtmgen(UserInterface &ui); +} + +#endif diff --git a/isis/src/mro/apps/hidtmgen/main.cpp b/isis/src/mro/apps/hidtmgen/main.cpp index 9bee7fa60f..5b370cfb23 100644 --- a/isis/src/mro/apps/hidtmgen/main.cpp +++ b/isis/src/mro/apps/hidtmgen/main.cpp @@ -1,825 +1,11 @@ #include "Isis.h" -#include -#include -#include +#include "Application.h" +#include "hidtmgen.h" -#include "Cube.h" -#include "CubeAttribute.h" -#include "FileName.h" -#include "FileList.h" -#include "IString.h" -#include "ProcessExportPds.h" -#include "TProjection.h" -#include "ProjectionFactory.h" -#include "Pvl.h" -#include "PvlFormatPds.h" -#include "PvlKeyword.h" -#include "PvlObject.h" -#include "SpecialPixel.h" -#include "Statistics.h" -#include "UserInterface.h" +using namespace Isis; -using namespace std; -using namespace Isis; - - -/** - * Indicates the type of file currently being processed for export to PDS. - */ -enum FileType { DTM, /**< The output file for the current process is a DTM.*/ - Orthorectified /**< The output file for the current process is an Ortho.*/ -}; - - -/** - * This enumeration is used to determine how to set the special pixel types - * selected by the user. - * - * If the output data is non-negative, then Both is set. This means that Null, - * Lrs, and Lis (if selected) will be given the values of the lower boundary - * (i.e. beginning at 0) and that His and Hrs (if selected) will be given the - * values of the upper boundary (i.e. for 8bit, values near 255 and for 16bit, - * values near 65535). - * - * If the output data is signed integer data, then Negative is set. This means - * that all special pixels (if selected) will be given values of the lower - * boundary (i.e. beginning -32768). - * - * If the output data is real-valued, then Default is set. This means that the - * special pixels defined in Isis::SpecialPixel will be used. - * - */ -enum SpecialPixelBoundary { Both, /**< Both the upper and lower boundaries may be used to save - off special pixel values. This option is used for - unsigned bit integer valued output data types - (i.e. 8bit and unsigned 16bit)*/ - Negative, /**< Only the lower (negative) boundary may be used to save - off special pixel values. This option is used for signed - 16 bit integer valued output data.*/ - Default /**< This option is used for real valued output data types - (i.e. 32bit). In this case pre-defined - Isis::SpecialPixel values are dedicated to the selected - pixel types.*/ -}; - - -// -------------------------Function Prototypes ------------------------------------ -// cube processing -void setUpProcessPixels(const UserInterface &ui, - ProcessExportPds &pdsExportProcess, - FileType fileType); -void setRangeAndPixels(const UserInterface &ui, - ProcessExportPds &pdsExportProcess, - double &min, - double &max, - SpecialPixelBoundary ptype); -void processCube(ProcessExportPds &pdsExportProcess, - const FileName &outputPdsFile); -// projection information and viewing parameters -void setProjectionInformation(Cube *inCube, - Pvl &pdsLabel, - PvlObject &mappingObject, - const QString &projectionType); -void setEquirectangularRadii(Cube *inCube, - PvlObject &mappingObject); -double polarStereoGraphicNorthAzimuth(const PvlObject &mappingObject); -// find codes needed for product id -char mapScaleCode(double scale); -QString dtmSourceOrbitAndTargetCodes(const PvlKeyword &sourceKeyword); -QString versionNumber(const Pvl ¶msPvl, - const UserInterface &ui); -QString producingInstitution(const Pvl ¶msPvl, - const UserInterface &ui); -QString orthoContentColorCode(const FileName &orthoFileName); -// find/set values needed for output labels -void setIdentificationInformation(Pvl &pdsLabel, - const QString &productId, - PvlKeyword sourceProductId, - const Pvl ¶msPvl, - const UserInterface &ui); -// dtm specific calls -void verifyDTM(Cube *inCube, - const FileName &inputCubeFile); -void customizeDtmLabels(Cube *inCube, - Pvl &dtmPdsLabel, - PvlObject &mappingObject); -// ------------------------- end Function Prototypes --------------------------------- - - -// Main void IsisMain() { - try { - // -------------------------------------------------------------------------// - // Get required global ui... - // -------------------------------------------------------------------------// - UserInterface &ui = Application::GetUserInterface(); - Pvl paramsPvl(ui.GetFileName("PARAMSPVL")); - bool defaultNames = ui.GetBoolean("DEFAULTNAMES"); - - // parameters: - // * DTM (not required) if entered, set as input cube in process - // * ORTHOFROMLIST (not required) if entered, set as input cubes in process - // - // * DEFAULTNAMES (required) if true, generates output file names and product ids - // * OUTPUTDIR (not required) only used (still not required) if defaultnames=true - // * DTMTO (not required) required when defaultnames=false and dtm was given. - // * ORTHOTOLIST (not required) required when DEFAULTNAMES=false and ORTHOFROMLIST was given. - // if entered, size must match ORTHOFROMLIST - // - // * PARAMSPVL (required) - // * DTM_PRODUCT_ID (not required) required if DTM given and DEFAULTNAMES=false - // * ORTHOPRODUCTIDLIST (not required) required if DTM given and DEFAULTNAMES=false - // if entered, size must match ORTHOFROMLIST - // * ORTHOSEQUENCENUMBERLIST (not required) required if DTM given and DEFAULTNAMES=false - // if entered, size must match ORTHOFROMLIST - // - // * ENDIAN (required) - // - // * DTMBITTYPE required if DTM - // * ORTHOBITTYPE required if ORTHOFROMLIST - // * NULL (not required) - // * LRS (not required) - // * LIS (not required) - // * HIS (not required) - // * HRS (not required) - - - // -------------------------------------------------------------------------// - // Set up Process... - // -------------------------------------------------------------------------// - ProcessExportPds pdsExportProcess; - // Set ExportType and Endian for all output - pdsExportProcess.SetExportType(ProcessExportPds::Fixed); - if (ui.GetString("ENDIAN") == "MSB") { - pdsExportProcess.SetOutputEndian(Isis::Msb); - } - else if (ui.GetString("ENDIAN") == "LSB") { - pdsExportProcess.SetOutputEndian(Isis::Lsb); - } - // -------------------------------------------------------------------------// - // -------------------------------------------------------------------------// - - // The output directory will be used for DTM and ortho images when defaultNames=true - // this directory won't be used if defaultNames=false but will be used for - // both DTM and ortho if defaultNames=true. - FileName outFile; - QString outDirString; - FileName outDir = FileName(ui.GetString("OUTPUTDIR")); - if (!outDir.fileExists()) { - outDir.dir().mkpath("."); - } - outDirString = outDir.expanded(); - if (outDirString.mid(outDirString.size()-1, 1) != "/") { - outDirString += "/"; - outDir = FileName(outDirString); - } - outDirString = outDir.expanded(); - - // if DTM provided, PRODUCT_ID will also be used for ortho SOURCE_PRODUCT_IDs - QString dtmProductId = ""; - if (ui.WasEntered("DTM")) { - setUpProcessPixels(ui, pdsExportProcess, DTM); - // set the input cube to process - Cube *inCube = pdsExportProcess.SetInputCube("DTM"); - verifyDTM(inCube, ui.GetFileName("DTM")); - - // These are our output labels, will be modifying heavily - Pvl &pdsLabel = pdsExportProcess.StandardPdsLabel(ProcessExportPds::Image); - PvlObject &mappingObject = pdsLabel.findObject("IMAGE_MAP_PROJECTION"); - QString projectionType = mappingObject["MAP_PROJECTION_TYPE"][0]; - setProjectionInformation(inCube, pdsLabel, mappingObject, projectionType); - customizeDtmLabels(inCube, pdsLabel, mappingObject); - - // if the DTM was given, use the SOURCE_PRODUCT_ID supplied by the user. - PvlKeyword source = paramsPvl.findKeyword("DTM_SOURCE_PRODUCT_ID", PvlObject::Traverse); - source.setName("SOURCE_PRODUCT_ID"); - - if (defaultNames) { - dtmProductId = "DT"; - dtmProductId += "E";// for now this is hard-coded to E for elevations (see xml doc) - dtmProductId += projectionType[0].toUpper(); - dtmProductId += mapScaleCode(mappingObject.findKeyword("MAP_SCALE")); - dtmProductId += "_"; - dtmProductId += dtmSourceOrbitAndTargetCodes(source); - // Get the 1-character producing institution code from the PARAMSPVL and add it - dtmProductId += producingInstitution(paramsPvl, ui); - // Get the 2-character version number from the PARAMSPVL and add it - dtmProductId += versionNumber(paramsPvl, ui); - - outFile = FileName(outDirString + dtmProductId + ".IMG"); - } - else { - dtmProductId = ui.GetString("DTM_PRODUCT_ID"); - outFile = FileName(ui.GetFileName("DTMTO")); - } // End scope of defaultNames true - - // identification labels that are pretty set in stone - setIdentificationInformation(pdsLabel, dtmProductId, source, paramsPvl, ui); - processCube(pdsExportProcess, outFile); - if (!outFile.fileExists()) { - throw IException(IException::Unknown, - QString("DTM file [%1] failed to be created.").arg(outFile.expanded()), - _FILEINFO_); - } - } // end if DTM was entered - else if (!ui.WasEntered("ORTHOFROMLIST")) { - throw IException(IException::User, - "User must supply DTM or ORTHOFROMLIST or both.", - _FILEINFO_); - } - - /* - * End of DTM work. Labels are complete, names complete, it's written out. - */ - - - // Now we take care of ortho images, if given. - // Get the list of ortho input cubes - if (ui.WasEntered("ORTHOFROMLIST")) { - - FileList orthoFromList; - orthoFromList.read(FileName(ui.GetFileName("ORTHOFROMLIST"))); - if(orthoFromList.size() == 0) { - throw IException(IException::User, "Input ortho list is empty.", _FILEINFO_); - } - - // check corresponding input lists for matching sizes... - FileList orthoToList, orthoProductIdList, orthoSequenceNumberList; - if (defaultNames) { - // if creating default output file names and product ids then we need to get the list of - // ortho sequence numbers - orthoSequenceNumberList.read(FileName(ui.GetFileName("ORTHOSEQUENCENUMBERLIST"))); - if(orthoFromList.size() != orthoSequenceNumberList.size()) { - throw IException(IException::User, "Output sequence number list must " - "correspond to the input ortho list.", _FILEINFO_); - } - } - else { - // if not creating default names, get the lists of ortho output cube names and product ids - orthoToList.read(FileName(ui.GetFileName("ORTHOTOLIST"))); - orthoProductIdList.read(FileName(ui.GetFileName("ORTHOPRODUCTIDLIST"))); - if(orthoFromList.size() != orthoToList.size() - || orthoFromList.size() != orthoProductIdList.size()) { - throw IException(IException::User, - "Output ortho list and product id list must " - "correspond to the input ortho list.", - _FILEINFO_); - } - } - - ProcessExportPds orthoExportProcess; - // Set ExportType and Endian for all output - orthoExportProcess.SetExportType(ProcessExportPds::Fixed); - if (ui.GetString("ENDIAN") == "MSB") { - orthoExportProcess.SetOutputEndian(Isis::Msb); - } - else if (ui.GetString("ENDIAN") == "LSB") { - orthoExportProcess.SetOutputEndian(Isis::Lsb); - } - setUpProcessPixels(ui, orthoExportProcess, Orthorectified); - - // Loop through all ortho images - for (int i = 0; i < orthoFromList.size(); i++) { - - // set the input cube to process - CubeAttributeInput att(orthoFromList[i]); - Cube *inCube = orthoExportProcess.SetInputCube(orthoFromList[i].expanded(), att); - - // get the cube label and set identification info - Pvl &pdsLabel = orthoExportProcess.StandardPdsLabel(ProcessExportPds::Image); - - // set map projection information - PvlObject &mappingObject = pdsLabel.findObject("IMAGE_MAP_PROJECTION"); - QString projectionType = mappingObject["MAP_PROJECTION_TYPE"][0]; - setProjectionInformation(inCube, pdsLabel, mappingObject, projectionType); - - QString productId = ""; - QString orthoId = ""; - if (defaultNames) { - orthoId = orthoFromList[i].baseName().left(15); - productId = orthoId; - productId += "_"; - productId += orthoContentColorCode(orthoFromList[i]); - productId += "_"; - productId += mapScaleCode(mappingObject.findKeyword("MAP_SCALE")); - productId += "_"; - productId += orthoSequenceNumberList[i].expanded(); - productId += "_"; - productId += "ORTHO"; - - // output file path is the same as the dtm - outFile = FileName(outDirString + productId + ".IMG"); - } - else { - productId = orthoProductIdList[i].expanded(); - outFile = orthoToList[i]; - orthoId = productId; - } - - // for ortho images, source product ID is the DTM product ID followed by the - // ORTHO product ID - PvlKeyword source("SOURCE_PRODUCT_ID"); - if (dtmProductId.isEmpty()) { - source += paramsPvl["ORTHO_SOURCE_DTM_ID"]; - } - else { - source += dtmProductId; - } - source += orthoId; - setIdentificationInformation(pdsLabel, productId, source, paramsPvl, ui); - - processCube(orthoExportProcess, outFile); - if (!outFile.fileExists()) { - throw IException(IException::Unknown, - QString("DTM file [%1] failed to be created.").arg(outFile.expanded()), - _FILEINFO_); - } - - } // End scope of for loop for ortho images - } - } - catch (IException &e) { - throw IException(e, IException::Unknown, "hidtmgen: Unable to HiRISE generate pds products.", _FILEINFO_); - } -}// end main - - -void setUpProcessPixels(const UserInterface &ui, - ProcessExportPds &pdsExportProcess, - FileType fileType) { - double min = -DBL_MAX; - double max = DBL_MAX; - - // Setup output type - QString parameterPrefix = "DTM"; - if (fileType == Orthorectified) { - parameterPrefix = "ORTHO"; - } - QString bitType = ui.GetString(parameterPrefix + "BITTYPE"); - if (bitType == "8BIT") { - pdsExportProcess.SetOutputType(Isis::UnsignedByte); - min = 0.0; - max = 255.0; - setRangeAndPixels(ui, pdsExportProcess, min, max, Both); - } - else if (bitType == "S16BIT") { - pdsExportProcess.SetOutputType(Isis::SignedWord); - min = -32768.0; - max = 32767.0; - setRangeAndPixels(ui, pdsExportProcess, min, max, Negative); - } - else if (bitType == "U16BIT") { - pdsExportProcess.SetOutputType(Isis::UnsignedWord); - min = 0.0; - max = 65535.0; - setRangeAndPixels(ui, pdsExportProcess, min, max, Both); - } - else { // default 32 bit - pdsExportProcess.SetOutputType(Isis::Real); - pdsExportProcess.SetOutputNull(Isis::NULL4); - pdsExportProcess.SetOutputLrs(Isis::LOW_REPR_SAT4); - pdsExportProcess.SetOutputLis(Isis::LOW_INSTR_SAT4); - pdsExportProcess.SetOutputHrs(Isis::HIGH_REPR_SAT4); - pdsExportProcess.SetOutputHis(Isis::HIGH_INSTR_SAT4); - setRangeAndPixels(ui, pdsExportProcess, min, max, Default); - } - + UserInterface &ui = Application::GetUserInterface(); + hidtmgen(ui); } - - -//Sets up special pixels and valid pixel ranges -void setRangeAndPixels(const UserInterface &ui, - ProcessExportPds &pdsExportProcess, - double &min, double &max, - SpecialPixelBoundary ptype) { - - if (ptype == Negative) { - // if we are dedicating the passed in min to be null, - // 1. set output null to that value - // 2. update the min to min+1 - // i.e. for SignedWord, null=-32768.0, min=-32767.0 - if (ui.GetBoolean("NULL")) { - pdsExportProcess.SetOutputNull(min++); - } - // if we are dedicating the current min value to be lrs, - // 1. set output lrs to that value - // 2. update the min to min+1 - if (ui.GetBoolean("LRS")) { - pdsExportProcess.SetOutputLrs(min++); - } - if (ui.GetBoolean("LIS")) { - pdsExportProcess.SetOutputLis(min++); - } - if (ui.GetBoolean("HIS")) { - pdsExportProcess.SetOutputHis(min++); - } - if (ui.GetBoolean("HRS")) { - pdsExportProcess.SetOutputHrs(min++); - } - } - else if (ptype == Both) { - // if we are dedicating the passed in min to be null, - // 1. set output null to that value - // 2. update the min to min+1 - if (ui.GetBoolean("NULL")) { - pdsExportProcess.SetOutputNull(min++); - } - // if we are dedicating the current min value to be lrs, - // 1. set output lrs to that value - // 2. update the min to min+1 - if (ui.GetBoolean("LRS")) { - pdsExportProcess.SetOutputLrs(min++); - } - // if we are dedicating the current min value to be lis, - // 1. set output lis to that value - // 2. update the min to min+1 - if (ui.GetBoolean("LIS")) { - pdsExportProcess.SetOutputLis(min++); - } - // if we are dedicating the max value to be hrs, - // 1. set output hrs to that value - // 2. update the max to max-1 - if (ui.GetBoolean("HRS")) { - pdsExportProcess.SetOutputHrs(max--); - } - // if we are dedicating the current max value to be his, - // 1. set output his to that value - // 2. update the max to max-1 - if (ui.GetBoolean("HIS")) { - pdsExportProcess.SetOutputHis(max--); - } - } - pdsExportProcess.SetOutputRange(min, max); -} - - -void processCube(ProcessExportPds &pdsExportProcess, const FileName &outputPdsFile) { - ofstream pdsOut(outputPdsFile.expanded().toLatin1().data()); - pdsExportProcess.OutputLabel(pdsOut); - pdsExportProcess.StartProcess(pdsOut); - pdsOut.close(); - pdsExportProcess.EndProcess(); - pdsExportProcess.ClearInputCubes(); -} - - -void setProjectionInformation(Cube *inCube, Pvl &pdsLabel, - PvlObject &mappingObject, const QString &projectionType) { - - // set map projection information - mappingObject.addKeyword(PvlKeyword("^DATA_SET_MAP_PROJECTION", "DSMAP.CAT")); - // initialize the azimuth to a Null value so we can check whether it was set. - double northAzimuth = Isis::Null; - // now find the northAzimuth based on projection type - if (QString::compare(projectionType, "EQUIRECTANGULAR", Qt::CaseInsensitive) == 0) { - setEquirectangularRadii(inCube, mappingObject); - mappingObject["MAP_PROJECTION_TYPE"].setValue("\"EQUIRECTANGULAR\""); - northAzimuth = 270; - pdsLabel.setFormatTemplate("$ISISROOT/appdata/translations/MroHirisePdsDTMEqui.pft"); - } - else if (QString::compare(projectionType, "POLAR STEREOGRAPHIC", Qt::CaseInsensitive) == 0) { - northAzimuth = polarStereoGraphicNorthAzimuth(mappingObject); - pdsLabel.setFormatTemplate("$ISISROOT/appdata/translations/MroHirisePdsDTMPolar.pft"); - } - else { - QString msg = "The projection type [" + - projectionType - + "] is not supported"; - throw IException(IException::User, msg, _FILEINFO_); - } - - PvlObject viewingParameters("VIEWING_PARAMETERS"); - if (northAzimuth != Isis::Null) { - viewingParameters.addKeyword(PvlKeyword("NORTH_AZIMUTH", toString(northAzimuth), "DEG")); - } - else { - viewingParameters.addKeyword(PvlKeyword("NORTH_AZIMUTH", "N/A")); - } - pdsLabel.addObject(viewingParameters); - -} - - -void setEquirectangularRadii(Cube *inCube, PvlObject &mappingObject) { - TProjection *proj = (TProjection *) ProjectionFactory::CreateFromCube(*inCube); - double newRadius = proj->LocalRadius((double)mappingObject["CENTER_LATITUDE"]); - newRadius /= 1000; - mappingObject.findKeyword("A_AXIS_RADIUS").setValue(toString(newRadius)); - mappingObject.findKeyword("A_AXIS_RADIUS").setUnits("KM"); - mappingObject.findKeyword("B_AXIS_RADIUS").setValue(toString(newRadius)); - mappingObject.findKeyword("B_AXIS_RADIUS").setUnits("KM"); - mappingObject.findKeyword("C_AXIS_RADIUS").setValue(toString(newRadius)); - mappingObject.findKeyword("C_AXIS_RADIUS").setUnits("KM"); -} - - -double polarStereoGraphicNorthAzimuth(const PvlObject &mappingObject) { - - double northAzimuth = Isis::Null; - if (mappingObject.hasKeyword("MINIMUM_LATITUDE") - && mappingObject.hasKeyword("MAXIMUM_LATITUDE") - && mappingObject.hasKeyword("EASTERNMOST_LONGITUDE") - && mappingObject.hasKeyword("WESTERNMOST_LONGITUDE")) { - - // find the center latitude of this set of images - // (not the same as the center lat for the projection) - double clat = ((toDouble(mappingObject["MAXIMUM_LATITUDE"][0]) - - toDouble(mappingObject["MINIMUM_LATITUDE"][0])) / 2) + - toDouble(mappingObject["MINIMUM_LATITUDE"][0]); - // find the center longitude of this set of images - // (not the same as the center lon for the projection) - double clon = ((toDouble(mappingObject["EASTERNMOST_LONGITUDE"][0]) - - toDouble(mappingObject["WESTERNMOST_LONGITUDE"][0])) / 2) + - toDouble(mappingObject["WESTERNMOST_LONGITUDE"][0]); - - if (clat > 0.0 && clon < 270.0) { // Northern Hemisphere, 0 to 270 lon - northAzimuth = 270.00 - clon; - } - else if (clat > 0.0 && clon >= 270.0) { // Northern Hemisphere, 270 to 360 lon - northAzimuth = 360.00 + (270.00 - clon); - } - else if (clat < 0.0 && clon < 90.0) { // Southern Hemisphere, 0 to 90 lon - northAzimuth = 270.00 + clon; - } - else if (clat < 0.0 && clon >= 90.0) { // Southern Hemisphere, 90 to 360 lon - northAzimuth = -(360.00 - (270.00 + clon)); - } - } - return northAzimuth; - -} - - -/* - * Scale letter of the image, A = 0.25, B = 0.5, C = 1.0, and so on. - * We are using a 10% fudge range. - */ -char mapScaleCode(double scale) { - int steps = 0; - double matchNum = 0.25; - double epsilon = matchNum * 0.1; // = 10% of matchNum - - bool bounded = false; - while (!bounded) { - if ((scale + epsilon) > matchNum && (scale - epsilon) < matchNum) { - bounded = true; - } - else { - steps++; - } - - // Increase to next possible scale and increase epsilon - matchNum *= 2; - epsilon *= 2; - - if (matchNum > 129) { // Max allowed is J, 128, before skipping to Z - bounded = true; - steps = 25; // Get us to 'Z' - } - } - char scaleLetter = 'A'; - // For however many steps we took, increase the letter. - scaleLetter += steps; - // 0.25 = A, 0.5 = B, 1.0 = C... - return scaleLetter; -} - - -QString dtmSourceOrbitAndTargetCodes(const PvlKeyword &sourceKeyword) { - // we use the source product id for the DTM to get the orbit IDs and target code - // for the source products (i.e. the stereo pair) - return sourceKeyword[0].mid(4,11) + "_" + - sourceKeyword[1].mid(4,12) + "_"; -} - - -QString versionNumber(const Pvl ¶msPvl, const UserInterface &ui) { - double version = toDouble(paramsPvl["PRODUCT_VERSION_ID"]); - - // Format the version for the output name: - // Only important thing to note is that a #.0 number is converted to 0# - // for the name, otherwise, it is predictable, always 2 greatest numbers: - // ##. - // >10, takes first two digits - // The number found here is used in ortho images as well. - QString vers = ""; - if (version >= 10.0) { - vers = toString(version).left(2); - } - else if (version >= 1.0) { - vers = toString(version); - bool wasInt = false; - // Checking for integer values, if so, make #.0 into 0# - // necessary because in DTMgen version 1.0 corresponded to a 01 in names. - if (vers.size() == 3) { - if (vers.at(2) == '0') { - vers = "0" + vers.left(1); - wasInt = true; - } - } - // Wasn't int, make #.# into ## - if (!wasInt) { - vers = toString(version).remove(QChar('.')); - if (vers.size() > 2) { - vers = vers.left(2); - } - } - } - // 0 - <1, if 0.#, is 0#, is 0.#####, is first two ## - else if (version >= 0.001) { // Any less and we get E... not dealing with that. - vers = toString(version).remove(QChar('.')); - int nonZero = vers.lastIndexOf("0"); - if (vers.size() > 2) { - vers = vers.mid(nonZero+1, 2); - } - } - // It was negative, or something else crazy? - else { - QString msg = "Version number [" + toString(version) + "] is invalid"; - throw IException(IException::User, msg, _FILEINFO_); - } - return vers; -} - - -QString producingInstitution(const Pvl ¶msPvl, const UserInterface &ui) { - QString producing = paramsPvl["PRODUCING_INSTITUTION"][0]; - if (producing.size() > 1) { - QString msg = "PRODUCING_INSTITUTION value [" + producing + "] in the PARAMSPVL file must be a " - "single character. See hidtmgen documentation for these character codes."; - throw IException(IException::User, msg, _FILEINFO_); - } - return producing; -} - - -QString orthoContentColorCode(const FileName &orthoFileName) { - QString colorCode = ""; - Cube orthoCube(orthoFileName, "r"); - if (orthoCube.bandCount() == 1) { - colorCode = "RED"; - } - else if (orthoCube.bandCount() == 3) { - colorCode = "IRB"; - } - else { - QString msg = "The file [" + orthoFileName.expanded() + "] found in the ORTHOFROMLIST " - "is not a valid orthorectified image. Band count must be 1 (RED) or 3 (color)."; - throw IException(IException::User, msg, _FILEINFO_); - } - return colorCode; -} - - -void setIdentificationInformation(Pvl &pdsLabel, - const QString &productId, - PvlKeyword sourceProductId, - const Pvl ¶msPvl, - const UserInterface &ui) { - // These come from the user (PARAMSPVL) - pdsLabel.addKeyword(paramsPvl["DATA_SET_ID"]); - pdsLabel.addKeyword(paramsPvl["DATA_SET_NAME"]); - pdsLabel.addKeyword(paramsPvl["PRODUCER_INSTITUTION_NAME"]); - pdsLabel.addKeyword(paramsPvl["PRODUCER_ID"]); - pdsLabel.addKeyword(paramsPvl["PRODUCER_FULL_NAME"]); - - // given product id - pdsLabel.addKeyword(PvlKeyword("PRODUCT_ID", productId)); - - // This comes from the user (PARAMSPVL) - pdsLabel.addKeyword(paramsPvl["PRODUCT_VERSION_ID"]); - - // always the same value - pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_HOST_NAME", "MARS RECONNAISSANCE ORBITER")); - pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_HOST_ID", "MRO")); - pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_NAME", "HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT")); - pdsLabel.addKeyword(PvlKeyword("INSTRUMENT_ID", "HIRISE")); - - // sourceProductId - pdsLabel.addKeyword(sourceProductId); - - // These come from the user (PARAMSPVL) - pdsLabel.addKeyword(paramsPvl["RATIONALE_DESC"]); - pdsLabel.addKeyword(paramsPvl["SOFTWARE_NAME"]); -} - - -/** - * - * @param inCube - * - */ -void verifyDTM(Cube *inCube, const FileName &inputCubeFile) { - if (inCube->bandCount() > 1 || - inCube->label()->hasObject("Instrument")) { - QString msg = "Input cube [" + inputCubeFile.expanded() + "] does not appear " - + "to be a DTM"; - throw IException(IException::User, msg, _FILEINFO_); - } -} - - -/** - * - * @param inCube - * @param dtmPdsLabel - * @param mappingObject - * - */ -void customizeDtmLabels(Cube *inCube, Pvl &dtmPdsLabel, PvlObject &mappingObject) { - - // sets format for dtm label - Pvl format; - // Have to do things this way to get an array of values - PvlKeyword validMin("VALID_MINIMUM", "REAL"); - validMin += "2"; - format.addKeyword(validMin); - PvlKeyword validMax("VALID_MAXIMUM", "REAL"); - validMax += "2"; - format.addKeyword(validMax); - format.addKeyword(PvlKeyword("SAMPLE_BIT_MASK", "BINARY")); - // Aiming for MISSING_CONSTANT = (HEX, 4); Two separate items. - PvlKeyword mc("MISSING_CONSTANT", "HEX"); - mc += "4"; - format.addKeyword(mc); - PvlFormat *form = dtmPdsLabel.format(); - form->add(format); - dtmPdsLabel.setFormat(form); - - QString note = "Pixel values in this file represent elevations in meters " - "above the martian equipotential surface (Mars 2000 Datum) defined by " - "Smith, et al. (2001). Conversion from pixel units to geophysical " - "units is given by the keyvalues for SCALING_FACTOR and OFFSET. This " - "DTM was produced using ISIS and SOCET Set (copyright BAE Systems) " - "software as described in Kirk et al. (2008)."; - dtmPdsLabel.findObject("IMAGE").addKeyword(PvlKeyword("NOTE", note)); - - // Label records should always be 1, my example didn't included it, so we won't. - dtmPdsLabel.deleteKeyword("LABEL_RECORDS"); - - // Delete or change unneeded keywords in image object - PvlObject &image = dtmPdsLabel.findObject("IMAGE"); - image.findKeyword("CORE_NULL").setName("MISSING_CONSTANT"); - image.deleteKeyword("BAND_STORAGE_TYPE"); - image.deleteKeyword("CORE_LOW_REPR_SATURATION"); - image.deleteKeyword("CORE_LOW_INSTR_SATURATION"); - image.deleteKeyword("CORE_HIGH_REPR_SATURATION"); - image.deleteKeyword("CORE_HIGH_INSTR_SATURATION"); - - // Create statistics and add to image group - Statistics *stat = inCube->statistics(); - image.addKeyword(PvlKeyword("VALID_MINIMUM", toString(stat->Minimum()))); - image.addKeyword(PvlKeyword("VALID_MAXIMUM", toString(stat->Maximum()))); - - // delete unneeded keywords in map object - mappingObject.deleteKeyword("FIRST_STANDARD_PARALLEL"); - mappingObject.deleteKeyword("SECOND_STANDARD_PARALLEL"); - -} - - -/* - * For orthorectified images, - * PRODUCT_ID = mSP_xxxxxx_xxxx_ccc_s_nn_ORTHO - * m is the map projection code - * E for equirectangular - * P for polar stereographic - * xxxxx_xxxx is the HiRISE source observation ID (mission phase orbit number target code) - * ccc is the color content - * RED for visible red, 1 band images - * IRB for 3 band enhanced color images (IR, RED, or BG) - * s is the grid spacing (i.e. map scale) code - * A for 0.25 m - * B for 0.5 m - * C for 1.0 m - * D for 2.0 m - * nn is the sequence number to distinguish between ortho rectified images - * from the same HiRISE observation that may be created from different DTMs - * ORTHO indicates that the image has been orthorectified - * - * For DTMs, - * PRODUCT_ID = DTems_xxxxxx_xxxx_xxxxxx_xxxx_vnn - * e is the code for the type of elevation data - * E for areoid elevations - * R for radii - * (hidtmgen does not currently support this option) - * m is the map projection code - * E for equirectangular - * P for polar stereographic - * s is the grid spacing (i.e. map scale) code - * A for 0.25 m - * B for 0.5 m - * C for 1.0 m - * D for 2.0 m - * xxxxx_xxxx_xxxxx_xxxx is the HiRISE source observation ID for the stereo pairs - * v is the code for the producing institution - * U for USGS - * A for University of Arizona - * C for CalTech - * N for NASA Ames - * J for JPL - * O for Ohio State - * Z for other - * nn is the 2 digit product version ID number - */ diff --git a/isis/src/mro/apps/hidtmgen/tsts/Makefile b/isis/src/mro/apps/hidtmgen/tsts/Makefile deleted file mode 100644 index 46d84c74c2..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -BLANKS = "%-6s" -LENGTH = "%-40s" - -include $(ISISROOT)/make/isismake.tststree diff --git a/isis/src/mro/apps/hidtmgen/tsts/color/Makefile b/isis/src/mro/apps/hidtmgen/tsts/color/Makefile deleted file mode 100644 index b7510615e2..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/color/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -# -# This test is testing an equitorial projection, of primary importance is the -# labels and details such as quoting on keywords, the standard for the output -# is very specific. - -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - $(LS) $(INPUT)/ESP*.cub > $(OUTPUT)/orthoInputList.txt; - $(APPNAME) DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers.txt \ - > /dev/null; - - catlab from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042753_1930_IRB_B_26_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042753_1930_IRB_B_26_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042753_1930_IRB_D_59_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042753_1930_IRB_D_59_ORTHO.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042753_1930_IRB_B_26_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042753_1930_IRB_B_26_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042753_1930_IRB_D_59_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042753_1930_IRB_D_59_ORTHO.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTEED_042252_1930_042753_1930_A31.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042753_1930_IRB_B_26_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042753_1930_IRB_D_59_ORTHO.IMG; - $(RM) $(OUTPUT)/orthoInputList.txt; - diff --git a/isis/src/mro/apps/hidtmgen/tsts/dtmOnly/Makefile b/isis/src/mro/apps/hidtmgen/tsts/dtmOnly/Makefile deleted file mode 100644 index a2d27fb6ce..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/dtmOnly/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -# -# This test is testing an equitorial projection, of primary importance is the -# labels and details such as quoting on keywords, the standard for the output -# is very specific. - -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - $(APPNAME) DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - PARAMSPVL=$(INPUT)/dtmParams.pvl \ - > /dev/null; - - catlab from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A15.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A15.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A15.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A15.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTEED_042252_1930_042753_1930_A15.IMG; - diff --git a/isis/src/mro/apps/hidtmgen/tsts/equi/Makefile b/isis/src/mro/apps/hidtmgen/tsts/equi/Makefile deleted file mode 100644 index 9bb01cedcc..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/equi/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -# -# This test is testing an equitorial projection, of primary importance is the -# labels and details such as quoting on keywords, the standard for the output -# is very specific. - -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - $(LS) $(INPUT)/PSP*.cub > $(OUTPUT)/orthoInputList.txt; - $(APPNAME) DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/DTM_Zumba_1m_forPDS.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers.txt \ - > /dev/null; - - catlab from=$(OUTPUT)/DTEEC_002118_1510_003608_1510_A02.IMG \ - to=$(OUTPUT)/DTEEC_002118_1510_003608_1510_A02.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_002118_1510_RED_C_01_ORTHO.IMG \ - to=$(OUTPUT)/PSP_002118_1510_RED_C_01_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_002118_1510_RED_A_02_ORTHO.IMG \ - to=$(OUTPUT)/PSP_002118_1510_RED_A_02_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_003608_1510_RED_C_03_ORTHO.IMG \ - to=$(OUTPUT)/PSP_003608_1510_RED_C_03_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_003608_1510_RED_A_04_ORTHO.IMG \ - to=$(OUTPUT)/PSP_003608_1510_RED_A_04_ORTHO.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTEEC_002118_1510_003608_1510_A02.IMG \ - to=$(OUTPUT)/DTEEC_002118_1510_003608_1510_A02.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_002118_1510_RED_C_01_ORTHO.IMG \ - to=$(OUTPUT)/PSP_002118_1510_RED_C_01_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_002118_1510_RED_A_02_ORTHO.IMG \ - to=$(OUTPUT)/PSP_002118_1510_RED_A_02_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_003608_1510_RED_C_03_ORTHO.IMG \ - to=$(OUTPUT)/PSP_003608_1510_RED_C_03_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_003608_1510_RED_A_04_ORTHO.IMG \ - to=$(OUTPUT)/PSP_003608_1510_RED_A_04_ORTHO.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTEEC_002118_1510_003608_1510_A02.IMG; - $(RM) $(OUTPUT)/PSP_002118_1510_RED_C_01_ORTHO.IMG; - $(RM) $(OUTPUT)/PSP_002118_1510_RED_A_02_ORTHO.IMG; - $(RM) $(OUTPUT)/PSP_003608_1510_RED_C_03_ORTHO.IMG; - $(RM) $(OUTPUT)/PSP_003608_1510_RED_A_04_ORTHO.IMG; - $(RM) $(OUTPUT)/orthoInputList.txt; - diff --git a/isis/src/mro/apps/hidtmgen/tsts/errors/Makefile b/isis/src/mro/apps/hidtmgen/tsts/errors/Makefile deleted file mode 100644 index bb8e5b30a6..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/errors/Makefile +++ /dev/null @@ -1,198 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -# -# This test is testing an equitorial projection, of primary importance is the -# labels and details such as quoting on keywords, the standard for the output -# is very specific. - -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - # no input data - echo -e "Error Test: no DTM or orthos given" > $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # empty ortho given - echo -e "\nError Test: given ORTHOFROMLIST is empty" >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(INPUT)/empty.lis \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - $(LS) $(INPUT)/ESP*cub > $(OUTPUT)/orthoInputList.txt; - - # given DTM is not a DTM - echo -e "\nError Test: given DTM is not a DTM" >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/ESP_042252_1930_3-BAND_COLOR_2m_o_croppedForTest.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given DTM is not a supported projection - echo -e "\nError Test: given DTM is not not a supported projection" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/molaMarsPlanetaryRadius0005.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given sequence list size doesn't match ortho list size - echo -e "\nError Test: given sequence list size doesn't match ortho list size" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers2.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given ortho to list size doesn't match ortho from list size - echo -e "\nError Test: given ortho to list size doesn't match from list size" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=FALSE \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - DTM_PRODUCT_ID=xyz \ - DTMTO=$(OUTPUT)/xyz.IMG \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOTOLIST=$(INPUT)/sequenceNumbers2.txt \ - ORTHOPRODUCTIDLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given ortho product id list size doesn't match ortho from list size - echo -e "\nError Test: given ortho product ID list size doesn't match from list size" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=FALSE \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - DTM_PRODUCT_ID=xyz \ - DTMTO=$(OUTPUT)/xyz.IMG \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOTOLIST=$(INPUT)/sequenceNumbers1.txt \ - ORTHOPRODUCTIDLIST=$(INPUT)/sequenceNumbers2.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given PARAMSPVL has invalid producing institution - echo -e "\nError Test: given PARAMSPVL has invalid producing institution" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/invalidProducingInstitution.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given PARAMSPVL has invalid version - echo -e "\nError Test: given PARAMSPVL has invalid version" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/invalidVersionId.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given ORTHOFROMLIST cube has invalid band size - echo -e "\nError Test: given DTM has invalid band size" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/DTM_2Bands.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers1.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - # given ORTHOFROMLIST cube has invalid band size - $(LS) $(INPUT)/2Band*cub >> $(OUTPUT)/orthoInputList.txt; - echo -e "\nError Test: given ORTHOFROMLIST cube has invalid band size" \ - >> $(OUTPUT)/error_temp.txt; - if [[ `$(APPNAME) \ - DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers2.txt \ - 2>> $(OUTPUT)/error_temp.txt \ - > /dev/null` ]]; \ - then \ - true; \ - fi; - - $(SED) 's+\[/.*/input/+\[input/+' $(OUTPUT)/error_temp.txt > $(OUTPUT)/error.txt; - $(RM) $(OUTPUT)/error_temp.txt; - $(RM) $(OUTPUT)/orthoInputList.txt; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_D_09_ORTHO.IMG; - $(RM) $(OUTPUT)/DTEED_042252_1930_042753_1930_A04.IMG; - $(RM) $(OUTPUT)/xyz.IMG; diff --git a/isis/src/mro/apps/hidtmgen/tsts/nonDefaultNames/Makefile b/isis/src/mro/apps/hidtmgen/tsts/nonDefaultNames/Makefile deleted file mode 100644 index e6b82a5a4e..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/nonDefaultNames/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -# -# This test is meant to test the functionality of the application withregards -# to non standard names. The labels are really the important part, details -# such as quoting. - -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - $(LS) $(INPUT)/PSP*.cub > $(OUTPUT)/orthoInputList.txt; - echo $(OUTPUT)/ORTHO1.IMG > $(OUTPUT)/orthoOutputList.txt; - echo $(OUTPUT)/ORTHO2.IMG >> $(OUTPUT)/orthoOutputList.txt; - echo $(OUTPUT)/ORTHO3.IMG >> $(OUTPUT)/orthoOutputList.txt; - echo $(OUTPUT)/ORTHO4.IMG >> $(OUTPUT)/orthoOutputList.txt; - $(APPNAME) DEFAULTNAMES=FALSE \ - DTM=$(INPUT)/DTM_Zumba_1m_forPDS.cub \ - DTMTO=$(OUTPUT)/DTM.IMG \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - ORTHOTOLIST=$(OUTPUT)/orthoOutputList.txt \ - ORTHOPRODUCTIDLIST=$(INPUT)/orthoOutputProductIds.lis \ - PARAMSPVL=$(INPUT)/parameters.pvl \ - DTM_PRODUCT_ID=DtmProduct \ - > /dev/null; - - catlab from=$(OUTPUT)/DTM.IMG \ - to=$(OUTPUT)/DTM.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ORTHO1.IMG \ - to=$(OUTPUT)/ORTHO1.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ORTHO2.IMG \ - to=$(OUTPUT)/ORTHO2.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ORTHO3.IMG \ - to=$(OUTPUT)/ORTHO3.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ORTHO4.IMG \ - to=$(OUTPUT)/ORTHO4.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTM.IMG \ - to=$(OUTPUT)/DTM.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ORTHO1.IMG \ - to=$(OUTPUT)/ORTHO1.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ORTHO2.IMG \ - to=$(OUTPUT)/ORTHO2.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ORTHO3.IMG \ - to=$(OUTPUT)/ORTHO3.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ORTHO4.IMG \ - to=$(OUTPUT)/ORTHO4.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTM.IMG; - $(RM) $(OUTPUT)/ORTHO1.IMG; - $(RM) $(OUTPUT)/ORTHO2.IMG; - $(RM) $(OUTPUT)/ORTHO3.IMG; - $(RM) $(OUTPUT)/ORTHO4.IMG; - $(RM) $(OUTPUT)/orthoInputList.txt; - $(RM) $(OUTPUT)/orthoOutputList.txt; - diff --git a/isis/src/mro/apps/hidtmgen/tsts/orthoOnly/Makefile b/isis/src/mro/apps/hidtmgen/tsts/orthoOnly/Makefile deleted file mode 100644 index 2240621d6a..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/orthoOnly/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -# -# This test is testing an equitorial projection, of primary importance is the -# labels and details such as quoting on keywords, the standard for the output -# is very specific. - -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - $(LS) $(INPUT)/*.cub > $(OUTPUT)/orthoFromList.txt; - $(APPNAME) DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - ORTHOFROMLIST=$(OUTPUT)/orthoFromList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers.txt \ - > /dev/null; - - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_B_23_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_23_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_D_01_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_01_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042753_1930_IRB_B_67_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042753_1930_IRB_B_67_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042753_1930_IRB_D_45_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042753_1930_IRB_D_45_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_009404_2635_RED_A_98_ORTHO.IMG \ - to=$(OUTPUT)/PSP_009404_2635_RED_A_98_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_009404_2635_RED_C_89_ORTHO.IMG \ - to=$(OUTPUT)/PSP_009404_2635_RED_C_89_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_010221_2635_RED_A_54_ORTHO.IMG \ - to=$(OUTPUT)/PSP_010221_2635_RED_A_54_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_010221_2635_RED_C_76_ORTHO.IMG \ - to=$(OUTPUT)/PSP_010221_2635_RED_C_76_ORTHO.pvl \ - > /dev/null; - - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_B_23_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_D_01_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042753_1930_IRB_B_67_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042753_1930_IRB_D_45_ORTHO.IMG; - $(RM) $(OUTPUT)/PSP_009404_2635_RED_A_98_ORTHO.IMG - $(RM) $(OUTPUT)/PSP_009404_2635_RED_C_89_ORTHO.IMG - $(RM) $(OUTPUT)/PSP_010221_2635_RED_A_54_ORTHO.IMG - $(RM) $(OUTPUT)/PSP_010221_2635_RED_C_76_ORTHO.IMG - $(RM) $(OUTPUT)/orthoFromList.txt; - diff --git a/isis/src/mro/apps/hidtmgen/tsts/outputTypes/Makefile b/isis/src/mro/apps/hidtmgen/tsts/outputTypes/Makefile deleted file mode 100644 index e0803e7781..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/outputTypes/Makefile +++ /dev/null @@ -1,133 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -# -# This test is testing an equitorial projection, of primary importance is the -# labels and details such as quoting on keywords, the standard for the output -# is very specific. - -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - $(LS) $(INPUT)/ESP*.cub > $(OUTPUT)/orthoInputList.txt; - $(APPNAME) DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers.txt \ - ENDIAN=MSB \ - NULL=FALSE \ - LIS=TRUE \ - LRS=TRUE \ - HIS=TRUE \ - HRS=TRUE \ - DTMBITTYPE=8BIT \ - ORTHOBITTYPE=32BIT \ - > /dev/null; - - catlab from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31_MSB_8BIT.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO_MSB_32BIT.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO_MSB_32BIT.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A31_MSB_8BIT.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO_MSB_32BIT.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO_MSB_32BIT.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTEED_042252_1930_042753_1930_A31.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG; - - $(APPNAME) DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params2.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers.txt \ - DTMBITTYPE=U16BIT \ - ORTHOBITTYPE=S16BIT \ - NULL=TRUE \ - LIS=TRUE \ - LRS=TRUE \ - HIS=TRUE \ - HRS=TRUE \ - > /dev/null; - - catlab from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07_U16BIT.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO_S16BIT.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO_S16BIT.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07_U16BIT.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO_S16BIT.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO_S16BIT.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTEED_042252_1930_042753_1930_A07.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG; - - $(APPNAME) DEFAULTNAMES=TRUE \ - OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Ares4_Marth_Crater_3557E_126N_ngate_03.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - PARAMSPVL=$(INPUT)/params2.pvl \ - ORTHOSEQUENCENUMBERLIST=$(INPUT)/sequenceNumbers.txt \ - DTMBITTYPE=S16BIT \ - ORTHOBITTYPE=U16BIT \ - NULL=FALSE \ - LIS=FALSE \ - LRS=FALSE \ - HIS=FALSE \ - HRS=FALSE \ - > /dev/null; - - catlab from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07_S16BIT.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO_U16BIT.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO_U16BIT.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07.IMG \ - to=$(OUTPUT)/DTEED_042252_1930_042753_1930_A07_S16BIT.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO_U16BIT.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG \ - to=$(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO_U16BIT.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTEED_042252_1930_042753_1930_A07.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_B_41_ORTHO.IMG; - $(RM) $(OUTPUT)/ESP_042252_1930_IRB_D_31_ORTHO.IMG; - $(RM) $(OUTPUT)/orthoInputList.txt; diff --git a/isis/src/mro/apps/hidtmgen/tsts/polar/Makefile b/isis/src/mro/apps/hidtmgen/tsts/polar/Makefile deleted file mode 100644 index a83a937417..0000000000 --- a/isis/src/mro/apps/hidtmgen/tsts/polar/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# Please note, the input data was reduced from its original size, in doing so -# the Scale and PixelResolution was changed, for the purpose of testing it -# needed to be the original values, so, the values were edited. This means -# the values for those two keywords are incorrect. -APPNAME = hidtmgen - -include $(ISISROOT)/make/isismake.tsts - -commands: - $(LS) $(INPUT)/PSP*.cub > $(OUTPUT)/orthoInputList.txt; - echo "1" > $(OUTPUT)/sequence.txt; - echo "2" >> $(OUTPUT)/sequence.txt; - echo "3" >> $(OUTPUT)/sequence.txt; - echo "4" >> $(OUTPUT)/sequence.txt; - $(APPNAME) OUTPUTDIR=$(OUTPUT) \ - DTM=$(INPUT)/Polar_Crater_1_1m_ngate_edited2_forPDS.cub \ - ORTHOFROMLIST=$(OUTPUT)/orthoInputList.txt \ - ORTHOSEQUENCE=$(OUTPUT)/sequence.txt \ - PARAMSPVL=$(INPUT)/parameters.pvl \ - > /dev/null; - - catlab from=$(OUTPUT)/DTEPC_009404_2635_010221_2635_Z12.IMG \ - to=$(OUTPUT)/DTEPC_009404_2635_010221_2635_Z12.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_009404_2635_RED_C_1_ORTHO.IMG \ - to=$(OUTPUT)/PSP_009404_2635_RED_C_1_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_009404_2635_RED_A_2_ORTHO.IMG \ - to=$(OUTPUT)/PSP_009404_2635_RED_A_2_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_010221_2635_RED_C_3_ORTHO.IMG \ - to=$(OUTPUT)/PSP_010221_2635_RED_C_3_ORTHO.pvl \ - > /dev/null; - catlab from=$(OUTPUT)/PSP_010221_2635_RED_A_4_ORTHO.IMG \ - to=$(OUTPUT)/PSP_010221_2635_RED_A_4_ORTHO.pvl \ - > /dev/null; - - pds2isis from=$(OUTPUT)/DTEPC_009404_2635_010221_2635_Z12.IMG \ - to=$(OUTPUT)/DTEPC_009404_2635_010221_2635_Z12.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_009404_2635_RED_C_1_ORTHO.IMG \ - to=$(OUTPUT)/PSP_009404_2635_RED_C_1_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_009404_2635_RED_A_2_ORTHO.IMG \ - to=$(OUTPUT)/PSP_009404_2635_RED_A_2_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_010221_2635_RED_C_3_ORTHO.IMG \ - to=$(OUTPUT)/PSP_010221_2635_RED_C_3_ORTHO.cub \ - > /dev/null; - pds2isis from=$(OUTPUT)/PSP_010221_2635_RED_A_4_ORTHO.IMG \ - to=$(OUTPUT)/PSP_010221_2635_RED_A_4_ORTHO.cub \ - > /dev/null; - - $(RM) $(OUTPUT)/DTEPC_009404_2635_010221_2635_Z12.IMG; - $(RM) $(OUTPUT)/PSP_009404_2635_RED_C_1_ORTHO.IMG; - $(RM) $(OUTPUT)/PSP_009404_2635_RED_A_2_ORTHO.IMG; - $(RM) $(OUTPUT)/PSP_010221_2635_RED_C_3_ORTHO.IMG; - $(RM) $(OUTPUT)/PSP_010221_2635_RED_A_4_ORTHO.IMG; - $(RM) $(OUTPUT)/orthoInputList.txt; - $(RM) $(OUTPUT)/sequence.txt; - diff --git a/isis/tests/FunctionalTestsHidtmgen.cpp b/isis/tests/FunctionalTestsHidtmgen.cpp new file mode 100644 index 0000000000..c2785f5dd8 --- /dev/null +++ b/isis/tests/FunctionalTestsHidtmgen.cpp @@ -0,0 +1,762 @@ +#include +#include "Fixtures.h" +#include "Pvl.h" +#include "PvlGroup.h" +#include "TestUtilities.h" +#include "gmock/gmock.h" +#include "UserInterface.h" +#include "hidtmgen.h" +#include "ProcessImportPds.h" + +using namespace Isis; +using ::testing::HasSubstr; + +static QString APP_XML = FileName("$ISISROOT/bin/xml/hidtmgen.xml").expanded(); + +TEST(Hidtmgen, HidtmgenTestColor){ + //Serves as default test case -- test all keywords for all generated products. + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/color/orthoInputList.txt", + "paramspvl=data/hidtmgen/color/params.pvl", + "orthosequencenumberlist=data/hidtmgen/color/sequenceNumbers.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/DTEEZ_042252_1930_042753_1930_A31.IMG"); + + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 32); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 155); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 133); + + ASSERT_EQ(dtmLabel["DATA_SET_ID"][0].toStdString(), "MRO-M-HIRISE-5-DTM-V1.0"); + ASSERT_EQ(dtmLabel["PRODUCER_INSTITUTION_NAME"][0].toStdString(), "UNIVERSITY OF ARIZONA"); + ASSERT_EQ(dtmLabel["PRODUCER_ID"][0].toStdString(), "UA"); + ASSERT_EQ(dtmLabel["PRODUCER_FULL_NAME"][0].toStdString(), "ALFRED MCEWEN"); + ASSERT_EQ(dtmLabel["PRODUCT_ID"][0].toStdString(), "DTEEZ_042252_1930_042753_1930_A31"); + ASSERT_DOUBLE_EQ(dtmLabel["PRODUCT_VERSION_ID"], 0.314); + ASSERT_EQ(dtmLabel["INSTRUMENT_HOST_NAME"][0].toStdString(), "MARS RECONNAISSANCE ORBITER"); + ASSERT_EQ(dtmLabel["INSTRUMENT_NAME"][0].toStdString(), "HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT"); + ASSERT_EQ(dtmLabel["INSTRUMENT_ID"][0].toStdString(), "HIRISE"); + ASSERT_EQ(dtmLabel["TARGET_NAME"][0].toStdString(), "MARS"); + ASSERT_EQ(dtmLabel["SOURCE_PRODUCT_ID"][0].toStdString(), "ESP_042252_1930"); + ASSERT_EQ(dtmLabel["SOURCE_PRODUCT_ID"][1].toStdString(), "ESP_042753_1930"); + ASSERT_EQ(dtmLabel["RATIONALE_DESC"][0].toStdString(), "NULL"); + + + PvlObject dtmImage = dtmLabel.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(dtmImage["LINES"], 23); + ASSERT_DOUBLE_EQ(dtmImage["LINE_SAMPLES"], 8); + ASSERT_DOUBLE_EQ(dtmImage["BANDS"], 1); + ASSERT_DOUBLE_EQ(dtmImage["OFFSET"], 0.0); + ASSERT_DOUBLE_EQ(dtmImage["SCALING_FACTOR"], 1.0); + ASSERT_DOUBLE_EQ(dtmImage["SAMPLE_BITS"], 32); + ASSERT_EQ(dtmImage["SAMPLE_BIT_MASK"][0].toStdString(), "2#11111111111111111111111111111111#"); + ASSERT_EQ(dtmImage["SAMPLE_TYPE"][0].toStdString(), "PC_REAL"); + ASSERT_EQ(dtmImage["MISSING_CONSTANT"][0].toStdString(), "16#FF7FFFFB#"); + ASSERT_DOUBLE_EQ(dtmImage["VALID_MINIMUM"], -1884.17); + ASSERT_DOUBLE_EQ(dtmImage["VALID_MAXIMUM"], -1324.12); + + PvlObject dtmProj = dtmLabel.findObject("IMAGE_MAP_PROJECTION"); + ASSERT_EQ(dtmProj["^DATA_SET_MAP_PROJECTION"][0].toStdString(), "DSMAP.CAT"); + ASSERT_EQ(dtmProj["MAP_PROJECTION_TYPE"][0].toStdString(), "EQUIRECTANGULAR"); + ASSERT_EQ(dtmProj["PROJECTION_LATITUDE_TYPE"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_DOUBLE_EQ(dtmProj["A_AXIS_RADIUS"], 3396.19); + ASSERT_DOUBLE_EQ(dtmProj["B_AXIS_RADIUS"], 3396.19); + ASSERT_DOUBLE_EQ(dtmProj["C_AXIS_RADIUS"], 3396.19); + ASSERT_EQ(dtmProj["COORDINATE_SYSTEM_NAME"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_EQ(dtmProj["POSITIVE_LONGITUDE_DIRECTION"][0].toStdString(), "EAST"); + ASSERT_EQ(dtmProj["KEYWORD_LATITUDE_TYPE"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_DOUBLE_EQ(dtmProj["CENTER_LATITUDE"], 0.0); + ASSERT_DOUBLE_EQ(dtmProj["CENTER_LONGITUDE"], 180.0); + ASSERT_DOUBLE_EQ(dtmProj["LINE_FIRST_PIXEL"], 1); + ASSERT_DOUBLE_EQ(dtmProj["LINE_LAST_PIXEL"], 23); + ASSERT_DOUBLE_EQ(dtmProj["SAMPLE_FIRST_PIXEL"], 1); + ASSERT_DOUBLE_EQ(dtmProj["SAMPLE_LAST_PIXEL"], 8); + ASSERT_DOUBLE_EQ(dtmProj["MAP_PROJECTION_ROTATION"], 0.0); + ASSERT_NEAR(dtmProj["MAP_RESOLUTION"], 59.27469, .00001); + ASSERT_DOUBLE_EQ(dtmProj["MAP_SCALE"], 1000.0); + ASSERT_NEAR(dtmProj["MAXIMUM_LATITUDE"], 12.82864, .00001); + ASSERT_NEAR(dtmProj["MINIMUM_LATITUDE"], 12.45094, .00001); + ASSERT_DOUBLE_EQ(dtmProj["LINE_PROJECTION_OFFSET"], 760.5); + ASSERT_DOUBLE_EQ(dtmProj["SAMPLE_PROJECTION_OFFSET"], -10413.5); + ASSERT_NEAR(dtmProj["EASTERNMOST_LONGITUDE"], 355.80733, .00001); + ASSERT_NEAR(dtmProj["WESTERNMOST_LONGITUDE"], 355.68017, .00001); + + + PvlObject dtmView = dtmLabel.findObject("VIEWING_PARAMETERS"); + ASSERT_DOUBLE_EQ(dtmView["NORTH_AZIMUTH"], 270.0); + + + Pvl orthoLabel1(prefix.path()+"/ESP_042252_1930_IRB_B_41_ORTHO.IMG"); + + ASSERT_EQ(orthoLabel1["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel1["RECORD_BYTES"], 40); + ASSERT_DOUBLE_EQ(orthoLabel1["FILE_RECORDS"], 252); + ASSERT_DOUBLE_EQ(orthoLabel1["^IMAGE"], 103); + + ASSERT_EQ(orthoLabel1["DATA_SET_ID"][0].toStdString(), "MRO-M-HIRISE-5-DTM-V1.0"); + ASSERT_EQ(orthoLabel1["PRODUCER_INSTITUTION_NAME"][0].toStdString(), "UNIVERSITY OF ARIZONA"); + ASSERT_EQ(orthoLabel1["PRODUCER_ID"][0].toStdString(), "UA"); + ASSERT_EQ(orthoLabel1["PRODUCER_FULL_NAME"][0].toStdString(), "ALFRED MCEWEN"); + ASSERT_EQ(orthoLabel1["PRODUCT_ID"][0].toStdString(), "ESP_042252_1930_IRB_B_41_ORTHO"); + ASSERT_DOUBLE_EQ(orthoLabel1["PRODUCT_VERSION_ID"], 0.314); + ASSERT_EQ(orthoLabel1["INSTRUMENT_HOST_NAME"][0].toStdString(), "MARS RECONNAISSANCE ORBITER"); + ASSERT_EQ(orthoLabel1["INSTRUMENT_HOST_ID"][0].toStdString(), "MRO"); + ASSERT_EQ(orthoLabel1["INSTRUMENT_NAME"][0].toStdString(), "HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT"); + ASSERT_EQ(orthoLabel1["INSTRUMENT_ID"][0].toStdString(), "HIRISE"); + ASSERT_EQ(orthoLabel1["TARGET_NAME"][0].toStdString(), "MARS"); + ASSERT_EQ(orthoLabel1["SOURCE_PRODUCT_ID"][0].toStdString(), "DTEEZ_042252_1930_042753_1930_A31"); + ASSERT_EQ(orthoLabel1["SOURCE_PRODUCT_ID"][1].toStdString(), "ESP_042252_1930"); + ASSERT_EQ(orthoLabel1["RATIONALE_DESC"][0].toStdString(), "NULL"); + ASSERT_EQ(orthoLabel1["SOFTWARE_NAME"][0].toStdString(), "Socet_Set 5.4.1"); + ASSERT_EQ(orthoLabel1["RATIONALE_DESC"][0].toStdString(), "NULL"); + ASSERT_DOUBLE_EQ(orthoLabel1["LABEL_RECORDS"], 102); + + PvlObject orthoImage1 = orthoLabel1.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(orthoImage1["LINES"], 50); + ASSERT_DOUBLE_EQ(orthoImage1["LINE_SAMPLES"], 40); + ASSERT_DOUBLE_EQ(orthoImage1["BANDS"], 3); + ASSERT_DOUBLE_EQ(orthoImage1["OFFSET"], 0.0); + ASSERT_DOUBLE_EQ(orthoImage1["SCALING_FACTOR"], 1.0); + ASSERT_DOUBLE_EQ(orthoImage1["SAMPLE_BITS"], 8); + ASSERT_EQ(orthoImage1["SAMPLE_TYPE"][0].toStdString(), "MSB_UNSIGNED_INTEGER"); + ASSERT_EQ(orthoImage1["BAND_STORAGE_TYPE"][0].toStdString(), "BAND_SEQUENTIAL"); + ASSERT_DOUBLE_EQ(orthoImage1["CORE_NULL"], 0); + ASSERT_DOUBLE_EQ(orthoImage1["CORE_LOW_REPR_SATURATION"], 1); + ASSERT_DOUBLE_EQ(orthoImage1["CORE_LOW_INSTR_SATURATION"], 1); + ASSERT_DOUBLE_EQ(orthoImage1["CORE_HIGH_REPR_SATURATION"], 255); + ASSERT_DOUBLE_EQ(orthoImage1["CORE_HIGH_INSTR_SATURATION"], 255); + + PvlObject orthoProj1 = orthoLabel1.findObject("IMAGE_MAP_PROJECTION"); + ASSERT_EQ(orthoProj1["^DATA_SET_MAP_PROJECTION"][0].toStdString(), "DSMAP.CAT"); + ASSERT_EQ(orthoProj1["MAP_PROJECTION_TYPE"][0].toStdString(), "EQUIRECTANGULAR"); + ASSERT_EQ(orthoProj1["PROJECTION_LATITUDE_TYPE"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_DOUBLE_EQ(orthoProj1["A_AXIS_RADIUS"], 3396.19); + ASSERT_DOUBLE_EQ(orthoProj1["B_AXIS_RADIUS"], 3396.19); + ASSERT_DOUBLE_EQ(orthoProj1["C_AXIS_RADIUS"], 3396.19); + ASSERT_EQ(orthoProj1["COORDINATE_SYSTEM_NAME"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_EQ(orthoProj1["POSITIVE_LONGITUDE_DIRECTION"][0].toStdString(), "EAST"); + ASSERT_EQ(orthoProj1["KEYWORD_LATITUDE_TYPE"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_DOUBLE_EQ(orthoProj1["CENTER_LATITUDE"], 0.0); + ASSERT_DOUBLE_EQ(orthoProj1["CENTER_LONGITUDE"], 180.0); + ASSERT_DOUBLE_EQ(orthoProj1["LINE_FIRST_PIXEL"], 1); + ASSERT_DOUBLE_EQ(orthoProj1["LINE_LAST_PIXEL"], 50); + ASSERT_DOUBLE_EQ(orthoProj1["SAMPLE_FIRST_PIXEL"], 1); + ASSERT_DOUBLE_EQ(orthoProj1["SAMPLE_LAST_PIXEL"], 40); + ASSERT_DOUBLE_EQ(orthoProj1["MAP_PROJECTION_ROTATION"], 0.0); + ASSERT_NEAR(orthoProj1["MAP_RESOLUTION"], 117259.25436, .00001); + ASSERT_NEAR(orthoProj1["MAP_SCALE"], 0.50550, .00001); + ASSERT_NEAR(orthoProj1["MAXIMUM_LATITUDE"], 12.82848, .00001); + ASSERT_NEAR(orthoProj1["MINIMUM_LATITUDE"], 12.82806, .00001); + ASSERT_DOUBLE_EQ(orthoProj1["LINE_PROJECTION_OFFSET"], 1504258.5); + ASSERT_DOUBLE_EQ(orthoProj1["SAMPLE_PROJECTION_OFFSET"], -20600155.500001); + ASSERT_NEAR(orthoProj1["EASTERNMOST_LONGITUDE"], 355.68076, .00001); + ASSERT_NEAR(orthoProj1["WESTERNMOST_LONGITUDE"], 355.68041, .00001); + ASSERT_EQ(orthoProj1["FIRST_STANDARD_PARALLEL"][0].toStdString(), "N/A"); + ASSERT_EQ(orthoProj1["SECOND_STANDARD_PARALLEL"][0].toStdString(), "N/A"); + + + PvlObject orthoView1 = orthoLabel1.findObject("VIEWING_PARAMETERS"); + ASSERT_DOUBLE_EQ(orthoView1["NORTH_AZIMUTH"], 270.0); + + + Pvl orthoLabel2(prefix.path()+"/ESP_042252_1930_IRB_D_31_ORTHO.IMG"); + + ASSERT_EQ(orthoLabel2["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel2["RECORD_BYTES"], 40); + ASSERT_DOUBLE_EQ(orthoLabel2["FILE_RECORDS"], 252); + ASSERT_DOUBLE_EQ(orthoLabel2["^IMAGE"], 103); + + ASSERT_EQ(orthoLabel2["DATA_SET_ID"][0].toStdString(), "MRO-M-HIRISE-5-DTM-V1.0"); + ASSERT_EQ(orthoLabel2["PRODUCER_INSTITUTION_NAME"][0].toStdString(), "UNIVERSITY OF ARIZONA"); + ASSERT_EQ(orthoLabel2["PRODUCER_ID"][0].toStdString(), "UA"); + ASSERT_EQ(orthoLabel2["PRODUCER_FULL_NAME"][0].toStdString(), "ALFRED MCEWEN"); + ASSERT_EQ(orthoLabel2["PRODUCT_ID"][0].toStdString(), "ESP_042252_1930_IRB_D_31_ORTHO"); + ASSERT_DOUBLE_EQ(orthoLabel2["PRODUCT_VERSION_ID"], 0.314); + ASSERT_EQ(orthoLabel2["INSTRUMENT_HOST_NAME"][0].toStdString(), "MARS RECONNAISSANCE ORBITER"); + ASSERT_EQ(orthoLabel2["INSTRUMENT_HOST_ID"][0].toStdString(), "MRO"); + ASSERT_EQ(orthoLabel2["INSTRUMENT_NAME"][0].toStdString(), "HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT"); + ASSERT_EQ(orthoLabel2["INSTRUMENT_ID"][0].toStdString(), "HIRISE"); + ASSERT_EQ(orthoLabel2["TARGET_NAME"][0].toStdString(), "MARS"); + ASSERT_EQ(orthoLabel2["SOURCE_PRODUCT_ID"][0].toStdString(), "DTEEZ_042252_1930_042753_1930_A31"); + ASSERT_EQ(orthoLabel2["SOURCE_PRODUCT_ID"][1].toStdString(), "ESP_042252_1930"); + ASSERT_EQ(orthoLabel2["RATIONALE_DESC"][0].toStdString(), "NULL"); + ASSERT_EQ(orthoLabel2["SOFTWARE_NAME"][0].toStdString(), "Socet_Set 5.4.1"); + ASSERT_EQ(orthoLabel2["RATIONALE_DESC"][0].toStdString(), "NULL"); + ASSERT_DOUBLE_EQ(orthoLabel2["LABEL_RECORDS"], 102); + + PvlObject orthoImage2 = orthoLabel2.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(orthoImage2["LINES"], 50); + ASSERT_DOUBLE_EQ(orthoImage2["LINE_SAMPLES"], 40); + ASSERT_DOUBLE_EQ(orthoImage2["BANDS"], 3); + ASSERT_DOUBLE_EQ(orthoImage2["OFFSET"], 0.0); + ASSERT_DOUBLE_EQ(orthoImage2["SCALING_FACTOR"], 1.0); + ASSERT_DOUBLE_EQ(orthoImage2["SAMPLE_BITS"], 8); + ASSERT_EQ(orthoImage2["SAMPLE_TYPE"][0].toStdString(), "MSB_UNSIGNED_INTEGER"); + ASSERT_EQ(orthoImage2["BAND_STORAGE_TYPE"][0].toStdString(), "BAND_SEQUENTIAL"); + ASSERT_DOUBLE_EQ(orthoImage2["CORE_NULL"], 0); + ASSERT_DOUBLE_EQ(orthoImage2["CORE_LOW_REPR_SATURATION"], 1); + ASSERT_DOUBLE_EQ(orthoImage2["CORE_LOW_INSTR_SATURATION"], 1); + ASSERT_DOUBLE_EQ(orthoImage2["CORE_HIGH_REPR_SATURATION"], 255); + ASSERT_DOUBLE_EQ(orthoImage2["CORE_HIGH_INSTR_SATURATION"], 255); + + PvlObject orthoProj2 = orthoLabel2.findObject("IMAGE_MAP_PROJECTION"); + ASSERT_EQ(orthoProj2["^DATA_SET_MAP_PROJECTION"][0].toStdString(), "DSMAP.CAT"); + ASSERT_EQ(orthoProj2["MAP_PROJECTION_TYPE"][0].toStdString(), "EQUIRECTANGULAR"); + ASSERT_EQ(orthoProj2["PROJECTION_LATITUDE_TYPE"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_DOUBLE_EQ(orthoProj2["A_AXIS_RADIUS"], 3396.19); + ASSERT_DOUBLE_EQ(orthoProj2["B_AXIS_RADIUS"], 3396.19); + ASSERT_DOUBLE_EQ(orthoProj2["C_AXIS_RADIUS"], 3396.19); + ASSERT_EQ(orthoProj2["COORDINATE_SYSTEM_NAME"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_EQ(orthoProj2["POSITIVE_LONGITUDE_DIRECTION"][0].toStdString(), "EAST"); + ASSERT_EQ(orthoProj2["KEYWORD_LATITUDE_TYPE"][0].toStdString(), "PLANETOCENTRIC"); + ASSERT_DOUBLE_EQ(orthoProj2["CENTER_LATITUDE"], 0.0); + ASSERT_DOUBLE_EQ(orthoProj2["CENTER_LONGITUDE"], 180.0); + ASSERT_DOUBLE_EQ(orthoProj2["LINE_FIRST_PIXEL"], 1); + ASSERT_DOUBLE_EQ(orthoProj2["LINE_LAST_PIXEL"], 50); + ASSERT_DOUBLE_EQ(orthoProj2["SAMPLE_FIRST_PIXEL"], 1); + ASSERT_DOUBLE_EQ(orthoProj2["SAMPLE_LAST_PIXEL"], 40); + ASSERT_DOUBLE_EQ(orthoProj2["MAP_PROJECTION_ROTATION"], 0.0); + ASSERT_NEAR(orthoProj2["MAP_RESOLUTION"], 29314.81359, .00001); + ASSERT_NEAR(orthoProj2["MAP_SCALE"], 2.02200, .00001); + ASSERT_NEAR(orthoProj2["MAXIMUM_LATITUDE"], 12.82801, .00001); + ASSERT_NEAR(orthoProj2["MINIMUM_LATITUDE"], 12.82631, .00001); + ASSERT_DOUBLE_EQ(orthoProj2["LINE_PROJECTION_OFFSET"], 376050.5); + ASSERT_DOUBLE_EQ(orthoProj2["SAMPLE_PROJECTION_OFFSET"], -5150060.5); + ASSERT_NEAR(orthoProj2["EASTERNMOST_LONGITUDE"], 355.68250, .00001); + ASSERT_NEAR(orthoProj2["WESTERNMOST_LONGITUDE"], 355.68114, .00001); + ASSERT_EQ(orthoProj2["FIRST_STANDARD_PARALLEL"][0].toStdString(), "N/A"); + ASSERT_EQ(orthoProj2["SECOND_STANDARD_PARALLEL"][0].toStdString(), "N/A"); + + PvlObject orthoView2 = orthoLabel2.findObject("VIEWING_PARAMETERS"); + ASSERT_DOUBLE_EQ(orthoView2["NORTH_AZIMUTH"], 270.0); + +} + + +TEST(Hidtmgen, HidtmgenTestDtmOnly){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "paramspvl=data/hidtmgen/dtmOnly/params.pvl", + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/DTEEZ_042252_1930_042753_1930_A15.IMG"); + + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 32); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 155); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 133); +} + + +TEST(Hidtmgen, HidtmgenTestEqui){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/DTM_Zumba_1m_forPDS_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/equi/orthoInputList.txt", + "paramspvl=data/hidtmgen/equi/params.pvl", + "orthosequencenumberlist=data/hidtmgen/equi/sequenceNumbers.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/DTEEZ_002118_1510_003608_1510_A02.IMG"); + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 28); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 203); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 183); + + PvlObject dtmProj = dtmLabel.findObject("IMAGE_MAP_PROJECTION"); + ASSERT_EQ(dtmProj["MAP_PROJECTION_TYPE"][0].toStdString(), "EQUIRECTANGULAR"); + + + Pvl orthoLabel(prefix.path()+"/PSP_002118_1510_RED_C_01_ORTHO.IMG"); + ASSERT_EQ(orthoLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel["RECORD_BYTES"], 50); + ASSERT_DOUBLE_EQ(orthoLabel["FILE_RECORDS"], 132); + ASSERT_DOUBLE_EQ(orthoLabel["^IMAGE"], 83); + + PvlObject orthoProj = orthoLabel.findObject("IMAGE_MAP_PROJECTION"); + ASSERT_EQ(orthoProj["MAP_PROJECTION_TYPE"][0].toStdString(), "EQUIRECTANGULAR"); +} + + +TEST(Hidtmgen, HidtmgenTestErrorEmptyOrthoFromList){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputListEmpty.txt", + "paramspvl=data/hidtmgen/error/params.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("File [data/hidtmgen/error/orthoInputListEmpty.txt] contains no data.")); + } +} + + +TEST(Hidtmgen, HidtmgenTestErrorInvalidDtm){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2Item.txt", + "paramspvl=data/hidtmgen/error/params.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("Input cube [data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub] does not appear to be a DTM.")); + } +} + + +TEST(Hidtmgen, HidtmgenTestErrorNoInput){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "outputdir=" + prefix.path(), + "paramspvl=data/hidtmgen/error/params.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("User must supply DTM or ORTHOFROMLIST or both.")); + } +} + +TEST(Hidtmgen, HidtmgenTestErrorDtmInvalidProjection){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres_sinusoidal.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2Item.txt", + "paramspvl=data/hidtmgen/error/params.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("The projection type [SINUSOIDAL] is not supported.")); + } +} + +TEST(Hidtmgen, HidtmgenTestErrorInputSeqMismatch){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2Item.txt", + "paramspvl=data/hidtmgen/error/params.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers1item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("Output sequence number list must correspond to the input ortho list.")); + } +} + + +TEST(Hidtmgen, HidtmgenTestErrorInputOutputMismatch){ + QTemporaryDir prefix; + QVector args = {"defaultnames=FALSE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "dtm_product_id=xyz", + "dtmto=" + prefix.path() + "/xyz.IMG", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2Item.txt", + "paramspvl=data/hidtmgen/error/params.pvl", + "orthotolist=data/hidtmgen/error/orthoToList1Item.txt", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt", + "orthoproductidlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("Output ortho list and product id list must correspond to the input ortho list.")); + } +} + + +TEST(Hidtmgen, HidtmgenTestErrorInvalidInstitution){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2Item.txt", + "paramspvl=data/hidtmgen/error/invalidProducingInst.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("PRODUCING_INSTITUTION value [USGS] in the PARAMSPVL file must be a single character.")); + } +} + +TEST(Hidtmgen, HidtmgenTestErrorInvalidVersionId){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2Item.txt", + "paramspvl=data/hidtmgen/error/invalidVersionId.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("Version number [-4.0] is invalid.")); + } +} + + +TEST(Hidtmgen, HidtmgenTestErrorDtmInvalidBandSize){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/DTM_2Bands_cropped.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2item.txt", + "paramspvl=data/hidtmgen/error/params.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers2item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("Input cube [data/hidtmgen/dtm/DTM_2Bands_cropped.cub] does not appear to be a DTM.")); + } +} + + +TEST(Hidtmgen, HidtmgenTestErrorOrthoInvalidBandSize){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/error/orthoInputList2Bands.txt", + "paramspvl=data/hidtmgen/error/params.pvl", + "orthosequencenumberlist=data/hidtmgen/error/sequenceNumbers1item.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + FAIL() << "Should throw an exception" << std::endl; + } + catch (IException &e) { + EXPECT_THAT(e.what(), HasSubstr("The file [data/hidtmgen/ortho/2BandImage.cub] found in the ORTHOFROMLIST is not a valid orthorectified image. Band count must be 1 (RED) or 3 (color).")); + } +} + +TEST(Hidtmgen, HidtmgenTestNonDefaultNames){ + QTemporaryDir prefix; + QVector args = {"defaultnames=FALSE", + "dtm=data/hidtmgen/dtm/DTM_Zumba_1m_forPDS_lowres.cub", + "outputdir=" + prefix.path(), + "dtmto="+ prefix.path() + "/dtm.img", + "orthofromlist=data/hidtmgen/nonDefaultNames/orthoInputList.txt", + "orthotolist=data/hidtmgen/nonDefaultNames/orthoOutputFiles.lis", + "orthoproductidlist=data/hidtmgen/nonDefaultNames/orthoOutputProductIds.lis", + "paramspvl=data/hidtmgen/nonDefaultNames/params.pvl", + "dtm_product_id=DtmProduct" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/dtm.img"); + + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 28); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 203); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 183); + +} + + +TEST(Hidtmgen, HidtmgenTestOrthoOnly){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/orthoOnly/orthoInputList.txt", + "paramspvl=data/hidtmgen/orthoOnly/params.pvl", + "orthosequencenumberlist=data/hidtmgen/orthoOnly/sequenceNumbers.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl orthoLabel(prefix.path()+"/ESP_042252_1930_IRB_D_31_ORTHO.IMG"); + ASSERT_EQ(orthoLabel["SOURCE_PRODUCT_ID"][0].toStdString(), "DTems_xxxxxx_xxxx_yyyyyy_yyyy_vnn"); + ASSERT_EQ(orthoLabel["SOURCE_PRODUCT_ID"][1].toStdString(), "ESP_042252_1930"); + ASSERT_EQ(orthoLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel["RECORD_BYTES"], 40); + ASSERT_DOUBLE_EQ(orthoLabel["FILE_RECORDS"], 254); + ASSERT_DOUBLE_EQ(orthoLabel["^IMAGE"], 105); + +} + + +TEST(Hidtmgen, HidtmgenTestOutputTypesAll832){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/outputTypes/orthoInputList.txt", + "paramspvl=data/hidtmgen/outputTypes/params.pvl", + "endian=msb", + "null=FALSE", + "LIS=TRUE", + "LRS=TRUE", + "HIS=TRUE", + "HRS=TRUE", + "dtmbittype=8BIT", + "orthobittype=32bit", + "orthosequencenumberlist=data/hidtmgen/outputTypes/sequenceNumbers.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/DTEEZ_042252_1930_042753_1930_A31.IMG"); + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 8); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 558); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 536); + + + PvlObject dtmImage = dtmLabel.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(dtmImage["SAMPLE_BITS"], 8); + ASSERT_EQ(dtmImage["SAMPLE_TYPE"][0].toStdString(), "MSB_UNSIGNED_INTEGER"); + + Pvl orthoLabel(prefix.path()+"/ESP_042252_1930_IRB_D_31_ORTHO.IMG"); + ASSERT_EQ(orthoLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel["RECORD_BYTES"], 160); + ASSERT_DOUBLE_EQ(orthoLabel["FILE_RECORDS"], 177); + ASSERT_DOUBLE_EQ(orthoLabel["^IMAGE"], 28); + + PvlObject orthoImage = orthoLabel.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(orthoImage["SAMPLE_BITS"], 32); + ASSERT_EQ(orthoImage["SAMPLE_TYPE"][0].toStdString(), "IEEE_REAL"); + +} + + +TEST(Hidtmgen, HidtmgenTestOutputTypesAllU16S16){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/outputTypes/orthoInputList.txt", + "paramspvl=data/hidtmgen/outputTypes/params2.pvl", + "endian=msb", + "null=FALSE", + "LIS=TRUE", + "LRS=TRUE", + "HIS=TRUE", + "HRS=TRUE", + "dtmbittype=u16bit", + "orthobittype=s16bit", + "orthosequencenumberlist=data/hidtmgen/outputTypes/sequenceNumbers.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/DTEEZ_042252_1930_042753_1930_A07.IMG"); + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 16); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 288); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 266); + + + PvlObject dtmImage = dtmLabel.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(dtmImage["SAMPLE_BITS"], 16); + ASSERT_EQ(dtmImage["SAMPLE_TYPE"][0].toStdString(), "MSB_UNSIGNED_INTEGER"); + + Pvl orthoLabel(prefix.path()+"/ESP_042252_1930_IRB_D_31_ORTHO.IMG"); + ASSERT_EQ(orthoLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel["RECORD_BYTES"], 80); + ASSERT_DOUBLE_EQ(orthoLabel["FILE_RECORDS"], 202); + ASSERT_DOUBLE_EQ(orthoLabel["^IMAGE"], 53); + + PvlObject orthoImage = orthoLabel.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(orthoImage["SAMPLE_BITS"], 16); + ASSERT_EQ(orthoImage["SAMPLE_TYPE"][0].toStdString(), "MSB_INTEGER"); +} + + +TEST(Hidtmgen, HidtmgenTestOutputTypesNoneS16U16){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/outputTypes/orthoInputList.txt", + "paramspvl=data/hidtmgen/outputTypes/params2.pvl", + "endian=msb", + "null=FALSE", + "LIS=FALSE", + "LRS=FALSE", + "HIS=FALSE", + "HRS=FALSE", + "dtmbittype=S16BIT", + "orthobittype=U16BIT", + "orthosequencenumberlist=data/hidtmgen/outputTypes/sequenceNumbers.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/DTEEZ_042252_1930_042753_1930_A07.IMG"); + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 16); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 288); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 266); + + + PvlObject dtmImage = dtmLabel.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(dtmImage["SAMPLE_BITS"], 16); + ASSERT_EQ(dtmImage["SAMPLE_TYPE"][0].toStdString(), "MSB_INTEGER"); + + Pvl orthoLabel(prefix.path()+"/ESP_042252_1930_IRB_D_31_ORTHO.IMG"); + ASSERT_EQ(orthoLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel["RECORD_BYTES"], 80); + ASSERT_DOUBLE_EQ(orthoLabel["FILE_RECORDS"], 202); + ASSERT_DOUBLE_EQ(orthoLabel["^IMAGE"], 53); + + PvlObject orthoImage = orthoLabel.findObject("IMAGE"); + ASSERT_DOUBLE_EQ(orthoImage["SAMPLE_BITS"], 16); + ASSERT_EQ(orthoImage["SAMPLE_TYPE"][0].toStdString(), "MSB_UNSIGNED_INTEGER"); +} + + +TEST(Hidtmgen, HidtmgenTestPolar){ + QTemporaryDir prefix; + QVector args = {"defaultnames=TRUE", + "dtm=data/hidtmgen/dtm/Polar_Crater_1_1m_ngate_edited2_forPDS_lowres.cub", + "paramspvl=data/hidtmgen/polar/params.pvl", + "outputdir=" + prefix.path(), + "orthofromlist=data/hidtmgen/polar/orthoInputList.txt", + "orthosequence=data/hidtmgen/polar/orthosequencenumberlist.txt" + }; + + UserInterface options(APP_XML, args); + try { + hidtmgen(options); + } + catch (IException &e) { + FAIL() << "Unable to HIRISE generate PDS products: " << e.toString().toStdString().c_str() << std::endl; + } + + Pvl dtmLabel(prefix.path()+"/DTEPZ_009404_2635_010221_2635_Z12.IMG"); + ASSERT_EQ(dtmLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(dtmLabel["RECORD_BYTES"], 52); + ASSERT_DOUBLE_EQ(dtmLabel["FILE_RECORDS"], 96); + ASSERT_DOUBLE_EQ(dtmLabel["^IMAGE"], 85); + + PvlObject dtmProj = dtmLabel.findObject("IMAGE_MAP_PROJECTION"); + ASSERT_EQ(dtmProj["MAP_PROJECTION_TYPE"][0].toStdString(), "POLAR STEREOGRAPHIC"); + + Pvl orthoLabel(prefix.path()+"/PSP_009404_2635_RED_C_1_ORTHO.IMG"); + ASSERT_EQ(orthoLabel["RECORD_TYPE"][0].toStdString(), "FIXED_LENGTH"); + ASSERT_DOUBLE_EQ(orthoLabel["RECORD_BYTES"], 50); + ASSERT_DOUBLE_EQ(orthoLabel["FILE_RECORDS"], 115); + ASSERT_DOUBLE_EQ(orthoLabel["^IMAGE"], 66); + + PvlObject orthoProj = orthoLabel.findObject("IMAGE_MAP_PROJECTION"); + ASSERT_EQ(orthoProj["MAP_PROJECTION_TYPE"][0].toStdString(), "POLAR STEREOGRAPHIC"); +} diff --git a/isis/tests/data/hidtmgen/color/orthoInputList.txt b/isis/tests/data/hidtmgen/color/orthoInputList.txt new file mode 100644 index 0000000000..8013991ee4 --- /dev/null +++ b/isis/tests/data/hidtmgen/color/orthoInputList.txt @@ -0,0 +1,2 @@ +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub diff --git a/isis/tests/data/hidtmgen/color/params.pvl b/isis/tests/data/hidtmgen/color/params.pvl new file mode 100644 index 0000000000..48abc7486b --- /dev/null +++ b/isis/tests/data/hidtmgen/color/params.pvl @@ -0,0 +1,12 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "0.314" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "" +DTM_SOURCE_PRODUCT_ID = (ESP_042252_1930, ESP_042753_1930) +ORTHO_SOURCE_DTM_ID = dtmID +END diff --git a/isis/tests/data/hidtmgen/color/sequenceNumbers.txt b/isis/tests/data/hidtmgen/color/sequenceNumbers.txt new file mode 100644 index 0000000000..bb5cf8eceb --- /dev/null +++ b/isis/tests/data/hidtmgen/color/sequenceNumbers.txt @@ -0,0 +1,2 @@ +31 +41 diff --git a/isis/tests/data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub b/isis/tests/data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub new file mode 100644 index 0000000000..a4dc4a7c15 Binary files /dev/null and b/isis/tests/data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres.cub differ diff --git a/isis/tests/data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres_sinusoidal.cub b/isis/tests/data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres_sinusoidal.cub new file mode 100644 index 0000000000..cd30589f3a Binary files /dev/null and b/isis/tests/data/hidtmgen/dtm/Ares4_Marth_Crater_3557E_126N_ngate_03_lowres_sinusoidal.cub differ diff --git a/isis/tests/data/hidtmgen/dtm/DTM_2Bands_cropped.cub b/isis/tests/data/hidtmgen/dtm/DTM_2Bands_cropped.cub new file mode 100644 index 0000000000..63fc5a96a9 Binary files /dev/null and b/isis/tests/data/hidtmgen/dtm/DTM_2Bands_cropped.cub differ diff --git a/isis/tests/data/hidtmgen/dtm/DTM_Zumba_1m_forPDS_lowres.cub b/isis/tests/data/hidtmgen/dtm/DTM_Zumba_1m_forPDS_lowres.cub new file mode 100644 index 0000000000..adb45ea84a Binary files /dev/null and b/isis/tests/data/hidtmgen/dtm/DTM_Zumba_1m_forPDS_lowres.cub differ diff --git a/isis/tests/data/hidtmgen/dtm/Polar_Crater_1_1m_ngate_edited2_forPDS_lowres.cub b/isis/tests/data/hidtmgen/dtm/Polar_Crater_1_1m_ngate_edited2_forPDS_lowres.cub new file mode 100644 index 0000000000..7750606f01 Binary files /dev/null and b/isis/tests/data/hidtmgen/dtm/Polar_Crater_1_1m_ngate_edited2_forPDS_lowres.cub differ diff --git a/isis/tests/data/hidtmgen/dtmOnly/params.pvl b/isis/tests/data/hidtmgen/dtmOnly/params.pvl new file mode 100644 index 0000000000..411e7794d4 --- /dev/null +++ b/isis/tests/data/hidtmgen/dtmOnly/params.pvl @@ -0,0 +1,12 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "1.5" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "" +DTM_SOURCE_PRODUCT_ID = (ESP_042252_1930, ESP_042753_1930) +ORTHO_SOURCE_DTM_ID = dtmID +END diff --git a/isis/tests/data/hidtmgen/equi/orthoInputList.txt b/isis/tests/data/hidtmgen/equi/orthoInputList.txt new file mode 100644 index 0000000000..9ec35944c0 --- /dev/null +++ b/isis/tests/data/hidtmgen/equi/orthoInputList.txt @@ -0,0 +1,2 @@ +data/hidtmgen/ortho/PSP_002118_1510_1m_o_forPDS_cropped.cub +data/hidtmgen/ortho/PSP_002118_1510_25cm_o_forPDS_cropped.cub diff --git a/isis/tests/data/hidtmgen/equi/params.pvl b/isis/tests/data/hidtmgen/equi/params.pvl new file mode 100644 index 0000000000..de30a25ee0 --- /dev/null +++ b/isis/tests/data/hidtmgen/equi/params.pvl @@ -0,0 +1,11 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "2.0" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "Equi test" +DTM_SOURCE_PRODUCT_ID = (PSP_002118_1510, PSP_003608_1510) +END diff --git a/isis/tests/data/hidtmgen/equi/sequenceNumbers.txt b/isis/tests/data/hidtmgen/equi/sequenceNumbers.txt new file mode 100644 index 0000000000..a0c0404ff2 --- /dev/null +++ b/isis/tests/data/hidtmgen/equi/sequenceNumbers.txt @@ -0,0 +1,2 @@ +01 +02 diff --git a/isis/tests/data/hidtmgen/error/invalidProducingInst.pvl b/isis/tests/data/hidtmgen/error/invalidProducingInst.pvl new file mode 100644 index 0000000000..eca722d4e9 --- /dev/null +++ b/isis/tests/data/hidtmgen/error/invalidProducingInst.pvl @@ -0,0 +1,12 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "0.314" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "USGS" +RATIONALE_DESC = "" +DTM_SOURCE_PRODUCT_ID = (ESP_042252_1930, ESP_042753_1930) +ORTHO_SOURCE_DTM_ID = dtmID +END diff --git a/isis/tests/data/hidtmgen/error/invalidVersionId.pvl b/isis/tests/data/hidtmgen/error/invalidVersionId.pvl new file mode 100644 index 0000000000..e080e6e2d1 --- /dev/null +++ b/isis/tests/data/hidtmgen/error/invalidVersionId.pvl @@ -0,0 +1,14 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "-4" +PRODUCT_VERSION_ID = NULL +PRODUCT_VERSION_ID = "4" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "Testing invalid version ID" +DTM_SOURCE_PRODUCT_ID = (ESP_042252_1930, ESP_042753_1930) +ORTHO_SOURCE_DTM_ID = dtmID +END diff --git a/isis/tests/data/hidtmgen/error/orthoInputList2Bands.txt b/isis/tests/data/hidtmgen/error/orthoInputList2Bands.txt new file mode 100644 index 0000000000..22f47c086a --- /dev/null +++ b/isis/tests/data/hidtmgen/error/orthoInputList2Bands.txt @@ -0,0 +1 @@ +data/hidtmgen/ortho/2BandImage.cub diff --git a/isis/tests/data/hidtmgen/error/orthoInputList2Item.txt b/isis/tests/data/hidtmgen/error/orthoInputList2Item.txt new file mode 100644 index 0000000000..8013991ee4 --- /dev/null +++ b/isis/tests/data/hidtmgen/error/orthoInputList2Item.txt @@ -0,0 +1,2 @@ +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub diff --git a/isis/tests/data/hidtmgen/error/orthoInputListEmpty.txt b/isis/tests/data/hidtmgen/error/orthoInputListEmpty.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/isis/tests/data/hidtmgen/error/orthoOutputFiles.lis b/isis/tests/data/hidtmgen/error/orthoOutputFiles.lis new file mode 100644 index 0000000000..965fbf681b --- /dev/null +++ b/isis/tests/data/hidtmgen/error/orthoOutputFiles.lis @@ -0,0 +1,2 @@ +ORTHO1.IMG +ORTHO2.IMG diff --git a/isis/tests/data/hidtmgen/error/orthoProdList3Item.txt b/isis/tests/data/hidtmgen/error/orthoProdList3Item.txt new file mode 100644 index 0000000000..c739c69b1d --- /dev/null +++ b/isis/tests/data/hidtmgen/error/orthoProdList3Item.txt @@ -0,0 +1,3 @@ +Ortho1Product +Ortho2Product +Ortho3Product diff --git a/isis/tests/data/hidtmgen/error/orthoToList1Item.txt b/isis/tests/data/hidtmgen/error/orthoToList1Item.txt new file mode 100644 index 0000000000..cf7b6b42a0 --- /dev/null +++ b/isis/tests/data/hidtmgen/error/orthoToList1Item.txt @@ -0,0 +1 @@ +ORTHO1.IMG diff --git a/isis/tests/data/hidtmgen/error/params.pvl b/isis/tests/data/hidtmgen/error/params.pvl new file mode 100644 index 0000000000..48abc7486b --- /dev/null +++ b/isis/tests/data/hidtmgen/error/params.pvl @@ -0,0 +1,12 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "0.314" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "" +DTM_SOURCE_PRODUCT_ID = (ESP_042252_1930, ESP_042753_1930) +ORTHO_SOURCE_DTM_ID = dtmID +END diff --git a/isis/tests/data/hidtmgen/error/sequenceNumbers1item.txt b/isis/tests/data/hidtmgen/error/sequenceNumbers1item.txt new file mode 100644 index 0000000000..e85087affd --- /dev/null +++ b/isis/tests/data/hidtmgen/error/sequenceNumbers1item.txt @@ -0,0 +1 @@ +31 diff --git a/isis/tests/data/hidtmgen/error/sequenceNumbers2item.txt b/isis/tests/data/hidtmgen/error/sequenceNumbers2item.txt new file mode 100644 index 0000000000..bb5cf8eceb --- /dev/null +++ b/isis/tests/data/hidtmgen/error/sequenceNumbers2item.txt @@ -0,0 +1,2 @@ +31 +41 diff --git a/isis/tests/data/hidtmgen/nonDefaultNames/orthoInputList.txt b/isis/tests/data/hidtmgen/nonDefaultNames/orthoInputList.txt new file mode 100644 index 0000000000..8013991ee4 --- /dev/null +++ b/isis/tests/data/hidtmgen/nonDefaultNames/orthoInputList.txt @@ -0,0 +1,2 @@ +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub diff --git a/isis/tests/data/hidtmgen/nonDefaultNames/orthoOutputFiles.lis b/isis/tests/data/hidtmgen/nonDefaultNames/orthoOutputFiles.lis new file mode 100644 index 0000000000..965fbf681b --- /dev/null +++ b/isis/tests/data/hidtmgen/nonDefaultNames/orthoOutputFiles.lis @@ -0,0 +1,2 @@ +ORTHO1.IMG +ORTHO2.IMG diff --git a/isis/tests/data/hidtmgen/nonDefaultNames/orthoOutputProductIds.lis b/isis/tests/data/hidtmgen/nonDefaultNames/orthoOutputProductIds.lis new file mode 100644 index 0000000000..154473caa6 --- /dev/null +++ b/isis/tests/data/hidtmgen/nonDefaultNames/orthoOutputProductIds.lis @@ -0,0 +1,2 @@ +Ortho1Product +Ortho2Product diff --git a/isis/tests/data/hidtmgen/nonDefaultNames/params.pvl b/isis/tests/data/hidtmgen/nonDefaultNames/params.pvl new file mode 100644 index 0000000000..febef8712a --- /dev/null +++ b/isis/tests/data/hidtmgen/nonDefaultNames/params.pvl @@ -0,0 +1,11 @@ +DATA_SET_ID = "DataSetIdFromParamsPvl" +DATA_SET_NAME = "Data Set Name From PARAMSPVL" +PRODUCER_INSTITUTION_NAME = "Producer Institution Name from PARAMSPVL" +PRODUCER_ID = "Producer Id from PARAMSPVL" +PRODUCER_FULL_NAME = "Producer Full Name from PARAMSPVL" +PRODUCING_INSTITUTION = "Z" +PRODUCT_VERSION_ID = "3.14" +RATIONALE_DESC = "Test DefaultNames=false" +SOFTWARE_NAME = "Software Name from PARAMSPVL" +DTM_SOURCE_PRODUCT_ID = (PSP_002118_1510, PSP_003608_1510) +END diff --git a/isis/tests/data/hidtmgen/ortho/2BandImage.cub b/isis/tests/data/hidtmgen/ortho/2BandImage.cub new file mode 100644 index 0000000000..718dbb96fb Binary files /dev/null and b/isis/tests/data/hidtmgen/ortho/2BandImage.cub differ diff --git a/isis/tests/data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub b/isis/tests/data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub new file mode 100644 index 0000000000..b5deaeddb2 Binary files /dev/null and b/isis/tests/data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub differ diff --git a/isis/tests/data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub b/isis/tests/data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub new file mode 100644 index 0000000000..092388f196 Binary files /dev/null and b/isis/tests/data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub differ diff --git a/isis/tests/data/hidtmgen/ortho/PSP_002118_1510_1m_o_forPDS_cropped.cub b/isis/tests/data/hidtmgen/ortho/PSP_002118_1510_1m_o_forPDS_cropped.cub new file mode 100644 index 0000000000..04bb7d0e82 Binary files /dev/null and b/isis/tests/data/hidtmgen/ortho/PSP_002118_1510_1m_o_forPDS_cropped.cub differ diff --git a/isis/tests/data/hidtmgen/ortho/PSP_002118_1510_25cm_o_forPDS_cropped.cub b/isis/tests/data/hidtmgen/ortho/PSP_002118_1510_25cm_o_forPDS_cropped.cub new file mode 100644 index 0000000000..8bc8706204 Binary files /dev/null and b/isis/tests/data/hidtmgen/ortho/PSP_002118_1510_25cm_o_forPDS_cropped.cub differ diff --git a/isis/tests/data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_1m_o_forPDS_cropped.cub b/isis/tests/data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_1m_o_forPDS_cropped.cub new file mode 100644 index 0000000000..a66378465c Binary files /dev/null and b/isis/tests/data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_1m_o_forPDS_cropped.cub differ diff --git a/isis/tests/data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_25cm_o_forPDS_cropped.cub b/isis/tests/data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_25cm_o_forPDS_cropped.cub new file mode 100644 index 0000000000..56c3504a99 Binary files /dev/null and b/isis/tests/data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_25cm_o_forPDS_cropped.cub differ diff --git a/isis/tests/data/hidtmgen/orthoOnly/orthoInputList.txt b/isis/tests/data/hidtmgen/orthoOnly/orthoInputList.txt new file mode 100644 index 0000000000..8013991ee4 --- /dev/null +++ b/isis/tests/data/hidtmgen/orthoOnly/orthoInputList.txt @@ -0,0 +1,2 @@ +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub diff --git a/isis/tests/data/hidtmgen/orthoOnly/params.pvl b/isis/tests/data/hidtmgen/orthoOnly/params.pvl new file mode 100644 index 0000000000..0ea5b262fc --- /dev/null +++ b/isis/tests/data/hidtmgen/orthoOnly/params.pvl @@ -0,0 +1,14 @@ +# See hidtmgen documentation for explanation of +# DTM_SOURCE_PRODUCT_ID and ORTHO_SOURCE_DTM_ID codes +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "0.042" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "" +DTM_SOURCE_PRODUCT_ID = (pSP_xxxxxx_xxxx, pSP_yyyyyy_yyyy) +ORTHO_SOURCE_DTM_ID = DTems_xxxxxx_xxxx_yyyyyy_yyyy_vnn +END diff --git a/isis/tests/data/hidtmgen/orthoOnly/sequenceNumbers.txt b/isis/tests/data/hidtmgen/orthoOnly/sequenceNumbers.txt new file mode 100644 index 0000000000..bb5cf8eceb --- /dev/null +++ b/isis/tests/data/hidtmgen/orthoOnly/sequenceNumbers.txt @@ -0,0 +1,2 @@ +31 +41 diff --git a/isis/tests/data/hidtmgen/outputTypes/orthoInputList.txt b/isis/tests/data/hidtmgen/outputTypes/orthoInputList.txt new file mode 100644 index 0000000000..8013991ee4 --- /dev/null +++ b/isis/tests/data/hidtmgen/outputTypes/orthoInputList.txt @@ -0,0 +1,2 @@ +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_2m_o_cropped.cub +data/hidtmgen/ortho/ESP_042252_1930_3-BAND_COLOR_50cm_o_cropped.cub diff --git a/isis/tests/data/hidtmgen/outputTypes/params.pvl b/isis/tests/data/hidtmgen/outputTypes/params.pvl new file mode 100644 index 0000000000..6ac448441b --- /dev/null +++ b/isis/tests/data/hidtmgen/outputTypes/params.pvl @@ -0,0 +1,12 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "3.14" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "Testing hidtmgen byte order, special pixels, bit type, and version ID" +DTM_SOURCE_PRODUCT_ID = (ESP_042252_1930, ESP_042753_1930) +ORTHO_SOURCE_DTM_ID = dtmID +END diff --git a/isis/tests/data/hidtmgen/outputTypes/params2.pvl b/isis/tests/data/hidtmgen/outputTypes/params2.pvl new file mode 100644 index 0000000000..17bf5a0984 --- /dev/null +++ b/isis/tests/data/hidtmgen/outputTypes/params2.pvl @@ -0,0 +1,12 @@ +DATA_SET_ID = "MRO-M-HIRISE-5-DTM-V1.0" +DATA_SET_NAME = "MRO MARS HIGH RESOLUTION IMAGING SCIENCE EXPERIMENT DTM V1.0" +PRODUCER_INSTITUTION_NAME = "UNIVERSITY OF ARIZONA" +PRODUCER_ID = "UA" +PRODUCER_FULL_NAME = "ALFRED MCEWEN" +PRODUCT_VERSION_ID = "0.7" +SOFTWARE_NAME = "Socet_Set 5.4.1" +PRODUCING_INSTITUTION = "A" +RATIONALE_DESC = "Testing hidtmgen bit types and version ID" +DTM_SOURCE_PRODUCT_ID = (ESP_042252_1930, ESP_042753_1930) +ORTHO_SOURCE_DTM_ID = dtmID +END diff --git a/isis/tests/data/hidtmgen/outputTypes/sequenceNumbers.txt b/isis/tests/data/hidtmgen/outputTypes/sequenceNumbers.txt new file mode 100644 index 0000000000..bb5cf8eceb --- /dev/null +++ b/isis/tests/data/hidtmgen/outputTypes/sequenceNumbers.txt @@ -0,0 +1,2 @@ +31 +41 diff --git a/isis/tests/data/hidtmgen/polar/orthoInputList.txt b/isis/tests/data/hidtmgen/polar/orthoInputList.txt new file mode 100644 index 0000000000..6671b26768 --- /dev/null +++ b/isis/tests/data/hidtmgen/polar/orthoInputList.txt @@ -0,0 +1,2 @@ +data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_1m_o_forPDS_cropped.cub +data/hidtmgen/ortho/PSP_009404_2635_RED_NLstretch_25cm_o_forPDS_cropped.cub diff --git a/isis/tests/data/hidtmgen/polar/orthosequencenumberlist.txt b/isis/tests/data/hidtmgen/polar/orthosequencenumberlist.txt new file mode 100644 index 0000000000..1191247b6d --- /dev/null +++ b/isis/tests/data/hidtmgen/polar/orthosequencenumberlist.txt @@ -0,0 +1,2 @@ +1 +2 diff --git a/isis/tests/data/hidtmgen/polar/params.pvl b/isis/tests/data/hidtmgen/polar/params.pvl new file mode 100644 index 0000000000..857ad1fc15 --- /dev/null +++ b/isis/tests/data/hidtmgen/polar/params.pvl @@ -0,0 +1,11 @@ +DATA_SET_ID = "DataSetIdFromParamsPvl" +DATA_SET_NAME = "Data Set Name From PARAMSPVL" +PRODUCER_INSTITUTION_NAME = "Producer Institution Name from PARAMSPVL" +PRODUCER_ID = "Producer Id from PARAMSPVL" +PRODUCER_FULL_NAME = "Producer Full Name from PARAMSPVL" +PRODUCING_INSTITUTION = "Z" +PRODUCT_VERSION_ID = "12.0" +RATIONALE_DESC = "Polar test" +SOFTWARE_NAME = "Software Name from PARAMSPVL" +DTM_SOURCE_PRODUCT_ID = (PSP_009404_2635, PSP_010221_2635) +END diff --git a/isis/tests/data/hidtmgen/print.prt b/isis/tests/data/hidtmgen/print.prt new file mode 100644 index 0000000000..1f33b27fad --- /dev/null +++ b/isis/tests/data/hidtmgen/print.prt @@ -0,0 +1,89 @@ +Object = catlab + IsisVersion = "4.3.0 | 2020-11-19" + ProgramVersion = 2010-07-26 + ProgramPath = /home/arsanders/isis3/ISIS3/build/bin + ExecutionDateTime = 2020-11-19T15:49:56 + HostName = Unknown + UserName = arsanders + Description = "Outputs the label from a cube" + + Group = UserParameters + FROM = dtm/DTM_Zumba_1m_forPDS_lowres.cub + APPEND = TRUE + End_Group + + Group = Accounting + ConnectTime = 00:00:00.0 + CpuTime = 00:00:00.1 + End_Group +End_Object + + +Object = catlab + IsisVersion = "4.3.0 | 2020-11-19" + ProgramVersion = 2010-07-26 + ProgramPath = /home/arsanders/isis3/ISIS3/build/bin + ExecutionDateTime = 2020-11-19T15:50:18 + HostName = Unknown + UserName = arsanders + Description = "Outputs the label from a cube" + + Group = UserParameters + FROM = dtm/Polar_Crater_1_1m_ngate_edited2_forPDS_lowres.cub + APPEND = TRUE + End_Group + + Group = Accounting + ConnectTime = 00:00:00.0 + CpuTime = 00:00:00.1 + End_Group +End_Object + + +Object = hidtmgen + IsisVersion = "4.3.0 | 2020-11-19" + ProgramVersion = 2016-08-19 + ProgramPath = /home/arsanders/isis3/ISIS3/build/bin + ExecutionDateTime = 2020-11-19T16:12:40 + HostName = Unknown + UserName = arsanders + Description = "Generates PDS products from a DTM and/or orthorectified + images." + + Group = UserParameters + DEFAULTNAMES = true + OUTPUTDIR = out/ + DTM = dtm/DTM_Zumba_1m_forPDS_lowres.cub + ORTHOFROMLIST = equi/orthoInputList.txt + ORTHOSEQUENCENUMBERLIST = equi/sequenceNumbers.txt + PARAMSPVL = equi/params.pvl + ENDIAN = LSB + NULL = true + LRS = false + LIS = false + HIS = false + HRS = false + DTMBITTYPE = 32BIT + ORTHOBITTYPE = 8BIT + End_Group + + Group = Error + Program = hidtmgen + Code = 1 + Message = "hidtmgen: Unable to HiRISE generate pds products" + File = hidtmgen.cpp + Line = 343 + End_Group + + Group = Error + Program = hidtmgen + Class = "I/O ERROR" + Code = 4 + Message = "Unable to open + [data/hidtmgen/ortho/PSP_002118_1510_1m_o_forPDS_cropped.cub]" + File = Cube.cpp + Line = 2208 + End_Group +End_Object + +