[Git][debian-gis-team/otb][upstream] New upstream version 8.0.1+dfsg

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Thu Apr 28 08:00:42 BST 2022



Bas Couwenberg pushed to branch upstream at Debian GIS Project / otb


Commits:
690ba39b by Bas Couwenberg at 2022-04-28T05:36:01+02:00
New upstream version 8.0.1+dfsg
- - - - -


10 changed files:

- CMake/FindMuParser.cmake
- CMakeLists.txt
- Modules/Adapters/BoostAdapters/include/otbJoinContainer.h
- Modules/Core/Metadata/src/otbImageMetadata.cxx
- Modules/Wrappers/SWIG/otb-module-init.cmake
- Modules/Wrappers/SWIG/src/otbImageMetadata.i
- Modules/Wrappers/SWIG/test/python/CMakeLists.txt
- + Modules/Wrappers/SWIG/test/python/PythonImageMetadataTest.py
- Packaging/Files/setup_python.sh
- RELEASE_NOTES.txt


Changes:

=====================================
CMake/FindMuParser.cmake
=====================================
@@ -47,7 +47,7 @@ if(EXISTS "${MUPARSER_INCLUDE_DIR}/muParserDef.h")
     MUPARSER_VERSION_OLD_STYLE "${_muParserDef_h_CONTENTS}")
 
   # Try to find the version for muparser >= 2.3
-  string(REGEX REPLACE ".*static *const *string_type *ParserVersion *= *string_type\\(_T\\(\"([0-9.]+)\"\\)\\);.*" 
+  string(REGEX REPLACE ".*static *const *string_type *ParserVersion *= *string_type\\(_T\\(\"([0-9.]+)([^0-9.]+)?\"\\)\\);.*" 
       "\\1" MUPARSER_VERSION "${MUPARSER_VERSION_OLD_STYLE}")
   
   if(MUPARSER_VERSION MATCHES "^[0-9]+\$")


=====================================
CMakeLists.txt
=====================================
@@ -153,7 +153,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
 # OTB version number.
 set(OTB_VERSION_MAJOR "8")
 set(OTB_VERSION_MINOR "0")
-set(OTB_VERSION_PATCH "0")
+set(OTB_VERSION_PATCH "1")
 set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
 
 get_package_name(${OTB_SOURCE_DIR} ${PROJECT_NAME} OTB_VERSION_STRING2)


=====================================
Modules/Adapters/BoostAdapters/include/otbJoinContainer.h
=====================================
@@ -58,6 +58,32 @@ inline std::ostream& Join(std::ostream& os, TRange const& range, std::string con
   }
   return os;
 }
+
+/**
+ * Joins elements from a map (second) into a stream.
+ * \tparam Tmap Map type
+ * \param os  destination stream
+ * \param[in] range  Range to print
+ * \param[in] separator  Separator string to use between elements.
+ *
+ * \return the stream
+ * \throw None At least, this function is exception neutral.
+ */
+template <typename Tmap>
+inline std::ostream& JoinMap(std::ostream& os, Tmap const& range, std::string const& separator)
+{
+  if (!boost::empty(range))
+  {
+    typename boost::range_iterator<Tmap const>::type       first = boost::begin(range);
+    typename boost::range_iterator<Tmap const>::type const last  = boost::end(range);
+    os << first->second;
+    for (++first; first != last; ++first)
+    {
+      os << separator << first->second;
+    }
+  }
+  return os;
+}
 } // end namespace otb
 
 #ifndef OTB_MANUAL_INSTANTIATION


=====================================
Modules/Core/Metadata/src/otbImageMetadata.cxx
=====================================
@@ -20,6 +20,7 @@
 
 #include "otbImageMetadata.h"
 #include "otbSpatialReference.h"
+#include "otbJoinContainer.h"
 
 namespace otb
 {
@@ -201,11 +202,8 @@ bool ImageMetadataBase::Has(const MDStr& key) const
 std::string ImageMetadataBase::GetKeyListStr() const
 {
   std::ostringstream oss;
-  for (const auto& kv : MetaData::MDStrNames.left)
-    oss << kv.second << " ";
-  auto returnString = oss.str();
-  returnString.pop_back();
-  return returnString;
+  JoinMap(oss, MetaData::MDStrNames.left, " ");
+  return oss.str();
 }
 
 // -------------------- LUT1D utility function ----------------------------


=====================================
Modules/Wrappers/SWIG/otb-module-init.cmake
=====================================
@@ -50,4 +50,4 @@ if ( OTB_WRAP_PYTHON )
     message( WARNING 
       "OTB wrappers will be done without support for NumPy (not found).")
   endif()
-endif()
\ No newline at end of file
+endif()


=====================================
Modules/Wrappers/SWIG/src/otbImageMetadata.i
=====================================
@@ -91,7 +91,6 @@ class ImageMetadataBase
 {
 public:
   std::string GetProjectedGeometry() const;
-  std::string GetProjectionWKT() const;
   std::string GetProjectionProj() const;
 
   std::string GetKeyListNum() const;
@@ -113,7 +112,7 @@ public:
   std::string __repr__() {
     std::ostringstream oss;
     oss << *$self;
-    return oss.str().c_str();
+    return oss.str();
   }
 }
 
@@ -174,6 +173,14 @@ public:
     return it != otb::MetaData::MDGeomNames.right.end();
   }
 
+  bool is_extra(const std::string& key) {
+    return $self->Has(key);
+  }
+
+  std::string get_extra(const std::string& key) {
+    return $self->operator[](key);
+  }
+
   bool has(const std::string& key) const {
     auto it_num = otb::MetaData::MDNumNames.right.find(key);
     if (it_num != otb::MetaData::MDNumNames.right.end())
@@ -199,7 +206,7 @@ public:
     if (it_geom != otb::MetaData::MDGeomNames.right.end())
       return $self->Has(it_geom->second);
 
-    return false;
+    return $self->Has(key);
   }
   
   void __setitem__(const std::string& key, const double val) {
@@ -214,7 +221,13 @@ public:
     if (it != otb::MetaData::MDStrNames.right.end())
       $self->Add(it->second, val);
     else
-      $self->Add(key, val);
+    {
+      auto it2 = otb::MetaData::MDGeomNames.right.find(key);
+      if (it2 != otb::MetaData::MDGeomNames.right.end())
+        $self->Add(it2->second, val);
+      else
+        $self->Add(key, val);
+    }
   }
   void __setitem__(const std::string& key, const otb::MetaData::LUT1D& val) {
     auto it = otb::MetaData::MDL1DNames.right.find(key);
@@ -263,6 +276,8 @@ public:
         return self.get_time(key)
       elif self.is_geom(key):
         return None # TODO: the geom part of the Imagemetadata is not wrapped yet
+      elif self.is_extra(key):
+        return self.get_extra(key)
       else:
         return None
   }


=====================================
Modules/Wrappers/SWIG/test/python/CMakeLists.txt
=====================================
@@ -180,3 +180,8 @@ add_test( NAME pyTvNoUpdateParameter
   ${OTB_DATA_ROOT}/Input/training/training.shp
   )
 
+add_test( NAME pyTuImageMetadata
+  COMMAND ${TEST_DRIVER} Execute
+  ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py
+  PythonImageMetadataTest
+  )


