Commit b8367b7e authored by Cédric Traizet's avatar Cédric Traizet

Merge branch 'cosmo_hdf5_logs' into 'develop'

Fix CosmoSkyMed ImageMetadataInterface

See merge request !775
parents 0777d9f3 2f27c7c0
Pipeline #6266 passed with stage
in 8 minutes and 34 seconds
......@@ -359,44 +359,28 @@ void CosmoImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
{
assert(mds.GetNbBands() == this->m_Imd.Bands.size());
// Check SubDatasets (For COSMO, we need //S01/SBI dataset)
auto subDsName = "HDF5:" + mds.GetResourceFile() + "://S01/SBI";
auto ds = (GDALDataset *) GDALOpen(subDsName.c_str(), GA_ReadOnly );
// Check Mission Id, acquisition mode and product type
Fetch(MDStr::Mission, mds, "MISSION_ID");
if (ds)
{
std::cout << "Found S01/SBI ! " << std::endl;
// Do stuff
GDALClose(ds);
}
else
if (m_Imd[MDStr::Mission] != "CSK" )
{
otbGenericExceptionMacro(MissingMetadataException,
<< "Cannot find S01/SBI subdataset")
<< "Not a CosmoSkyMed product");
}
// Metadata read by GDAL
Fetch(MDStr::Mission, mds, "MISSION_ID");
Fetch(MDStr::Mode, mds, "Acquisition_Mode");
Fetch(MDStr::ProductType, mds, "Product_Type");
// Check Mission Id, acquisition mode and product type
if(! (m_Imd[MDStr::Mission] == "CSK" ))
{
itkWarningMacro(<< "Not a valid missionId" << m_Imd[MDStr::Mission] );
}
if((m_Imd[MDStr::Mode] != "HIMAGE") &&
(m_Imd[MDStr::Mode] != "SPOTLIGHT") &&
(m_Imd[MDStr::Mode] != "ENHANCED SPOTLIGHT"))
{
{
itkWarningMacro(<< "Not an expected acquisition mode (only HIMAGE and SPOTLIGHT expected)" << m_Imd[MDStr::Mode] );
}
}
Fetch(MDStr::ProductType, mds, "Product_Type");
if( (m_Imd[MDStr::ProductType] != "SCS_B") && m_Imd[MDStr::ProductType] != "SCS_U")
{
{
itkWarningMacro(<< "Not an expected product type (only SCS_B and SCS_U expected) " << m_Imd[MDStr::ProductType] );
}
}
m_Imd.Add(MDStr::SensorID, "CSK");
Fetch(MDStr::Instrument, mds, "Satellite_ID");
......@@ -418,7 +402,8 @@ void CosmoImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
m_Imd.Add(MDNum::PRF, std::stoi(PRFNumber));
//getTIme
//getTime
auto subDsName = "HDF5:" + mds.GetResourceFile() + "://S01/SBI";
auto metadataBands = this->saveMetadataBands(subDsName) ;
bool hasTimeUTC;
int pos = mds.GetMetadataValue("Reference_UTC", hasTimeUTC).find(" ");;
......
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