Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

30 remote module (testing travis) #1

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
69cf05c
Renamed folders
julie-brd Jan 31, 2020
a89881a
Refactored code
julie-brd Feb 12, 2020
f79e674
ENH: Add LIS.remote.cmake and update comments
Feb 13, 2020
59b3ff2
ENH: activate ComputeSnowLine application (link with histo_utils.cxx)
Feb 13, 2020
4a59cf4
CMake: use same cmake minimum version as OTB
Feb 13, 2020
06c7a35
CI: move CI scripts to .ci directory
Feb 13, 2020
cec976b
Remove bogus comments
Feb 13, 2020
83f0485
CMake: move python_include under src/python
Feb 13, 2020
45067d9
Python: update setup.py
Feb 13, 2020
a2a97ce
TEST: update cmake script for test, add ctest label
Feb 13, 2020
801b1ce
Test: add python test driver
Feb 13, 2020
78e3a74
CMake: enable_shared is no longer required
Feb 13, 2020
7e17d5e
CMake: fix name of OTB module name
Feb 13, 2020
9514fca
CMake: python package s2snow depends on otbApplication
Feb 13, 2020
d8a71d3
python_src is moved
Feb 13, 2020
0870bf3
CI: fix travis build
Feb 13, 2020
f0c3ee9
ENH: use python3 in hashbang
Feb 26, 2020
5f51da4
CMake: set OTB_BUILD_MODULE_AS_STANDALONE to ON
Feb 26, 2020
03c1d12
CMake: fix OTB_PYTHONPATH when using standalone binaries
Feb 26, 2020
edb1963
ENH: workaroud for otb gitlab issue #2030
Feb 26, 2020
5745dcf
TEST: fix failing tests
Feb 26, 2020
0ffbf40
Python: fix hashbang line for python3
Feb 26, 2020
8e5ddb9
test without PYTHONPATH frm otbenv.profile
Feb 26, 2020
4b9ae98
use github fork (no travis on gitlab)
Mar 9, 2020
b1c1a37
fix python import
Mar 9, 2020
4d70196
fix LISInDoxygenGroup
Mar 9, 2020
7fb17d2
add lis otb apps path
Mar 9, 2020
9761a5f
run_snow_detecter.py': No such file or directory
Mar 9, 2020
56c3a9d
fix test
Mar 9, 2020
d23e041
test: try changing import order
Mar 9, 2020
6620a00
test: try changing import order
Mar 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
language: cpp

git:
depth: 3

env:
global:
- OTB_URL=https://www.orfeo-toolbox.org/packages/archives/OTB
- OTB_VER=7.0.0
- LIS_DATA_ROOT=$HOME/Data-LIS

matrix:
include:
- os: linux
dist: bionic
compiler: gcc
sudo: required
before_install:
- python --version
- sudo update-alternatives --remove python /usr/bin/python2
- sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
- python --version
- sudo apt-get install -y
ninja-build
libglvnd-dev
libglu1-mesa-dev
python3-lxml
python3-numpy
python3-scipy
python3-matplotlib
python3-dev
python3-setuptools
python3-gdal
gdal-bin
curl
- curl -k https://zenodo.org/record/166511/files/Data-LIS.tar.gz?download=1 -o $HOME/Data-LIS.tar.gz
- cd $HOME && tar -xf Data-LIS.tar.gz
env:
- OTB_OS=Linux64
- OTB_PKG_EXT=run
# - os: osx
# osx_image: xcode10.2
# compiler: clang
# before_install:
# - brew install ninja libomp git-lfs
# env:
# - OTB_OS=Darwin64
# - OTB_PKG_EXT=run
# - os: windows
# before_install:
# - choco install python3 --params "/InstallDir:C:\Python3"
# - choco install ninja
# - export PATH="/c/Python3:/c/ProgramData/chocolatey/lib/ninja/tools:$PATH"
# - /c/Python3/Scripts/pip install numpy matplotlib scipy lxml
# - eval "$(python vcvars_proxy.py
# 'c:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/Common7/Tools/VsDevCmd.bat'
# '-arch=amd64'
# '-host_arch=amd64'
# '-vcvars_ver=14.0')"
# - export CC=cl.exe
# - export CXX=cl.exe
# - export CC_FOR_BUILD=cl.exe
# - export CXX_FOR_BUILD=cl.exe
# env:
# - OTB_OS=Win64
# - OTB_PKG_EXT=zip

