Commit d4f3ba79 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

ENH: read noise range LUT in S1 products generated by IPF version > 2.90

parent 009b2b90
......@@ -497,8 +497,26 @@ std::vector<CalibrationVector> Sentinel1ImageMetadataInterface::GetCalibrationVe
std::vector<SARNoise> Sentinel1ImageMetadataInterface::GetNoiseVector(const XMLMetadataSupplier &xmlMS) const
{
std::vector<SARNoise> noiseVector;
std::string rangeNoisePrefix = "noise.noiseVectorList.";
std::string rangeVectorName = "noiseVector_";
std::string rangeLUTName = ".noiseLut";
// Number of entries in the vector
int listCount = xmlMS.GetAs<int>("noise.noiseVectorList.count");
int listCount = xmlMS.GetAs<int>(0, rangeNoisePrefix + "count");
// Starting with IPF 2.9.0, the noiseLut field has been renamed into noiseRangeVectorList, and the
// noiseAzimuthVectorList has been added.
// Ref: MPC-0392 DI-MPC-TN Issue 1.1 2017,Nov.28 Thermal Denoising of Products Generated by the S-1 IPF
if (!listCount)
{
rangeNoisePrefix = "noise.noiseRangeVectorList.";
rangeVectorName = "noiseRangeVector_";
rangeLUTName = ".noiseRangeLut";
listCount = xmlMS.GetAs<int>(rangeNoisePrefix + "count");
}
// This streams wild hold the iteration number
std::ostringstream oss;
for (int listId = 1 ; listId <= listCount ; ++listId)
......@@ -506,7 +524,7 @@ std::vector<SARNoise> Sentinel1ImageMetadataInterface::GetNoiseVector(const XMLM
oss.str("");
oss << listId;
// Base path to the data, that depends on the iteration number
std::string path_root = "noise.noiseVectorList.noiseVector_" + oss.str();
std::string path_root = rangeNoisePrefix + rangeVectorName + oss.str();
SARNoise noiseVect;
std::istringstream(xmlMS.GetAs<std::string>(path_root + ".azimuthTime")) >> noiseVect.azimuthTime;
MetaData::LUT1D noiseLut;
......@@ -514,8 +532,8 @@ std::vector<SARNoise> Sentinel1ImageMetadataInterface::GetNoiseVector(const XMLM
ax1.Size = xmlMS.GetAs<int>(path_root + ".pixel.count");
ax1.Values = xmlMS.GetAsVector<double>(path_root + ".pixel", ' ', ax1.Size);
noiseLut.Axis[0] = ax1;
noiseLut.Array = xmlMS.GetAsVector<double>(path_root + ".noiseLut",
' ', xmlMS.GetAs<int>(path_root + ".noiseLut.count"));
noiseLut.Array = xmlMS.GetAsVector<double>(path_root + rangeLUTName,
' ', xmlMS.GetAs<int>(path_root + rangeLUTName + ".count"));
noiseVect.noiseLut = noiseLut;
noiseVector.push_back(noiseVect);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment