本文整理汇总了C++中PvlGroup::FindKeyword方法的典型用法代码示例。如果您正苦于以下问题:C++ PvlGroup::FindKeyword方法的具体用法?C++ PvlGroup::FindKeyword怎么用?C++ PvlGroup::FindKeyword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PvlGroup
的用法示例。
在下文中一共展示了PvlGroup::FindKeyword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TranslateLrocNacLabels
//Function to translate the labels
void TranslateLrocNacLabels ( Filename &labelFile, Cube *ocube ) {
//Pvl to store the labels
Pvl outLabel;
//Set up the directory where the translations are
PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory"));
iString transDir = (string) dataDir["Lro"] + "/translations/";
Pvl labelPvl(labelFile.Expanded());
//Translate the Instrument group
Filename transFile(transDir + "lronacInstrument.trn");
PvlTranslationManager instrumentXlator(labelPvl, transFile.Expanded());
instrumentXlator.Auto(outLabel);
//Translate the Archive group
transFile = transDir + "lronacArchive.trn";
PvlTranslationManager archiveXlater(labelPvl, transFile.Expanded());
archiveXlater.Auto(outLabel);
// Set up the BandBin groups
PvlGroup bbin("BandBin");
bbin += PvlKeyword("FilterName", "BroadBand");
bbin += PvlKeyword("Center", 0.650, "micrometers");
bbin += PvlKeyword("Width", 0.150, "micrometers");
Pvl lab(labelFile.Expanded());
//Set up the Kernels group
PvlGroup kern("Kernels");
if (lab.FindKeyword("FRAME_ID")[0] == "LEFT")
kern += PvlKeyword("NaifFrameCode", -85600);
else
kern += PvlKeyword("NaifFrameCode", -85610);
PvlGroup inst = outLabel.FindGroup("Instrument", Pvl::Traverse);
if (lab.FindKeyword("FRAME_ID")[0] == "LEFT") {
inst.FindKeyword("InstrumentId") = "NACL";
inst.FindKeyword("InstrumentName") = "LUNAR RECONNAISSANCE ORBITER NARROW ANGLE CAMERA LEFT";
g_flip = false;
}
else {
inst.FindKeyword("InstrumentId") = "NACR";
inst.FindKeyword("InstrumentName") = "LUNAR RECONNAISSANCE ORBITER NARROW ANGLE CAMERA RIGHT";
}
inst += PvlKeyword("SpatialSumming", lab.FindKeyword("CROSSTRACK_SUMMING")[0] );
inst += PvlKeyword("SampleFirstPixel", 0 );
//Add all groups to the output cube
ocube->PutGroup(inst);
ocube->PutGroup(outLabel.FindGroup("Archive", Pvl::Traverse));
ocube->PutGroup(bbin);
ocube->PutGroup(kern);
}
示例2: IsisMain
void IsisMain() {
// We will be processing by brick
ProcessByBrick p;
Isis::Cube *amatrixCube=NULL;
Isis::Cube *bmatrixCube=NULL;
// Setup the user input for the input/output files and the option
UserInterface &ui = Application::GetUserInterface();
// Setup the input HiRise cube
Isis::Cube *icube = p.SetInputCube("FROM");
if (icube->Bands() != 1) {
std::string msg = "Only single-band HiRise cubes can be calibrated";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
//Get pertinent label information to determine which band of matrix cube to use
HiLab hilab(icube);
int ccd = hilab.getCcd();
int channel = hilab.getChannel();
if (channel != 0 && channel != 1) {
std::string msg = "Only unstitched cubes can be calibrated";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
int band = 1 + ccd*2 + channel;
string option = ui.GetString("OPTION");
// Set attributes (input band number) for the matrix cube(s);
CubeAttributeInput att("+" + iString(band));
// Determine the file specification to the matrix file(s) if defaulted
// and open
if (ui.WasEntered ("MATRIX") ) {
if (option == "GAIN") {
string matrixFile = ui.GetFilename("MATRIX");
amatrixCube = p.SetInputCube(matrixFile, att);
}
else if (option == "OFFSET") {
string matrixFile = ui.GetFilename("MATRIX");
bmatrixCube = p.SetInputCube(matrixFile, att);
}
else { //(option == "BOTH")
std::string
msg = "The BOTH option cannot be used if a MATRIX is entered";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
}
else {
int tdi = hilab.getTdi();
int bin = hilab.getBin();
if (option == "OFFSET" || option == "BOTH") {
std::string bmatrixFile = "$mro/calibration";
bmatrixFile += "/B_matrix_tdi";
bmatrixFile += iString(tdi) + "_bin" + iString(bin);
bmatrixCube = p.SetInputCube(bmatrixFile, att);
}
if (option == "GAIN" || option == "BOTH") {
std::string amatrixFile = "$mro/calibration";
amatrixFile += "/A_matrix_tdi";
amatrixFile += iString(tdi) + "_bin" + iString(bin);
amatrixCube = p.SetInputCube(amatrixFile, att);
}
}
// Open the output file and set processing parameters
Cube *ocube = p.SetOutputCube ("TO");
p.SetWrap (true);
p.SetBrickSize ( icube->Samples(), 1, 1);
// Add the radiometry group if it is not there yet. Otherwise
// read the current value of the keyword CalibrationParameters.
// Then delete the keyword and rewrite it after appending the
// new value to it. Do it this way to avoid multiple Calibration
// Parameter keywords.
PvlGroup calgrp;
PvlKeyword calKey;
if (ocube->HasGroup("Radiometry")) {
calgrp = ocube->GetGroup ("Radiometry");
if (calgrp.HasKeyword("CalibrationParameters")) {
calKey = calgrp.FindKeyword("CalibrationParameters");
calgrp.DeleteKeyword( "CalibrationParameters" );
}
else {
calKey.SetName ("CalibrationParameters");
}
}
else {
calgrp.SetName("Radiometry");
calKey.SetName ("CalibrationParameters");
}
//.........这里部分代码省略.........
示例3: TranslateLabels
void TranslateLabels (Filename in, Cube *ocube) {
// Get the directory where the Clementine translation tables are.
PvlGroup &dataDir = Preference::Preferences().FindGroup("DataDirectory");
// Transfer the instrument group to the output cube
iString transDir = (string) dataDir["clementine1"];
Filename transFile (transDir + "/translations/clementine.trn");
Pvl pdsLab(in.Expanded());
PvlTranslationManager labelXlater (pdsLab, transFile.Expanded());
// Pvl outputLabels;
Pvl *outputLabel = ocube->Label();
labelXlater.Auto(*(outputLabel));
//Instrument group
PvlGroup inst = outputLabel->FindGroup ("Instrument",Pvl::Traverse);
PvlKeyword &startTime = inst.FindKeyword("StartTime");
startTime.SetValue( startTime[0].substr(0, startTime[0].size()-1));
// Old PDS labels used keyword INSTRUMENT_COMPRESSION_TYPE & PDS Labels now use ENCODING_TYPE
if(pdsLab.FindObject("Image").HasKeyword("InstrumentCompressionType")){
inst += PvlKeyword("EncodingFormat",(string) pdsLab.FindObject("Image")["InstrumentCompressionType"]);
}
else {
inst += PvlKeyword("EncodingFormat",(string) pdsLab.FindObject("Image")["EncodingType"]);
}
if (((string)inst["InstrumentId"]) == "HIRES") {
inst += PvlKeyword("MCPGainModeID", (string)pdsLab["MCP_Gain_Mode_ID"], "");
}
ocube->PutGroup(inst);
PvlGroup bBin = outputLabel->FindGroup ("BandBin", Pvl::Traverse);
std::string filter = pdsLab["FilterName"];
if (filter != "F") {
//Band Bin group
double center = pdsLab["CenterFilterWavelength"];
center /= 1000.0;
bBin.FindKeyword("Center").SetValue(center,"micrometers");
}
double width = pdsLab["Bandwidth"];
width /= 1000.0;
bBin.FindKeyword("Width").SetValue(width,"micrometers");
ocube->PutGroup(bBin);
//Kernel group
PvlGroup kern("Kernels");
if (((string)inst["InstrumentId"]) == "HIRES") {
kern += PvlKeyword("NaifFrameCode","-40001");
}
if (((string)inst["InstrumentId"]) == "UVVIS") {
kern += PvlKeyword("NaifFrameCode","-40002");
}
if (((string)inst["InstrumentId"]) == "NIR") {
kern += PvlKeyword("NaifFrameCode","-40003");
}
if (((string)inst["InstrumentId"]) == "LWIR") {
kern += PvlKeyword("NaifFrameCode","-40004");
}
ocube->PutGroup(kern);
OriginalLabel org(pdsLab);
ocube->Write(org);
}