install:
- export OTB_PKG="OTB-${OTB_VER}-${OTB_OS}.${OTB_PKG_EXT}"
- wget ${OTB_URL}/${OTB_PKG}
- if [ "$OTB_PKG_EXT" = "run" ]; then chmod +x ${OTB_PKG} ; ./${OTB_PKG} --target xdk ; fi
- if [ "$OTB_PKG_EXT" = "zip" ]; then 7z x -y ${OTB_PKG} ; mv OTB-${OTB_VER}-${OTB_OS} xdk ; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then
source xdk/otbenv.bash;
else
source xdk/otbenv.profile;
fi
# build_wrapping is needed if you use Python wrappers in your module
- ctest -S xdk/share/otb/swig/build_wrapping.cmake -VV
# NamespaceHandler is needed if you have target conflicts between OTB and your module
# - ctest -DNAMESPACE:STRING="OTB" -S xdk/lib/cmake/OTB-6.7/NamespaceHandler.cmake
# LFS install needed if you use OTB/Data
# - git lfs install

script:
- cd $TRAVIS_BUILD_DIR && unset PYTHONPATH;ctest -VV -S ./ci.cmake
90 changes: 14 additions & 76 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,81 +1,19 @@
PROJECT(lis)
if(NOT OTB_SOURCE_DIR)
cmake_minimum_required(VERSION 3.10.2)
project(LIS)
# Handle the compilation outside OTB source tree: find where OTB is built/installed
find_package(OTB REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${OTB_CMAKE_DIR})
include(UseOTB)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# The Python interpreter is needed for Python tests
set(Python_ADDITIONAL_VERSIONS "3")
find_package( PythonInterp REQUIRED)

# Find necessary packages
set(OTB_BUILD_MODULE_AS_STANDALONE "ON" CACHE BOOL "LIS (forced)" FORCE)

find_package(GDAL REQUIRED)
include(OTBModuleExternal)


if(NOT GDAL_FOUND)
message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY")
endif()

