Commit e9652e77 authored by Julien Osman's avatar Julien Osman

ENH: Set CosmoSkySAR IMI with new framwork

parent 3c17874a
Pipeline #7229 failed with stages
in 88 minutes and 58 seconds
SensorID CSK
Mission CSK
Instrument CSKS3
ProductType SCS_B
Polarization HH
Mode ENHANCED SPOTLIGHT
......@@ -10,7 +9,7 @@ TileHintX 128
TileHintY 128
DataType 1
OrbitNumber 13415
PRF 3321
PRF 3321.52
RadarFrequency 9.6e+09
AcquisitionStartTime 2011-04-18T18:03:27.915976Z
AcquisitionStopTime 2011-04-18T18:03:29.380925Z
......
ce90_absolute: 0
ce90_relative: 0
header.: 1
header.first_line_time: 2011-04-18T18:3:27.915976
header.image_id: 28129
header.last_line_time: 2011-04-18T18:3:29.380925
header.meters_per_pixel_x: 0.324294726201923
header.meters_per_pixel_y: 0.702370481110099
header.polarisation: HH
header.swath: 1
header.version: 4
image_id: 28129
ll_lat: 43.5560936197493
ll_lon: 1.49781441416722
lr_lat: 43.5726757080402
lr_lon: 1.3736840073413
meters_per_pixel_x: 0
meters_per_pixel_y: 0
number_lines: 14380
number_samples: 17502
orbitList.nb_orbits: 30
orbitList.orbit[0].time: 2011-04-18T18:02:09.999978
orbitList.orbit[0].x_pos: 4684888.261
orbitList.orbit[0].x_vel: 5656.7879091
orbitList.orbit[0].y_pos: 628731.303
orbitList.orbit[0].y_vel: -1132.1831751
orbitList.orbit[0].z_pos: 5157252.161
orbitList.orbit[0].z_vel: -4987.7481093
orbitList.orbit[10].time: 2011-04-18T18:03:49.999999
orbitList.orbit[10].x_pos: 5221555.863
orbitList.orbit[10].x_vel: 5065.8399238
orbitList.orbit[10].y_pos: 508117.856
orbitList.orbit[10].y_vel: -1276.3270012
orbitList.orbit[10].z_pos: 4629438.638
orbitList.orbit[10].z_vel: -5558.3003659
orbitList.orbit[11].time: 2011-04-18T18:03:59.999985
orbitList.orbit[11].x_pos: 5271901.995
orbitList.orbit[11].x_vel: 5003.285925
orbitList.orbit[11].y_pos: 495288.658
orbitList.orbit[11].y_vel: -1289.4727177
orbitList.orbit[11].z_pos: 4573587.047
orbitList.orbit[11].z_vel: -5611.9096427
orbitList.orbit[12].time: 2011-04-18T18:04:09.999971
orbitList.orbit[12].x_pos: 5321619.584
orbitList.orbit[12].x_vel: 4940.1326028
orbitList.orbit[12].y_pos: 482329.205
orbitList.orbit[12].y_vel: -1302.37779
orbitList.orbit[12].z_pos: 4517202.62
orbitList.orbit[12].z_vel: -5664.8665099
orbitList.orbit[13].time: 2011-04-18T18:04:19.999997
orbitList.orbit[13].x_pos: 5370702.675
orbitList.orbit[13].x_vel: 4876.3876127
orbitList.orbit[13].y_pos: 469241.914
orbitList.orbit[13].y_vel: -1315.0398469
orbitList.orbit[13].z_pos: 4460291.912
orbitList.orbit[13].z_vel: -5717.1647385
orbitList.orbit[14].time: 2011-04-18T18:04:29.999983
orbitList.orbit[14].x_pos: 5419145.39
orbitList.orbit[14].x_vel: 4812.0586842
orbitList.orbit[14].y_pos: 456029.227
orbitList.orbit[14].y_vel: -1327.4565567
orbitList.orbit[14].z_pos: 4402861.54
orbitList.orbit[14].z_vel: -5768.7981761
orbitList.orbit[15].time: 2011-04-18T18:02:09.999978
orbitList.orbit[15].x_pos: 4684888.261
orbitList.orbit[15].x_vel: 5656.7879091
orbitList.orbit[15].y_pos: 628731.303
orbitList.orbit[15].y_vel: -1132.1831751
orbitList.orbit[15].z_pos: 5157252.161
orbitList.orbit[15].z_vel: -4987.7481093
orbitList.orbit[16].time: 2011-04-18T18:02:20.000005
orbitList.orbit[16].x_pos: 4741175.919
orbitList.orbit[16].x_vel: 5600.6311883
orbitList.orbit[16].y_pos: 617332.227
orbitList.orbit[16].y_vel: -1147.5966084
orbitList.orbit[16].z_pos: 5107075.321
orbitList.orbit[16].z_vel: -5047.5227482
orbitList.orbit[17].time: 2011-04-18T18:02:29.999991
orbitList.orbit[17].x_pos: 4796898.647
orbitList.orbit[17].x_vel: 5543.8028787
orbitList.orbit[17].y_pos: 605780.088
orbitList.orbit[17].y_vel: -1162.7951709
orbitList.orbit[17].z_pos: 5056303.659
orbitList.orbit[17].z_vel: -5106.7112726
orbitList.orbit[18].time: 2011-04-18T18:02:39.999977
orbitList.orbit[18].x_pos: 4852049.762
orbitList.orbit[18].x_vel: 5486.3098415
orbitList.orbit[18].y_pos: 594077.05
orbitList.orbit[18].y_vel: -1177.7761238
orbitList.orbit[18].z_pos: 5004943.072
orbitList.orbit[18].z_vel: -5165.3067372
orbitList.orbit[19].time: 2011-04-18T18:02:50.000003
orbitList.orbit[19].x_pos: 4906622.651
orbitList.orbit[19].x_vel: 5428.1590228
orbitList.orbit[19].y_pos: 582225.301
orbitList.orbit[19].y_vel: -1192.5367621
orbitList.orbit[19].z_pos: 4952999.524
orbitList.orbit[19].z_vel: -5223.3022647
orbitList.orbit[1].time: 2011-04-18T18:02:20.000005
orbitList.orbit[1].x_pos: 4741175.919
orbitList.orbit[1].x_vel: 5600.6311883
orbitList.orbit[1].y_pos: 617332.227
orbitList.orbit[1].y_vel: -1147.5966084
orbitList.orbit[1].z_pos: 5107075.321
orbitList.orbit[1].z_vel: -5047.5227482
orbitList.orbit[20].time: 2011-04-18T18:02:59.999989
orbitList.orbit[20].x_pos: 4960610.773
orbitList.orbit[20].x_vel: 5369.3574502
orbitList.orbit[20].y_pos: 570227.059
orbitList.orbit[20].y_vel: -1207.0744161
orbitList.orbit[20].z_pos: 4900479.048
orbitList.orbit[20].z_vel: -5280.6910459
orbitList.orbit[21].time: 2011-04-18T18:03:09.999975
orbitList.orbit[21].x_pos: 5014007.655
orbitList.orbit[21].x_vel: 5309.9122333
orbitList.orbit[21].y_pos: 558084.566
orbitList.orbit[21].y_vel: -1221.3864511
orbitList.orbit[21].z_pos: 4847387.747
orbitList.orbit[21].z_vel: -5337.4663412
orbitList.orbit[22].time: 2011-04-18T18:03:20.000001
orbitList.orbit[22].x_pos: 5066806.897
orbitList.orbit[22].x_vel: 5249.8305624
orbitList.orbit[22].y_pos: 545800.091
orbitList.orbit[22].y_vel: -1235.4702696
orbitList.orbit[22].z_pos: 4793731.788
orbitList.orbit[22].z_vel: -5393.621482
orbitList.orbit[23].time: 2011-04-18T18:03:29.999987
orbitList.orbit[23].x_pos: 5119002.17
orbitList.orbit[23].x_vel: 5189.1197079
orbitList.orbit[23].y_pos: 533375.93
orbitList.orbit[23].y_vel: -1249.3233103
orbitList.orbit[23].z_pos: 4739517.406
orbitList.orbit[23].z_vel: -5449.1498709
orbitList.orbit[24].time: 2011-04-18T18:03:39.999973
orbitList.orbit[24].x_pos: 5170587.219
orbitList.orbit[24].x_vel: 5127.7870195
orbitList.orbit[24].y_pos: 520814.403
orbitList.orbit[24].y_vel: -1262.9430495
orbitList.orbit[24].z_pos: 4684750.901
orbitList.orbit[24].z_vel: -5504.0449828
orbitList.orbit[25].time: 2011-04-18T18:03:49.999999
orbitList.orbit[25].x_pos: 5221555.863
orbitList.orbit[25].x_vel: 5065.8399238
orbitList.orbit[25].y_pos: 508117.856
orbitList.orbit[25].y_vel: -1276.3270012
orbitList.orbit[25].z_pos: 4629438.638
orbitList.orbit[25].z_vel: -5558.3003659
orbitList.orbit[26].time: 2011-04-18T18:03:59.999985
orbitList.orbit[26].x_pos: 5271901.995
orbitList.orbit[26].x_vel: 5003.285925
orbitList.orbit[26].y_pos: 495288.658
orbitList.orbit[26].y_vel: -1289.4727177
orbitList.orbit[26].z_pos: 4573587.047
orbitList.orbit[26].z_vel: -5611.9096427
orbitList.orbit[27].time: 2011-04-18T18:04:09.999971
orbitList.orbit[27].x_pos: 5321619.584
orbitList.orbit[27].x_vel: 4940.1326028
orbitList.orbit[27].y_pos: 482329.205
orbitList.orbit[27].y_vel: -1302.37779
orbitList.orbit[27].z_pos: 4517202.62
orbitList.orbit[27].z_vel: -5664.8665099
orbitList.orbit[28].time: 2011-04-18T18:04:19.999997
orbitList.orbit[28].x_pos: 5370702.675
orbitList.orbit[28].x_vel: 4876.3876127
orbitList.orbit[28].y_pos: 469241.914
orbitList.orbit[28].y_vel: -1315.0398469
orbitList.orbit[28].z_pos: 4460291.912
orbitList.orbit[28].z_vel: -5717.1647385
orbitList.orbit[29].time: 2011-04-18T18:04:29.999983
orbitList.orbit[29].x_pos: 5419145.39
orbitList.orbit[29].x_vel: 4812.0586842
orbitList.orbit[29].y_pos: 456029.227
orbitList.orbit[29].y_vel: -1327.4565567
orbitList.orbit[29].z_pos: 4402861.54
orbitList.orbit[29].z_vel: -5768.7981761
orbitList.orbit[2].time: 2011-04-18T18:02:29.999991
orbitList.orbit[2].x_pos: 4796898.647
orbitList.orbit[2].x_vel: 5543.8028787
orbitList.orbit[2].y_pos: 605780.088
orbitList.orbit[2].y_vel: -1162.7951709
orbitList.orbit[2].z_pos: 5056303.659
orbitList.orbit[2].z_vel: -5106.7112726
orbitList.orbit[3].time: 2011-04-18T18:02:39.999977
orbitList.orbit[3].x_pos: 4852049.762
orbitList.orbit[3].x_vel: 5486.3098415
orbitList.orbit[3].y_pos: 594077.05
orbitList.orbit[3].y_vel: -1177.7761238
orbitList.orbit[3].z_pos: 5004943.072
orbitList.orbit[3].z_vel: -5165.3067372
orbitList.orbit[4].time: 2011-04-18T18:02:50.000003
orbitList.orbit[4].x_pos: 4906622.651
orbitList.orbit[4].x_vel: 5428.1590228
orbitList.orbit[4].y_pos: 582225.301
orbitList.orbit[4].y_vel: -1192.5367621
orbitList.orbit[4].z_pos: 4952999.524
orbitList.orbit[4].z_vel: -5223.3022647
orbitList.orbit[5].time: 2011-04-18T18:02:59.999989
orbitList.orbit[5].x_pos: 4960610.773
orbitList.orbit[5].x_vel: 5369.3574502
orbitList.orbit[5].y_pos: 570227.059
orbitList.orbit[5].y_vel: -1207.0744161
orbitList.orbit[5].z_pos: 4900479.048
orbitList.orbit[5].z_vel: -5280.6910459
orbitList.orbit[6].time: 2011-04-18T18:03:09.999975
orbitList.orbit[6].x_pos: 5014007.655
orbitList.orbit[6].x_vel: 5309.9122333
orbitList.orbit[6].y_pos: 558084.566
orbitList.orbit[6].y_vel: -1221.3864511
orbitList.orbit[6].z_pos: 4847387.747
orbitList.orbit[6].z_vel: -5337.4663412
orbitList.orbit[7].time: 2011-04-18T18:03:20.000001
orbitList.orbit[7].x_pos: 5066806.897
orbitList.orbit[7].x_vel: 5249.8305624
orbitList.orbit[7].y_pos: 545800.091
orbitList.orbit[7].y_vel: -1235.4702696
orbitList.orbit[7].z_pos: 4793731.788
orbitList.orbit[7].z_vel: -5393.621482
orbitList.orbit[8].time: 2011-04-18T18:03:29.999987
orbitList.orbit[8].x_pos: 5119002.17
orbitList.orbit[8].x_vel: 5189.1197079
orbitList.orbit[8].y_pos: 533375.93
orbitList.orbit[8].y_vel: -1249.3233103
orbitList.orbit[8].z_pos: 4739517.406
orbitList.orbit[8].z_vel: -5449.1498709
orbitList.orbit[9].time: 2011-04-18T18:03:39.999973
orbitList.orbit[9].x_pos: 5170587.219
orbitList.orbit[9].x_vel: 5127.7870195
orbitList.orbit[9].y_pos: 520814.403
orbitList.orbit[9].y_vel: -1262.9430495
orbitList.orbit[9].z_pos: 4684750.901
orbitList.orbit[9].z_vel: -5504.0449828
rect: 0 0 17501 14379
ref_point_hgt: 0
ref_point_lat: 0
ref_point_line: 0
ref_point_lon: 0
ref_point_samp: 0
sample_type: 1
sensor: CSK
support_data.abs_orbit: 13415
support_data.acquisition_mode: ENHANCED SPOTLIGHT
support_data.azimuth_bandwidth: 25079.1685888832
support_data.azimuth_spacing: 0.702370481110099
support_data.calibration_lookup_flag: false
support_data.date: 2011-04-18T00:00:00.0000
support_data.first_line_time: 2011-04-18T18:3:27.915976
support_data.geom.bursts.burst[0].azimuth_anx_time: 0
support_data.geom.bursts.burst[0].azimuth_start_time: 2011-04-18T18:03:27.915951
support_data.geom.bursts.burst[0].azimuth_stop_time: 2011-04-18T18:03:29.380920
support_data.geom.bursts.burst[0].end_line: 14379
support_data.geom.bursts.burst[0].end_sample: 17501
support_data.geom.bursts.burst[0].start_line: 0
support_data.geom.bursts.burst[0].start_sample: 0
support_data.geom.bursts.number: 1
support_data.geom.bursts.number_lines_per_burst: 14380
support_data.geom.bursts.number_samples_per_burst: 17502
support_data.geom.gcp.number: 1
support_data.geom.gcp[0].azimuthTime: 2011-04-18T18:03:28.648636
support_data.geom.gcp[0].im_pt.x: 8707.88860642676
support_data.geom.gcp[0].im_pt.y: 7191.48486375724
support_data.geom.gcp[0].slant_range_time: 0.00494748983592736
support_data.geom.gcp[0].world_pt.hgt: 8.56061888043765e-11
support_data.geom.gcp[0].world_pt.lat: 43.6090634900135
support_data.geom.gcp[0].world_pt.lon: 1.44722199061804
support_data.last_line_time: 2011-04-18T18:3:29.380925
support_data.line_time_interval: 0.000101881160627516
support_data.look_side: RIGHT
support_data.mds1_tx_rx_polar: HH
support_data.number_lines: 14380
support_data.number_samples: 17502
support_data.orbit_pass: DESCENDING
support_data.product_type: SCS_B
support_data.pulse_repetition_frequency: 3321.5234720992
support_data.radar_frequency: 9600000000
support_data.range_bandwidth: 303369140.625
support_data.range_sampling_rate: 462222222.222222
support_data.range_spacing: 0.324294726201923
support_data.slant_range_to_first_pixel: 0.00492865065384615
support_data.slice_num: 1
support_data.swath: 1
type: ossimCosmoSkymedModel
ul_lat: 43.6454490978792
ul_lon: 1.52085604938497
ur_lat: 43.6620355343853
ur_lon: 1.39653349157868
......@@ -98,10 +98,9 @@ public:
/*get lookup data for calculating backscatter */
void CreateCalibrationLookupData(const short type) override;
virtual void ParseGdal(const MetadataSupplierInterface &) override
{
itkExceptionMacro("ParseGdal not implemented in Radarsat2ImageMetadataInterface.");
}
void ParseGdal(const MetadataSupplierInterface &) override;
void ParseGeom(const MetadataSupplierInterface &) override;
void Parse(const MetadataSupplierInterface &) override;
......
......@@ -210,6 +210,11 @@ public:
itkExceptionMacro("ParseGdal not implemented in SarDefaultImageMetadataInterface, no captor type found");
}
virtual void ParseGeom(const MetadataSupplierInterface &) override
{
itkExceptionMacro("ParseGeom not implemented in SarDefaultImageMetadataInterface, no captor type found");
}
bool CanRead() const override
{
// This class is the default one, it has to be able to call every metadata
......
......@@ -28,6 +28,7 @@
#include "itkPointSet.h"
#include "otbSarCalibrationLookupData.h"
#include "otbStringUtils.h"
#include "otbSARMetadata.h"
namespace otb
{
......@@ -115,7 +116,13 @@ public:
virtual void ParseGdal(const MetadataSupplierInterface &) =0;
virtual void ParseGeom(const MetadataSupplierInterface &);
virtual void ParseGeom(const MetadataSupplierInterface &) =0;
bool GetSAR(const MetadataSupplierInterface &, SARParam &);
std::vector<AzimuthFmRate> GetAzimuthFmRateGeom(const MetadataSupplierInterface &) const;
std::vector<DopplerCentroid> GetDopplerCentroidGeom(const MetadataSupplierInterface &) const;
std::vector<Orbit> GetOrbitsGeom(const MetadataSupplierInterface &) const;
std::vector<CalibrationVector> GetCalibrationVectorGeom(const MetadataSupplierInterface &) const;
std::vector<SARNoise> GetNoiseVectorGeom(const MetadataSupplierInterface &) const;
protected:
SarImageMetadataInterface();
......
......@@ -23,7 +23,6 @@
#include "otbSarImageMetadataInterface.h"
#include "otbXMLMetadataSupplier.h"
#include "otbSARMetadata.h"
namespace otb
{
......@@ -100,9 +99,9 @@ public:
/*get lookup data for calculating backscatter */
void CreateCalibrationLookupData(const short type) override;
void ParseGdal(const MetadataSupplierInterface &);
void ParseGdal(const MetadataSupplierInterface &) override;
void ParseGeom(const MetadataSupplierInterface &);
void ParseGeom(const MetadataSupplierInterface &) override;
void Parse(const MetadataSupplierInterface &) override;
......@@ -115,23 +114,18 @@ protected:
/* Fetch the AzimuthFmRate metadata */
std::vector<AzimuthFmRate> GetAzimuthFmRate(const XMLMetadataSupplier&) const;
std::vector<AzimuthFmRate> GetAzimuthFmRateGeom(const MetadataSupplierInterface&) const;
/* Fetch the DopplerCentroid metadata */
std::vector<DopplerCentroid> GetDopplerCentroid(const XMLMetadataSupplier&) const;
std::vector<DopplerCentroid> GetDopplerCentroidGeom(const MetadataSupplierInterface&) const;
/* Fetch the Orbits metadata */
std::vector<Orbit> GetOrbits(const XMLMetadataSupplier&) const;
std::vector<Orbit> GetOrbitsGeom(const MetadataSupplierInterface&) const;
/* Fetch the Calibration metadata */
std::vector<CalibrationVector> GetCalibrationVector(const XMLMetadataSupplier&) const;
std::vector<CalibrationVector> GetCalibrationVectorGeom(const MetadataSupplierInterface&) const;
/* Fetch the noise LUTs */
std::vector<SARNoise> GetNoiseVector(const XMLMetadataSupplier&) const;
std::vector<SARNoise> GetNoiseVectorGeom(const MetadataSupplierInterface&) const;
/* Compute the mean terrain elevation */
double getBandTerrainHeight(const XMLMetadataSupplier&) const;
......
......@@ -174,11 +174,10 @@ public:
* in the order R, G, B */
std::vector<unsigned int> GetDefaultDisplay() const override;
virtual void ParseGdal(const MetadataSupplierInterface &) override
{
itkExceptionMacro("ParseGdal not implemented in TerraSarImageMetadataInterface.");
}
void ParseGdal(const MetadataSupplierInterface &) override;
void ParseGeom(const MetadataSupplierInterface &) override;
void Parse(const MetadataSupplierInterface &) override;
protected:
......
......@@ -365,9 +365,8 @@ void CosmoImageMetadataInterface::ParseGdal(const MetadataSupplierInterface & md
itkWarningMacro(<< "Not an expected product type (only SCS_B and SCS_U expected) " << m_Imd[MDStr::ProductType] );
}
m_Imd.Add(MDStr::Mission, "CSK");
m_Imd.Add(MDStr::SensorID, "CSK");
Fetch(MDStr::Instrument, mds, "Satellite_ID");
Fetch(MDStr::OrbitDirection, mds, "Orbit_Direction");
bool hasOrbitNumber ;
std::string orbitNumber = mds.GetMetadataValue("Orbit_Number", hasOrbitNumber) ;
......@@ -380,9 +379,7 @@ void CosmoImageMetadataInterface::ParseGdal(const MetadataSupplierInterface & md
Fetch(MDStr::Polarization, mds, "S01_Polarisation") ;
m_Imd.Add(MDStr::Swath, "S1");
bool hasPRF;
std::string PRFNumber = mds.GetMetadataValue("S01_PRF", hasPRF);
m_Imd.Add(MDNum::PRF, std::stoi(PRFNumber));
Fetch(MDNum::PRF, mds, "S01_PRF");
//getTime
......@@ -418,7 +415,36 @@ void CosmoImageMetadataInterface::ParseGdal(const MetadataSupplierInterface & md
void CosmoImageMetadataInterface::ParseGeom(const MetadataSupplierInterface & mds)
{
Superclass::ParseGeom(mds);
// Check acquisition mode and product type
Fetch(MDStr::Mode, mds, "support_data.acquisition_mode");
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, "support_data.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::Mission, "CSK");
m_Imd.Add(MDStr::SensorID, "CSK");
Fetch(MDStr::OrbitDirection, mds, "support_data.orbit_pass");
Fetch(MDNum::OrbitNumber, mds, "support_data.abs_orbit");
Fetch(MDNum::RadarFrequency, mds, "support_data.radar_frequency");
Fetch(MDStr::Polarization, mds, "header.polarisation");
m_Imd.Add(MDStr::Swath, "S1");
Fetch(MDNum::PRF, mds, "support_data.pulse_repetition_frequency");
Fetch(MDTime::AcquisitionStartTime, mds, "header.first_line_time");
Fetch(MDTime::AcquisitionStopTime, mds, "header.last_line_time");
//SAR Parameters
SARParam sarParam;
sarParam.orbits = this->GetOrbitsGeom(mds);
m_Imd.Bands[0].Add(MDGeom::SAR, sarParam);
}
void CosmoImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
......@@ -427,7 +453,7 @@ void CosmoImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
if (mds.GetAs<std::string>("", "MISSION_ID") == "CSK")
this->ParseGdal(mds);
// Try to fetch the metadata from GEOM file
else if (mds.GetAs<std::string>("", "support_data.sensor") == "CSK")
else if (mds.GetAs<std::string>("", "sensor") == "CSK")
this->ParseGeom(mds);
// Failed to fetch the metadata
else
......
......@@ -244,7 +244,7 @@ Radarsat2ImageMetadataInterface::UIntVectorType Radarsat2ImageMetadataInterface:
//"
void Radarsat2ImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
void Radarsat2ImageMetadataInterface::ParseGdal(const MetadataSupplierInterface & mds)
{
// Metadata read by GDAL
Fetch(MDTime::AcquisitionStartTime, mds, "ACQUISITION_START_TIME");
......@@ -294,5 +294,26 @@ void Radarsat2ImageMetadataInterface::Parse(const MetadataSupplierInterface & md
}
}
void Radarsat2ImageMetadataInterface::ParseGeom(const MetadataSupplierInterface & mds)
{
SARParam sarParam;
Fetch(MDStr::Polarization, mds, "POLARIMETRIC_INTERP", 0);
m_Imd.Bands[0].Add(MDGeom::SAR, sarParam);
throw "Not implemented";
}
void Radarsat2ImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
{
// Try to fetch the metadata from GDAL Metadata Supplier
if (mds.GetAs<std::string>("", "SATELLITE_IDENTIFIER") == "RADARSAT-2")
this->ParseGdal(mds);
// Try to fetch the metadata from GEOM file
else if (mds.GetAs<std::string>("", "sensor") == "RADARSAT-2")
this->ParseGeom(mds);
// Failed to fetch the metadata
else
otbGenericExceptionMacro(MissingMetadataException,
<< "Not a Sentinel1 product");
}
} // end namespace otb
......@@ -189,21 +189,166 @@ SarImageMetadataInterface::IndexType SarImageMetadataInterface::GetRadiometricCa
return SarImageMetadataInterface::GetConstantPolynomialDegree();
}
std::vector<AzimuthFmRate> SarImageMetadataInterface::GetAzimuthFmRateGeom(const MetadataSupplierInterface & mds) const
{
std::vector<AzimuthFmRate> azimuthFmRateVector;
// Number of entries in the vector
int listCount = mds.GetAs<int>("azimuthFmRate.azi_fm_rate_coef_nb_list");
// This streams wild hold the iteration number
std::ostringstream oss;
for (int listId = 1 ; listId <= listCount ; ++listId)
{
oss.str("");
oss << listId;
// Base path to the data, that depends on the iteration number
std::string path_root = "azimuthFmRate.azi_fm_rate_coef_list" + oss.str();
AzimuthFmRate afr;
std::istringstream(mds.GetAs<std::string>(path_root + ".azi_fm_rate_coef_time")) >> afr.azimuthTime;
afr.t0 = mds.GetAs<double>(path_root + ".slant_range_time");
std::vector<double> polynom(3);
for (int polyId = 1 ; polyId < 4 ; ++polyId)
polynom.push_back(mds.GetAs<double>(path_root+"."+std::to_string(polyId)+".azi_fm_rate_coef"));
afr.azimuthFmRatePolynomial = polynom;
azimuthFmRateVector.push_back(afr);
}
return azimuthFmRateVector;
}
void SarImageMetadataInterface::ParseGeom(const MetadataSupplierInterface & mds)
{
Fetch(MDTime::AcquisitionStartTime, mds, "support_data.first_line_time");
Fetch(MDTime::AcquisitionStopTime, mds, "support_data.last_line_time");
Fetch(MDStr::BeamMode, mds, "manifest_data.acquisition_mode");
Fetch(MDStr::BeamSwath, mds, "manifest_data.swath");
Fetch(MDNum::LineSpacing, mds, "support_data.azimuth_spacing");
Fetch(MDStr::Mission, mds, "manifest_data.instrument");
Fetch(MDStr::OrbitDirection, mds, "manifest_data.orbit_pass");
Fetch(MDNum::OrbitNumber