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

REFAC: use TimePoint instead of Time in MDTime

parent c23215ea
......@@ -86,7 +86,7 @@ public:
DictType<MDL2D, MetaData::LUT2D> LUT2DKeys;
DictType<MDTime, MetaData::Time> TimeKeys;
DictType<MDTime, MetaData::TimePoint> TimeKeys;
DictType<std::string, std::string> ExtraKeys;
......@@ -97,7 +97,7 @@ public:
DictType<MDStr, std::string> stringKeys,
DictType<MDL1D, MetaData::LUT1D> lut1DKeys,
DictType<MDL2D, MetaData::LUT2D> lut2DKeys,
DictType<MDTime, MetaData::Time> timeKeys,
DictType<MDTime, MetaData::TimePoint> timeKeys,
DictType<std::string, std::string> extraKeys);
// -------------------- Geom utility function ----------------------------
......@@ -191,10 +191,10 @@ public:
// -------------------- Time utility function ----------------------------
/** Read-only accessor to time keys */
const MetaData::Time & operator[](const MDTime& key) const;
const MetaData::TimePoint & operator[](const MDTime& key) const;
/** Setter for time keys */
void Add(const MDTime& key, const MetaData::Time &value);
void Add(const MDTime& key, const MetaData::TimePoint &value);
/** Remove a key from the dictionary (even if the key is already missing) */
size_t Remove(const MDTime& key);
......@@ -260,13 +260,13 @@ public:
ImageMetadataBandsType Bands;
// Constructor
ImageMetadata();
ImageMetadata() = default;
ImageMetadata(DictType<MDGeom, boost::any> geometryKeys,
DictType<MDNum, double> numericKeys,
DictType<MDStr, std::string> stringKeys,
DictType<MDL1D, MetaData::LUT1D> lut1DKeys,
DictType<MDL2D, MetaData::LUT2D> lut2DKeys,
DictType<MDTime, MetaData::Time> timeKeys,
DictType<MDTime, MetaData::TimePoint> timeKeys,
DictType<std::string, std::string> extraKeys,
ImageMetadataBandsType bands);
......
......@@ -140,7 +140,7 @@ public:
const double& Fetch(MDNum key, ImageMetadata & imd, const char *path, int band=-1);
bool CheckFetch(MDNum key, ImageMetadata & imd, const char *path, int band=-1);
const MetaData::Time& Fetch(MDTime key, ImageMetadata & imd, const char *path, int band=-1);
const MetaData::TimePoint& Fetch(MDTime key, ImageMetadata & imd, const char *path, int band=-1);
bool CheckFetch(MDTime key, ImageMetadata & imd, const char *path, int band=-1);
const std::string& Fetch(std::string key, ImageMetadata & imd, const char *path, int band=-1);
......
......@@ -63,7 +63,7 @@ private:
PleiadesImageMetadataInterface(const Self&) = delete;
void operator=(const Self&) = delete;
void FetchTabulatedPhysicalGain(const MetaData::Time & date, ImageMetadata& imd);
void FetchTabulatedPhysicalGain(const MetaData::TimePoint & date, ImageMetadata& imd);
void FetchSolarIrradiance(const std::vector<double> & dimapSolarIrradiance, ImageMetadata& imd);
void FetchSatAngles(const std::vector<double> & incidenceAngles,
......
......@@ -222,13 +222,10 @@ void CosmoImageMetadataInterface::ParseGdal(ImageMetadata & imd)
minutes = static_cast<int> ((total_seconds-hour*3600)/60.0);
seconds = total_seconds - hour*3600 - minutes*60;
std::string last_line_time = reference_UTC + "T" + formatTimeInt(hour) + ":" + formatTimeInt(minutes) + ":" + formatTimeDouble(seconds);
MetaData::Time startTime = Utils::LexicalCast<MetaData::Time,std::string>(first_line_time, std::string("T"));
MetaData::Time stoptTime = Utils::LexicalCast<MetaData::Time,std::string>(last_line_time, std::string("T"));
imd.Add(MDTime::AcquisitionStartTime, startTime);
imd.Add(MDTime::AcquisitionStopTime, stoptTime);
imd.Add(MDTime::AcquisitionStartTime, MetaData::ReadFormattedDate(first_line_time));
imd.Add(MDTime::AcquisitionStopTime, MetaData::ReadFormattedDate(last_line_time));
// Retrieve the product dimension, as it is not stored in the metadata
auto dataset = static_cast<GDALDataset*>(GDALOpen(subDsName.c_str(), GA_ReadOnly));
......
......@@ -325,10 +325,10 @@ void FormosatImageMetadataInterface::Parse(ImageMetadata &imd)
}
imd.Add(MDTime::ProductionDate,
boost::lexical_cast<MetaData::Time>(dimapData.ProductionDate));
MetaData::ReadFormattedDate(dimapData.ProductionDate));
imd.Add(MDTime::AcquisitionDate,
boost::lexical_cast<MetaData::Time>(dimapData.AcquisitionDate));
MetaData::ReadFormattedDate(dimapData.AcquisitionDate));
imd.Add(MDStr::Instrument, dimapData.Instrument);
imd.Add(MDStr::InstrumentIndex, dimapData.InstrumentIndex);
......
......@@ -192,85 +192,18 @@ namespace
void IkonosImageMetadataInterface::FetchProductionDate(const std::string & productionDate, ImageMetadata& imd)
{
std::vector<std::string> dateParts;
// Producion date format: MM/DD/YY
boost::split(dateParts,
productionDate,
boost::is_any_of("/"));
if(dateParts.size() != 3)
{
otbGenericExceptionMacro(MissingMetadataException,
"Invalid production date: " << productionDate)
}
otb::MetaData::Time productionDateMD;
productionDateMD.tm_sec = 0;
productionDateMD.tm_min = 0;
productionDateMD.tm_hour = 0;
productionDateMD.frac_sec = 0;
productionDateMD.tm_isdst = 0;
productionDateMD.tm_mday = boost::lexical_cast<int>(dateParts[1]);
// tm_mon: number of months since january (0-11)
productionDateMD.tm_mon = boost::lexical_cast<int>(dateParts[0]) - 1;
auto productionYear = boost::lexical_cast<int>(dateParts[2]);
// 1999 is the only possible year before 2000 for Ikonos dates
// as the satellite was launched the 09/24/1999
if (productionYear != 99)
{
productionYear += 100;
}
// tm year: number of years since 1900
productionDateMD.tm_year = productionYear;
imd.Add(MDTime::ProductionDate, productionDateMD);
// Producion date format: MM/DD/YY
imd.Add(MDTime::ProductionDate,MetaData::ReadFormattedDate(productionDate, "%m/%d/%y"));
}
void IkonosImageMetadataInterface::FetchAcquisitionDate(const std::string & acquisitionDate,
const std::string & acquisitionTime,
ImageMetadata& imd)
{
std::vector<std::string> dateParts;
otb::MetaData::Time acquisitionDateMD;
// Acquisition date format: YYYY-MM-DD
boost::split(dateParts,
acquisitionDate,
boost::is_any_of("-"));
if(dateParts.size() != 3)
{
otbGenericExceptionMacro(MissingMetadataException,
"Invalid acquistion date: " << acquisitionDate)
}
acquisitionDateMD.tm_year = boost::lexical_cast<int>(dateParts[0]) - 1900;
acquisitionDateMD.tm_mon = boost::lexical_cast<int>(dateParts[1]) - 1;
acquisitionDateMD.tm_mday = boost::lexical_cast<int>(dateParts[2]);
// Acquisition time format: hh:mm
boost::split(dateParts,
acquisitionTime ,
boost::is_any_of(":"));
if(dateParts.size() != 2)
{
otbGenericExceptionMacro(MissingMetadataException,
"Invalid acquistion time: " << acquisitionTime)
}
acquisitionDateMD.tm_hour = boost::lexical_cast<int>(dateParts[0]);
acquisitionDateMD.tm_min = boost::lexical_cast<int>(dateParts[1]);
acquisitionDateMD.tm_sec = 0;
acquisitionDateMD.frac_sec = 0;
imd.Add(MDTime::AcquisitionDate, acquisitionDateMD);
imd.Add(MDTime::AcquisitionDate,
MetaData::ReadFormattedDate(acquisitionDate + "T" + acquisitionTime, "%Y-%m-%dT%H:%M") );
}
......@@ -535,16 +468,8 @@ void IkonosImageMetadataInterface::Parse(ImageMetadata &imd)
imd.Bands[0].Add(MDStr::BandName, bandName);
otb::MetaData::Time date;
date.tm_year = 101;
date.tm_mon = 0;
date.tm_mday = 22;
date.tm_hour = 0;
date.tm_min = 0;
date.tm_sec = 0;
date.frac_sec = 0;
if (imd[MDTime::AcquisitionDate] < date)
if (imd[MDTime::AcquisitionDate] < MetaData::ReadFormattedDate("2001-01-22T00:00:00"))
{
imd.Bands[0].Add(MDNum::PhysicalGain, ikonosPhysicalGainPre20010122[bandName]);
}
......
......@@ -34,7 +34,7 @@ ImageMetadataBase::ImageMetadataBase(DictType<MDGeom, boost::any> geometryKeys,
DictType<MDStr, std::string> stringKeys,
DictType<MDL1D, MetaData::LUT1D> lut1DKeys,
DictType<MDL2D, MetaData::LUT2D> lut2DKeys,
DictType<MDTime, MetaData::Time> timeKeys,
DictType<MDTime, MetaData::TimePoint> timeKeys,
DictType<std::string, std::string> extraKeys)
: GeometryKeys(std::move(geometryKeys)),
NumericKeys(std::move(numericKeys)),
......@@ -234,12 +234,12 @@ bool ImageMetadataBase::Has(const MDL2D& key) const
// -------------------- Time utility function ----------------------------
const MetaData::Time & ImageMetadataBase::operator[](const MDTime& key) const
const MetaData::TimePoint & ImageMetadataBase::operator[](const MDTime& key) const
{
return TimeKeys.at(key);
}
void ImageMetadataBase::Add(const MDTime& key, const MetaData::Time &value)
void ImageMetadataBase::Add(const MDTime& key, const MetaData::TimePoint &value)
{
TimeKeys[key] = value;
}
......@@ -455,7 +455,7 @@ bool ImageMetadataBase::FromKeywordlist(const Keywordlist& kwl)
auto timeKey = MetaData::MDTimeNames.right.find(kv.first);
if (timeKey != MetaData::MDTimeNames.right.end())
{
MetaData::Time time;
MetaData::TimePoint time;
std::istringstream (kv.second) >> time;
this->Add(timeKey->second, time);
continue;
......@@ -491,16 +491,13 @@ std::vector<unsigned int> ImageMetadataBase::GetDefaultDisplay() const
// ----------------------- [ImageMetadata] ------------------------------
ImageMetadata::ImageMetadata()
{
}
ImageMetadata::ImageMetadata(DictType<MDGeom, boost::any> geometryKeys,
DictType<MDNum, double> numericKeys,
DictType<MDStr, std::string> stringKeys,
DictType<MDL1D, MetaData::LUT1D> lut1DKeys,
DictType<MDL2D, MetaData::LUT2D> lut2DKeys,
DictType<MDTime, MetaData::Time> timeKeys,
DictType<MDTime, MetaData::TimePoint> timeKeys,
DictType<std::string, std::string> extraKeys,
ImageMetadataBandsType bands)
: ImageMetadataBase(geometryKeys, numericKeys, stringKeys, lut1DKeys, lut2DKeys, timeKeys, extraKeys),
......@@ -608,7 +605,7 @@ void ImageMetadata::compact()
{
auto otherKey = bandIt->TimeKeys.find(kv.first);
if ((otherKey == bandIt->TimeKeys.end())
|| !itk::Math::AlmostEquals(otherKey->second.frac_sec, kv.second.frac_sec))
|| !itk::Math::AlmostEquals(otherKey->second.GetJulianDay(), kv.second.GetJulianDay()))
{
compactVal = false;
break;
......
......@@ -372,7 +372,7 @@ ImageMetadataInterfaceBase::CheckFetch(
return false;
}
const MetaData::Time&
const MetaData::TimePoint&
ImageMetadataInterfaceBase::Fetch(
MDTime key,
ImageMetadata& imd,
......@@ -382,11 +382,11 @@ ImageMetadataInterfaceBase::Fetch(
if (band >= 0)
{
assert( (size_t)(band) < imd.Bands.size());
imd.Bands[band].Add(key, m_MetadataSupplierInterface->GetAs<MetaData::Time>(path, band));
imd.Bands[band].Add(key, MetaData::ReadFormattedDate(m_MetadataSupplierInterface->GetAs<std::string>(path, band)));
return imd.Bands[band][key];
}
imd.Add(key, m_MetadataSupplierInterface->GetAs<MetaData::Time>(path));
imd.Add(key, MetaData::ReadFormattedDate(m_MetadataSupplierInterface->GetAs<std::string>(path)));
return imd[key];
}
......
......@@ -84,7 +84,7 @@ void PleiadesImageMetadataInterface::FetchSatAngles(
}
}
void PleiadesImageMetadataInterface::FetchTabulatedPhysicalGain(const MetaData::Time & date, ImageMetadata& imd)
void PleiadesImageMetadataInterface::FetchTabulatedPhysicalGain(const MetaData::TimePoint & date, ImageMetadata& imd)
{
// We use here tabulate in flight values for physical gain of PHR. Those values evolve
// with time and are much more accurate. Values provided by CNES calibration
......@@ -111,63 +111,54 @@ void PleiadesImageMetadataInterface::FetchTabulatedPhysicalGain(const MetaData::
if (sensorId == "PHR 1A")
{
// tm_year: years since 1900
if ((date.tm_year < 112) ||
(date.tm_year == 112 && date.tm_mon < 8))
if (date < MetaData::ReadFormattedDate("01/08/2012", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.75},
{"B0", 9.52}, {"B1", 9.62}, {"B2", 10.55}, {"B3", 15.73}};
}
else if ((date.tm_year == 112 && date.tm_mon >= 8) ||
(date.tm_year == 113 && date.tm_mon < 3))
else if (date < MetaData::ReadFormattedDate("01/03/2013", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.73},
{"B0", 9.47}, {"B1", 9.53}, {"B2", 10.48}, {"B3", 15.66}};
}
// From 01/03/2013 to 01/03/2014
else if ((date.tm_year == 113 && date.tm_mon >= 3) ||
(date.tm_year == 114 && date.tm_mon < 3))
else if (date < MetaData::ReadFormattedDate("01/03/2014", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.70},
{"B0", 9.40}, {"B1", 9.47}, {"B2", 10.44}, {"B3", 15.62}};
}
// From 01/03/2014 to 01/03/2015
else if ((date.tm_year == 114 && date.tm_mon >= 3) ||
(date.tm_year == 115 && date.tm_mon < 3))
else if (date < MetaData::ReadFormattedDate("01/03/2015", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.67},
{"B0", 9.33}, {"B1", 9.39}, {"B2", 10.38}, {"B3", 15.57}};
}
// From 01/03/2015 to 01/03/2016
else if ((date.tm_year == 115 && date.tm_mon >= 3) ||
(date.tm_year == 116 && date.tm_mon < 3))
else if (date < MetaData::ReadFormattedDate("01/03/2016", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.64},
{"B0", 9.25}, {"B1", 9.31}, {"B2", 10.32}, {"B3", 15.51}};
}
// From 01/03/2016 to 31/12/2016
else if ((date.tm_year == 116 && date.tm_mon >= 3) ||
(date.tm_year == 116 && date.tm_mon <=12 ))
else if (date < MetaData::ReadFormattedDate("31/12/2016", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.61},
{"B0", 9.18}, {"B1", 9.25}, {"B2", 10.27}, {"B3", 15.46}};
}
// From 01/01/2017 to 31/12/2017
else if ((date.tm_year == 117 && date.tm_mon >= 1) ||
(date.tm_year == 117 && date.tm_mon <= 12))
else if (date < MetaData::ReadFormattedDate("31/12/2017", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.58},
{"B0", 9.11}, {"B1", 9.17}, {"B2", 10.22}, {"B3", 15.41}};
}
// From 01/01/2018 to 31/12/2018
else if ((date.tm_year == 118 && date.tm_mon >= 1) ||
(date.tm_year == 118 && date.tm_mon <= 12))
else if (date < MetaData::ReadFormattedDate("31/12/2018", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.55},
{"B0", 9.03}, {"B1", 9.09}, {"B2", 10.16}, {"B3", 15.36}};
}
// From 01/10/2018 to 31/12/2019
else if ((date.tm_year == 119 && date.tm_mon >= 1) ||
(date.tm_year == 119 && date.tm_mon <= 12))
else if (date < MetaData::ReadFormattedDate("31/12/2019", "%F"))
{
bandNameToPhysicalGain = { {"P", 11.52},
{"B0", 8.96}, {"B1", 9.01}, {"B2", 10.09}, {"B3", 15.31}};
......@@ -181,50 +172,42 @@ void PleiadesImageMetadataInterface::FetchTabulatedPhysicalGain(const MetaData::
}
else if (sensorId == "PHR 1B")
{
if ((date.tm_year < 113) ||
(date.tm_year == 113 && date.tm_mon < 9))
if (date < MetaData::ReadFormattedDate("01/09/2013", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 10.37}, {"B1", 10.50}, {"B2", 11.55}, {"B3", 17.53}};
}
else if ((date.tm_year == 113 && date.tm_mon >= 9) ||
(date.tm_year == 114 && date.tm_mon < 3))
else if (date < MetaData::ReadFormattedDate("01/03/2014", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 10.29}, {"B1", 10.41}, {"B2", 11.48}, {"B3", 17.45}};
}
else if ((date.tm_year == 114 && date.tm_mon >= 3) ||
(date.tm_year == 115 && date.tm_mon < 3))
else if (date < MetaData::ReadFormattedDate("01/03/2015", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 10.22}, {"B1", 10.34}, {"B2", 11.41}, {"B3", 17.39}};
}
else if ((date.tm_year == 115 && date.tm_mon >= 3) ||
(date.tm_year == 116 && date.tm_mon < 3))
else if (date < MetaData::ReadFormattedDate("01/03/2015", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 10.12}, {"B1", 10.23}, {"B2", 11.33}, {"B3", 17.31}};
}
else if ((date.tm_year == 116 && date.tm_mon >= 3) ||
(date.tm_year == 116 && date.tm_mon <= 12))
else if (date < MetaData::ReadFormattedDate("01/12/2016", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 10.04}, {"B1", 10.14}, {"B2", 11.25}, {"B3", 17.24}};
}
else if ((date.tm_year == 117 && date.tm_mon >= 1) ||
(date.tm_year == 117 && date.tm_mon <= 12))
else if (date < MetaData::ReadFormattedDate("01/12/2017", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 9.96}, {"B1", 10.04}, {"B2", 11.17}, {"B3", 17.16}};
}
else if ((date.tm_year == 118 && date.tm_mon >= 1) ||
(date.tm_year == 118 && date.tm_mon <= 12))
else if (date < MetaData::ReadFormattedDate("01/12/2018", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 9.87}, {"B1", 9.94}, {"B2", 11.09}, {"B3", 17.08}};
}
else if ((date.tm_year == 119 && date.tm_mon >= 1) ||
(date.tm_year == 119 && date.tm_mon <= 12))
else if (date < MetaData::ReadFormattedDate("01/12/2019", "%F"))
{
bandNameToPhysicalGain = { {"P", 12.04},
{"B0", 9.80}, {"B1", 9.87}, {"B2", 11.02}, {"B3", 17.02}};
......@@ -690,9 +673,9 @@ void PleiadesImageMetadataInterface::Parse(ImageMetadata &imd)
imd);
imd.Add(MDTime::ProductionDate,
boost::lexical_cast<MetaData::Time>(dimapData.ProductionDate));
MetaData::ReadFormattedDate(dimapData.ProductionDate));
imd.Add(MDTime::AcquisitionDate,
boost::lexical_cast<MetaData::Time>(dimapData.AcquisitionDate));
MetaData::ReadFormattedDate(dimapData.AcquisitionDate));
FetchSolarIrradiance(dimapData.SolarIrradiance, imd);
......
......@@ -170,7 +170,7 @@ void Radarsat2ImageMetadataInterface::ParseGdal(ImageMetadata & imd)
std::string ImageFilePath = itksys::SystemTools::GetFilenameName(m_MetadataSupplierInterface->GetResourceFile(""));
imd.Add(MDStr::Polarization, ImageFilePath.substr(8, 2));
imd.Add(MDTime::AcquisitionStartTime, ProductMS.GetAs<MetaData::Time>("product.sourceAttributes.rawDataStartTime"));
imd.Add(MDTime::AcquisitionStartTime, MetaData::ReadFormattedDate(ProductMS.GetAs<std::string>("product.sourceAttributes.rawDataStartTime")));
imd.Add(MDStr::BeamMode, ProductMS.GetAs<std::string>("product.sourceAttributes.beamModeMnemonic"));
imd.Add("FACILITY_IDENTIFIER", ProductMS.GetAs<std::string>("product.sourceAttributes.inputDatasetFacilityId"));
imd.Add(MDNum::LineSpacing, ProductMS.GetAs<double>("product.imageAttributes.rasterAttributes.sampledLineSpacing"));
......@@ -182,7 +182,7 @@ void Radarsat2ImageMetadataInterface::ParseGdal(ImageMetadata & imd)
imd.Add(MDStr::Mission, ProductMS.GetAs<std::string>("product.sourceAttributes.satellite"));
imd.Add(MDNum::NumberOfLines, ProductMS.GetAs<int>("product.imageAttributes.rasterAttributes.numberOfLines"));
imd.Add(MDNum::NumberOfColumns, ProductMS.GetAs<int>("product.imageAttributes.rasterAttributes.numberOfSamplesPerLine"));
imd.Add(MDTime::ProductionDate, ProductMS.GetFirstAs<MetaData::Time>("product.imageGenerationParameters.generalProcessingInformation.processingTime"));
imd.Add(MDTime::ProductionDate, MetaData::ReadFormattedDate(ProductMS.GetFirstAs<std::string>("product.imageGenerationParameters.generalProcessingInformation.processingTime")));
imd.Add(MDNum::AverageSceneHeight, ProductMS.GetAs<double>("product.imageAttributes.geographicInformation.referenceEllipsoidParameters.geodeticTerrainHeight"));
// imd.Add(MDNum::RadarFrequency, this->GetRadarFrequency()); // not parsed
// imd.Add(MDNum::PRF, 0.); // not parsed
......@@ -225,7 +225,7 @@ void Radarsat2ImageMetadataInterface::ParseGeom(ImageMetadata & imd)
imd.Add(MDNum::NumberOfLines, ProductMS.GetAs<int>("product.imageAttributes.rasterAttributes.numberOfLines"));
imd.Add(MDNum::NumberOfColumns, ProductMS.GetAs<int>("product.imageAttributes.rasterAttributes.numberOfSamplesPerLine"));
imd.Add(MDTime::ProductionDate,
ProductMS.GetFirstAs<MetaData::Time>("product.imageGenerationParameters.generalProcessingInformation.processingTime"));
MetaData::ReadFormattedDate(ProductMS.GetFirstAs<std::string>("product.imageGenerationParameters.generalProcessingInformation.processingTime")));
imd.Add(MDNum::AverageSceneHeight,
ProductMS.GetAs<double>("product.imageAttributes.geographicInformation.referenceEllipsoidParameters.geodeticTerrainHeight"));
// imd.Add(MDNum::RadarFrequency, 0.); // not parsed
......
......@@ -734,9 +734,9 @@ void Sentinel1ImageMetadataInterface::ParseGdal(ImageMetadata & imd)
+ ManifestMS.GetFirstAs<std::string>("xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:platform.safe:number"));
imd.Add(MDTime::ProductionDate,
ManifestMS.GetFirstAs<MetaData::Time>("xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:processing.start"));
MetaData::ReadFormattedDate(ManifestMS.GetFirstAs<std::string>("xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:processing.start")));
imd.Add(MDTime::AcquisitionDate,
ManifestMS.GetFirstAs<MetaData::Time>("xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:acquisitionPeriod.safe:startTime"));
MetaData::ReadFormattedDate(ManifestMS.GetFirstAs<std::string>("xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:acquisitionPeriod.safe:startTime")));
imd.Add(MDStr::BeamMode,
ManifestMS.GetFirstAs<std::string>(
"xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:platform.safe:instrument.safe:extension.s1sarl1:instrumentMode.s1sarl1:mode"
......@@ -758,8 +758,8 @@ void Sentinel1ImageMetadataInterface::ParseGdal(ImageMetadata & imd)
}
XMLMetadataSupplier AnnotationMS(AnnotationFilePath);
imd.Add(MDTime::AcquisitionStartTime, AnnotationMS.GetAs<MetaData::Time>("product.adsHeader.startTime"));
imd.Add(MDTime::AcquisitionStopTime, AnnotationMS.GetAs<MetaData::Time>("product.adsHeader.stopTime"));
imd.Add(MDTime::AcquisitionStartTime, MetaData::ReadFormattedDate(AnnotationMS.GetAs<std::string>("product.adsHeader.startTime")));
imd.Add(MDTime::AcquisitionStopTime, MetaData::ReadFormattedDate(AnnotationMS.GetAs<std::string>("product.adsHeader.stopTime")));
imd.Add(MDNum::LineSpacing, AnnotationMS.GetAs<double>("product.imageAnnotation.imageInformation.azimuthPixelSpacing"));
imd.Add(MDStr::Mission, AnnotationMS.GetAs<std::string>("product.adsHeader.missionId"));
imd.Add(MDStr::OrbitDirection, itksys::SystemTools::UpperCase(AnnotationMS.GetAs<std::string>("product.generalAnnotation.productInformation.pass")));
......
......@@ -552,9 +552,9 @@ void Spot6ImageMetadataInterface::Parse(ImageMetadata & imd)
imd.Add(MDNum::SatAzimuth, dimapData.SceneOrientation[0]);
imd.Add(MDTime::ProductionDate,
boost::lexical_cast<MetaData::Time>(dimapData.ProductionDate));
MetaData::ReadFormattedDate(dimapData.ProductionDate));
imd.Add(MDTime::AcquisitionDate,
boost::lexical_cast<MetaData::Time>(dimapData.AcquisitionDate));
MetaData::ReadFormattedDate(dimapData.AcquisitionDate));
auto nbBands = imd.Bands.size();
if (dimapData.PhysicalBias.size() == nbBands
......
......@@ -342,9 +342,9 @@ void SpotImageMetadataInterface::Parse(ImageMetadata & imd)
imd.Add(MDStr::InstrumentIndex, dimapData.InstrumentIndex);
imd.Add(MDTime::ProductionDate,
boost::lexical_cast<MetaData::Time>(dimapData.ProductionDate));
MetaData::ReadFormattedDate(dimapData.ProductionDate));
imd.Add(MDTime::AcquisitionDate,
boost::lexical_cast<MetaData::Time>(dimapData.AcquisitionDate));
MetaData::ReadFormattedDate(dimapData.AcquisitionDate));
imd.Add(MDNum::SunAzimuth, dimapData.SunAzimuth[0]);
imd.Add(MDNum::SunElevation, dimapData.SunElevation[0]);
......
......@@ -675,8 +675,8 @@ void TerraSarXSarImageMetadataInterface::ParseGdal(ImageMetadata &imd)
imd.Add(MDStr::Mode, MainXMLFileMetadataSupplier.GetAs<std::string>("level1Product.productInfo.acquisitionInfo.imagingMode"));
imd.Add(MDStr::SensorID, MainXMLFileMetadataSupplier.GetAs<std::string>("level1Product.productInfo.acquisitionInfo.sensor"));
imd.Add(MDNum::RadarFrequency, MainXMLFileMetadataSupplier.GetAs<double>("level1Product.instrument.radarParameters.centerFrequency"));
imd.Add(MDTime::AcquisitionStartTime, MainXMLFileMetadataSupplier.GetFirstAs<MetaData::Time>("level1Product.productInfo.sceneInfo.start.timeUTC"));
imd.Add(MDTime::AcquisitionStopTime, MainXMLFileMetadataSupplier.GetFirstAs<MetaData::Time>("level1Product.productInfo.sceneInfo.stop.timeUTC"));
imd.Add(MDTime::AcquisitionStartTime, MetaData::ReadFormattedDate(MainXMLFileMetadataSupplier.GetFirstAs<std::string>("level1Product.productInfo.sceneInfo.start.timeUTC")));
imd.Add(MDTime::AcquisitionStopTime, MetaData::ReadFormattedDate(MainXMLFileMetadataSupplier.GetFirstAs<std::string>("level1Product.productInfo.sceneInfo.stop.timeUTC")));
imd.Add(MDNum::RangeTimeFirstPixel, MainXMLFileMetadataSupplier.GetFirstAs<double>("level1Product.productInfo.sceneInfo.rangeTime.firstPixel"));
imd.Add(MDNum::RangeTimeLastPixel, MainXMLFileMetadataSupplier.GetFirstAs<double>("level1Product.productInfo.sceneInfo.rangeTime.lastPixel"));
imd.Add(MDNum::PRF, MainXMLFileMetadataSupplier.GetAs<double>("level1Product.productSpecific.complexImageInfo.commonPRF"));
......
......@@ -626,21 +626,7 @@ void WorldView2ImageMetadataInterface::FetchPhysicalGainQuickBird(int bitsPerPix
itkExceptionMacro(<< "Invalid Metadata, not a Quickbird product");
}
bool isPost20030606 = false;
otb::MetaData::Time date;
date.tm_year = 101;
date.tm_mon = 0;
date.tm_mday = 22;
date.tm_hour = 0;
date.tm_min = 0;
date.tm_sec = 0;
date.frac_sec = 0;
if (imd[MDTime::ProductionDate] > date)
{
isPost20030606 = true;
}
bool isPost20030606 = imd[MDTime::ProductionDate] > MetaData::ReadFormattedDate("2003-06-06T00:00:00");
if ((bitsPerPixel != 16 && bitsPerPixel != 8))