6 #include <boost/filesystem.hpp>
17 boost::filesystem::path RCFPath(_RCFDir);
19 boost::filesystem::directory_iterator end_itr;
21 for (boost::filesystem::directory_iterator itr(RCFPath); itr != end_itr;
26 if (boost::filesystem::is_regular_file(itr->path()) &&
27 itr->path().extension() ==
".RCF") {
28 string rcf_path = itr->path().string();
41 for (std::vector<RetrievalCoefficientFile>::iterator
42 it = _RCFs.begin(); it != _RCFs.end(); ++it)
44 if (it->getId() == RCFId)
return *it;
47 cout<<
"RetrievalCoefficientFile::getRCFbyId: ERROR: \n";
48 cout<<
" Could not find RCF with ID: "<<RCFId.c_str()<<
"\n";
55 if (_RCFs.size() == 0)
57 cout<<
"In: "<<__func__<<
" call failed:\n";
58 cout<<
"ERROR:There are currently no RCFs in the set\n";
62 for (std::vector<RetrievalCoefficientFile>::iterator
63 it = _RCFs.begin(); it != _RCFs.end(); ++it)
65 if (!it->setFlightLevelsKm(FlightLevels, NumFlightLevels))
67 cout<<
"In: "<<__func__<<
" call failed:\n";
68 cout<<
"ERROR: Failed to set flight levels for RCFID:"<<it->getId()<<
"\n";
77 (std::vector<float> ScanBrightnessTemps,
float PAltKm,
82 float Weight, SumWeights;
83 float SumWeightedAvg, SumSquares;
89 float RCFBTWeightedMean;
91 float Numerator, Denominator;
98 for (std::vector<RetrievalCoefficientFile>::iterator
99 RCFit = _RCFs.begin(); RCFit != _RCFs.end(); ++RCFit)
101 SumWeightedAvg = SumSquares = SumWeights = NumBTsIncl = 0;
104 AvgWtSet=RCFit->getRCAvgWt(PAltKm);
110 Weight = 1/(AvgWtSet.
MBTRms[BTIndex]*AvgWtSet.
MBTRms[BTIndex]);
111 SumWeights = SumWeights + Weight;
112 Diff = ScanBrightnessTemps[BTIndex]-AvgWtSet.
MBTAvg[BTIndex];
116 SumWeightedAvg = SumWeightedAvg+Weight*Diff;
117 SumSquares = SumSquares+Weight*(Diff*Diff);
121 RCFBTWeightedMean = SumWeightedAvg/SumWeights;
123 Numerator = (SumSquares-(SumWeights*(RCFBTWeightedMean*RCFBTWeightedMean)));
124 Denominator = ((NumBTsIncl-1)*SumWeights/NumBTsIncl);
125 if (Numerator/Denominator >= 0)
126 RCFBTStdDev = sqrt(Numerator/Denominator);
128 RCFBTStdDev = RCFBTWeightedMean;
131 thislnP = 8 * sqrt(RCFBTWeightedMean*RCFBTWeightedMean +
134 if (RCFit == _RCFs.begin())
139 else if (thislnP < BestlnP)
142 BestRCIndex = thisRCFIndex;
149 RC4R.
RCFFileName = _RCFs[BestRCIndex].getFileName();
150 RC4R.
RCFId = _RCFs[BestRCIndex].getId();
151 RC4R.
FL_RCs = _RCFs[BestRCIndex].getRCAvgWt(PAltKm);
float MBTAvg[NUM_BRT_TEMPS]
Model Brightness Temperature Averages.
This class provides for reading in an RCF, storing and providing access to its data.
RetrievalCoefficientFileSet(const std::string)
RetrievalCoefficientFile getRCFbyId(std::string RCFId)
This class encapsulates the whole set of RCFs for a project and provides a method for determining whi...
float MBTRms[NUM_BRT_TEMPS]
1-sigma apriori Model Brightness Temp err
bool setFlightLevelsKm(float[], int)
RC_Set_4Retrieval getBestWeightedRCSet(std::vector< float >, float, float)