if (GDAL_CONFIG)
# extract gdal version
exec_program(${GDAL_CONFIG}
ARGS --version
OUTPUT_VARIABLE GDAL_VERSION )
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
# check for gdal version
if (GDAL_VERSION_MAJOR LESS 2)
message (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
endif ()
endif()

#Set python home (needed on the cnes hpc)
# FIXME Is it still needed on hal?
set(PYTHON_INCLUDE_DIRS $ENV{PYTHONHOME}/include)

find_package(PythonInterp REQUIRED)

find_package( PythonLibs 2.7 REQUIRED)
include_directories( ${PYTHON_INCLUDE_DIRS} )

# Link to the Orfeo ToolBox
# LIS required OTB 6.0
SET(OTB_MIN_VERSION "6.0.0")

find_package(OTB ${OTB_MIN_VERSION} REQUIRED)
if(OTB_FOUND)
include(${OTB_USE_FILE})
else(OTB_FOUND)
message(FATAL_ERROR
"OTB not found. Please set OTB_DIR")
endif(OTB_FOUND)


# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for all ARCHIVE products (static libs, import libs)")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for all LIBRARY products (so, modules)")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for all RUNTIME products (executables, dlls)")

# Install dirs
if(NOT lis_INSTALL_BIN_DIR)
set(lis_INSTALL_BIN_DIR "bin")
endif(NOT lis_INSTALL_BIN_DIR)

if(NOT lis_INSTALL_LIB_DIR)
set(lis_INSTALL_LIB_DIR "lib")
endif(NOT lis_INSTALL_LIB_DIR)

if(NOT lis_INSTALL_INCLUDE_DIR)
set(lis_INSTALL_INCLUDE_DIR "include")
endif(NOT lis_INSTALL_INCLUDE_DIR)

set(BUILD_SHARED_LIBS ON)

include_directories(src)

add_subdirectory(src)
add_subdirectory(python)
add_subdirectory(app)
# Add Testing subdirectory
option(BUILD_TESTING "Build testing." OFF)

if(BUILD_TESTING)
ENABLE_TESTING()
INCLUDE(Dart)
add_subdirectory(test)
else()
otb_module_impl()
endif()
27 changes: 27 additions & 0 deletions LIS.remote.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Copyright (C) 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.
#

otb_fetch_module(LIS
"This code implements the snow cover extent detection algorithm LIS (Let It Snow)
for Sentinel-2, Landsat-8 and SPOT4-Take5 data."

GIT_REPOSITORY https://github.com/orfeotoolbox/let-it-snow
GIT_TAG 30-remote-module
)
33 changes: 24 additions & 9 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/run_snow_detector.py DESTINATION ${CMAKE_BINARY_DIR}/app)
file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/run_cloud_removal.py DESTINATION ${CMAKE_BINARY_DIR}/app)
file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/run_snow_annual_map.py DESTINATION ${CMAKE_BINARY_DIR}/app)
file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/build_json.py DESTINATION ${CMAKE_BINARY_DIR}/app)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/run_snow_detector.py DESTINATION ${CMAKE_INSTALL_PREFIX}/app)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/run_snow_annual_map.py DESTINATION ${CMAKE_INSTALL_PREFIX}/app)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/run_cloud_removal.py DESTINATION ${CMAKE_INSTALL_PREFIX}/app)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/build_json.py DESTINATION ${CMAKE_INSTALL_PREFIX}/app)
OTB_CREATE_APPLICATION(NAME ComputeCloudMask
SOURCES otbComputeCloudMask.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES}
)

OTB_CREATE_APPLICATION(NAME ComputeSnowMask
SOURCES otbComputeSnowMask.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES}
)

OTB_CREATE_APPLICATION(NAME ComputeContours
SOURCES otbComputeContours.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES}
)

OTB_CREATE_APPLICATION(NAME ComputeSnowLine
SOURCES otbComputeSnowLine.cxx ../src/histo_utils.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES}
)

OTB_CREATE_APPLICATION(NAME ComputeNbPixels
SOURCES otbComputeNbPixels.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES}
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/ComputeSnowLine.cxx → app/otbComputeSnowLine.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class ComputeSnowLine : public Application

InputImageType * inDEMImage = GetParameterImage<InputImageType>("dem");




// Instantiating object (compute min/max from dem image)
m_Filter = StreamingMinMaxImageFilterType::New();

Expand Down Expand Up @@ -139,6 +142,8 @@ class ComputeSnowLine : public Application

StreamingMinMaxImageFilterType::Pointer m_Filter;
ComposeImageFilterType::Pointer m_ComposeFilter;


};

}
Expand Down
4 changes: 4 additions & 0 deletions src/ComputeSnowMask.cxx → app/otbComputeSnowMask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "itkNarySnowMaskImageFilter.h"
#include "otbImage.h"
#include "histo_utils.h"

namespace otb
{
Expand Down Expand Up @@ -105,6 +106,9 @@ class ComputeSnowMask : public Application
m_SnowMaskFilter->SetInput(3, img_cloud_refine);
m_SnowMaskFilter->SetInput(4, img_all_cloud);




if(IsParameterEnabled("slopeflag")){
InputImageType::Pointer img_slope_flag = GetParameterImage<InputImageType>("slopeflag");
m_SnowMaskFilter->SetInput(5, img_slope_flag);
Expand Down
Loading