=====================================
Modules/Wrappers/SWIG/test/python/PythonImageMetadataTest.py
=====================================
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
+#
+# This file is part of Orfeo Toolbox
+#
+#     https://www.orfeo-toolbox.org/
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+def test(otb, argv):
+    imd = otb.ImageMetadataBase()
+
+    # Setters
+    imd["OrbitNumber"] = 2.0
+    imd["SensorID"] = "PHR"
+    imd["ProjectionWKT"] = "UTM projRef"
+    imd["Comment"] = "Test extra keys"
+
+    # is_xxx
+    assert imd.is_num("OrbitNumber")
+    assert not imd.is_num("SensorID")
+
+    assert imd.is_str("SensorID")
+    assert not imd.is_str("OrbitNumber")
+
+    assert imd.is_l1d("SpectralSensitivity")
+    assert not imd.is_l1d("SensorID")
+
+    assert imd.is_time("ProductionDate")
+    assert not imd.is_time("SensorID")
+
+    assert imd.is_geom("ProjectionWKT")
+    assert not imd.is_geom("SensorID")
+
+    assert imd.is_extra("Comment")
+    assert not imd.is_extra("SensorID")
+
+    # get_xxx
+    assert imd.get_num("OrbitNumber") == 2.0
+    assert imd.get_str("SensorID") == "PHR"
+    assert imd.get_extra("Comment") == "Test extra keys"
+
+    # Getters
+    assert imd["OrbitNumber"] == 2.0
+    assert imd["SensorID"] == "PHR"
+    # assert imd["ProjectionWKT"] == "UTM projRef" # This getter is not implemented yet
+    assert imd["Comment"] == "Test extra keys"
+
+    # has
+    assert imd.has("OrbitNumber")
+    assert imd.has("SensorID")
+    assert imd.has("Comment")
+    assert not imd.has("Comment2")
+    assert not imd.has("RadiometricLevel")
+
+    # GetProjectedGeometry
+    assert imd.GetProjectedGeometry() == "UTM projRef"
+
+    # GetProjectionProj
+    imd["ProjectionProj"] = "Proj String"
+    assert imd.GetProjectionProj() == "Proj String"


=====================================
Packaging/Files/setup_python.sh
=====================================
@@ -29,8 +29,8 @@ python_version_check() {
 
 python_check_failed() {
     printf %s\\n "*****Error occurred during installation******"
-    printf %s\\n "OTB python bindings normally require python 3.8 (or 3.7 for windows users) but current \
-                  detected python version is $python_version"
+    printf %s\\n "OTB python bindings normally require python 3.8 on Linux and MacOS and 3.7 on windows, \
+                  but current detected python version is $python_version"
     printf %s\\n "If you have python 3.8 (or 3.7 for win users) installed in your system you should \
                   set OTB_PYTHON_EXE and re-run this installation script."
     printf %s\\n "eg: OTB_PYTHON_EXE=/path/to/python3 ./OTB-X.Y-Linux64.run"
@@ -61,15 +61,15 @@ python_version_check
 
 if [ ! $CUSTOM_PYTHON ]
   then
-  if [ ! "$python_major_version" -eq 3 ] && [ ! "$python_minor_version" -eq 5 ]
+  if [ ! "$python_major_version" -eq 3 ] && [ ! "$python_minor_version" -eq 8 ]
     then
     python_check_failed
   fi
 else # case where user provides an OTB_PYTHON_EXE
-  if [ ! "$python_major_version" -eq 3 ] || [ ! "$python_minor_version" -eq 5 ]
+  if [ ! "$python_major_version" -eq 3 ] || [ ! "$python_minor_version" -eq 8 ]
     then
     printf %s\\n "*****Warning******"
-    printf %s\\n "OTB python bindings normally require python3.5."
+    printf %s\\n "OTB python bindings normally require python3.8 on Linux and MacOS and 3.7 on Microsoft Windows."
     printf %s\\n "The version of OTB_PYTHON_EXE ($OTB_PYTHON_EXE) is \
                   $python_version."
     printf %s\\n "This case is undefined unless you are sure the packages were \


=====================================
RELEASE_NOTES.txt
=====================================
@@ -1,3 +1,20 @@
+OTB-v 8.0.1 - Changes since version 8.0.0 (April 27th, 2022)
+---------------------------------------------------------------------
+
+Bugs fixed:
+
+   * !906: Add missing parts of python API by Julien Osman
+
+CI:
+
+   * !911: Upgrade zlib to version 1.2.12 and GDAL to version 3.4.2 by Julien Osman
+  
+Documentation:
+
+   * !911: Fix formating issue by Julien Osman
+   * !911: Update warning message about python version by Julien Osman
+
+
 OTB-v 8.0.0 - Changes since version 7.4.0 (March 22th, 2022)
 ---------------------------------------------------------------------
 



View it on GitLab: https://salsa.debian.org/debian-gis-team/otb/-/commit/690ba39b4efb364d8d79bf557df14123019361c2

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/otb/-/commit/690ba39b4efb364d8d79bf557df14123019361c2
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220428/b6376e7f/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list