Request for Changes-48: Add geometric correction to S1 Sensor Model

From OTBWiki
Revision as of 10:21, 1 July 2016 by Julien (Talk | contribs) (Tests)

Jump to: navigation, search

[Request for Changes - 48] Add geometric correction to S1 Sensor Model


  • Author: Luc Hermitte, Julien Michel
  • Additional Contributors
  • Submitted on 26.06.2016
  • Proposed target release: 5.6
  • Status: [ ] Adopted, [ ] Rejected, [ ] Merged in OTB x.y
  • See:


Add support for geometric ortho-rectification to SAR Sensor for Sentinel-1.


This task continues efforts started in RfCh-4. Only the radiometric calibration was done, geometric calibration has been added to conform to inverse SAR geolocation method found in ESA document "Guide to ASAR geocoding" (ref RSL-ASAR-GC-AD).

Implementation details

Classes and files

M       Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx
M       Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx
M       Modules/IO/ImageIO/include/otbImageFileReader.txx
Boost dependencies
M       .travis.yml
M       Modules/ThirdParty/Boost/otb-module-init.cmake
M       SuperBuild/CMake/External_boost.cmake

Several issues have been fixed here:

  • First, travis needs to know that boost is required to compile
  • Then, it's important to never call find_package(boost) several times. The later calls will clear everything that was found initially. If an initial call was searching for a given mandatory boost module (like date-time), and a second and optional call searches for an optional module (like tests), then the first module found is lost.
M       Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h
M       Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h
M       Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx
M       Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx

As some keywords have been moved around, and as dates are now always stored as ISO UTC time stamps, OTB code has been upgraded to reflect the changes in ossim plugins.

M       Modules/ThirdParty/OssimPlugins/otb-module.cmake
M       Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimKeyWordListUtilities.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimOperatorUtilities.h
M       Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp
M       Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimRangeUtilities.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.cpp
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModelPathsAndKeys.h
M       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp
M       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h
D       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.cpp
D       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.cpp
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1SarSensorModel.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimStringUtilities.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.cpp
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarXSarSensorModel.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.cpp
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimTimeUtilities.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimTraceHelpers.h
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.cpp
A       Modules/ThirdParty/OssimPlugins/src/ossim/ossimXmlTools.h
A       Modules/ThirdParty/OssimPlugins/test/CMakeLists.txt
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-ew-grd-hh-20160117t204113-20160117t204213-009539-00ddc4-001.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-ew-grd-hv-20160117t204113-20160117t204213-009539-00ddc4-002.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw-grd-vh-20151215t050546-20151215t050615-009048-00cfc7-002.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw-grd-vv-20151215t050546-20151215t050615-009048-00cfc7-001.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw1-slc-vh-20160114t054006-20160114t054031-009486-00dc3c-001.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw1-slc-vv-20160114t054006-20160114t054031-009486-00dc3c-004.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw2-slc-vh-20160114t054007-20160114t054032-009486-00dc3c-002.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw2-slc-vv-20160114t054007-20160114t054032-009486-00dc3c-005.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw3-slc-vh-20160114t054005-20160114t054030-009486-00dc3c-003.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-iw3-slc-vv-20160114t054005-20160114t054030-009486-00dc3c-006.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-s4-grd-vh-20150812t014643-20150812t014708-007223-009e1a-002.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-s4-grd-vv-20150812t014643-20150812t014708-007223-009e1a-001.xml
A       Modules/ThirdParty/OssimPlugins/test/data/s1/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.xml
A       Modules/ThirdParty/OssimPlugins/test/data/tsx/PANGKALANBUUN/GEOREF.xml
A       Modules/ThirdParty/OssimPlugins/test/data/tsx/PANGKALANBUUN/TSX1_SAR__SSC______SM_D_SRA_20080313T221955_20080313T222003.xml
A       Modules/ThirdParty/OssimPlugins/test/data/tsx/UPSALA_GLACIER/GEOREF.xml
A       Modules/ThirdParty/OssimPlugins/test/data/tsx/UPSALA_GLACIER/TSX1_SAR__MGD.xml
A       Modules/ThirdParty/OssimPlugins/test/ossimSarSensorModelTest.cpp
A       Modules/ThirdParty/OssimPlugins/test/ossimSentinel1ModelTest.cpp
A       Modules/ThirdParty/OssimPlugins/test/ossimStringUtilitiesTest.cpp
A       Modules/ThirdParty/OssimPlugins/test/ossimTerraSarXSarSensorModelTest.cpp
A       Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesBench.cpp
A       Modules/ThirdParty/OssimPlugins/test/ossimTimeUtilitiesTest.cpp

Helper tools Several utilities has been added to prevent code repeats, and to be as fast as possible.

  • new string_view class inspired by C++17 one
  • new overloads for a generic and type safe (de)serialization to/from keyword lists
  • new overloads for a generic and type safe deserialization to/from XML docs
  • new ModifiedJulianDate (MJD) class + an efficient and simplified implementation of POSIX strptime()
    • Also, there was an copy-paste error in previous code that converted dates stored in string ISO string format (i.e. %Y-%m-%dT%H:%M:%S.%f) into MJD: the subsecond fraction was rounded down to 0.
  • Helper classes to define arithmetic types (inspired from boost.operators, but specialized for times and durations)

Changes in SensorModel classes Previous S1Model was inheriting from ossimSarModel. It has been decided to write an alternative implementation that follows ESA document "Guide to ASAR geocoding" (ref RSL-ASAR-GC-AD), and to have S1Model inherit from this new class: ossimSarSensorModel.

Also the initial S1Model was initially split into two files: the S1Model and a S1ProductDoc that served only to read data from XML product. In order to simplifies things, parameters reading from the XML has been moved back to S1Model. It's a simplification because the extraction of the product parameters stored in the keyword list must fill data from the parent ossimSarSensorModel. As it makes no sense to have the S1ProductDoc to also inherit from this class, S1ProductDoc has been discarded.

Moreover, the initial S1Model implementation has been misguided by GDAL choices regarding what is a band. Indeed, even if there are several S1 products along with a manifest file, these products are not multiple bands from a same tile. As a consequence

  • Band[x]. prefix has been removed from produced keyword list, and moved either to have no prefix or under a new header. prefix. Comments on the subject are welcomed.
  • support_data.azimuth_spacing and support_data.range_spacing are no longer divided by a number of bands (as there is only one band).

So far, no work has been done on TerraSarX model. Its related tests will fail.

Regarding keyword list:

  • Band[x]. prefix has been removed or renamed, depending on the keywords.
  • there is a lot of redundancy in the keyword list files produced, a closer look will be required to see why keywords like first_line_time, last_line_time, sample_type, number_line, number_samples, polarisation or swath appears in header. (ex-band[x].), support_data., calibration.

Tests A few tests are known to fail to far:

  • s1_forward_s1a-ew-grd-hh-20160117t204113-20160117t204213-009539-00ddc4-001
  • s1_forward_s1a-ew-grd-hv-20160117t204113-20160117t204213-009539-00ddc4-002
  • all TerraSarX (TSX) tests

TODO: write similar tests for the otbSensorModelAdapter layer.


List impacted applications, and explain the changes that were made.

Consider grouping changes by module names if several modules are impacted.

Give insight on important implementation details, and on all API changes (add link to specific changesets if possible).


  • raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_SENTINEL1 was using a baseline built from previous algorithm. Alas, subsecond fraction was lost in the process. Its baseline has been updated as a consequence from something generated from the new algorithm.
    • Against a reference calibration done with S1 Toolbox (S1A_S6_SLC__1SSV_20150619T195043_____20150619T195101_006447_00887D_774E_Calibr), the TotalDifference error:
      • was of 252.616 on 446,975,369 pixels
      • and is now of 0.0420191 on 200,089,663 pixels
  • Tests have been added at ossimPlugins level (in order to be eventually contributed to ossim)

New tests added following the new sensor model and orthorectification tests framework (see rfc 33):

Test #1951: prTvSensorModel_sentinel1-1
Test #1974: prTvOrthoRectification_sentinel1_noDEM
Test #1975: prTvOrthoRectification_sentinel1_DEMSRTM
Test #1976: prTvOrthoRectification_sentinel1_DEMGTIFF

List impacted tests, and explain the changes that were made.

Consider grouping changes by module names if several modules are impacted.

Link to dashboard pages of impacted if possible.


List documentation modification that were made (doxygen, example, software guide, application documentation, cookbook).

Additional notes

List remaining open issues if any, and additional notes.

  • TerraSarX needs to be updated to the new SarSensorModel classes.