Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bnarayanarao/isce2
  • sshah/isce2
2 results
Show changes
Commits on Source (8)
Showing with 2095 additions and 0 deletions
version: 2.1
jobs:
test-cmake:
docker:
- image: ubuntu:20.04
steps:
- checkout:
path: /root/project/src
- run:
name: Install ISCE requirements
command: |
set -ex
pwd
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y cmake cython3 git libfftw3-dev libgdal-dev libhdf4-alt-dev libhdf5-dev libopencv-dev python3-gdal python3-h5py python3-numpy python3-scipy
- run:
name: Build and Install ISCE
command: |
set -ex
cd /root/project/src
mkdir build
cd build
MODPATH=$(python3 -c "import site; print(site.getsitepackages()[-1])")
cmake .. -DCMAKE_INSTALL_PREFIX=install -DPYTHON_MODULE_DIR=$MODPATH
make install VERBOSE=y
- run:
name: Test ISCE installation
command: |
set -ex
cd /root/project/src/build
ctest --output-on-failure
ISCE2DIR=$(python3 -c "import os, isce2; print(os.path.dirname(isce2.__file__))" | tail -n 1)
export PATH=$ISCE2DIR/applications:$PATH
topsApp.py --help --steps
stripmapApp.py --help --steps
python3 -c "import isce"
# Create dummy ref/secondary configs for topsApp
ln -s ../examples/input_files/reference_TOPS_SENTINEL1.xml reference.xml
ln -s reference.xml secondary.xml
topsApp.py --steps --end=preprocess ../examples/input_files/topsApp.xml
test:
docker:
- image: ubuntu:20.04
steps:
- checkout:
path: /root/project/src
- run:
name: Install ISCE requirements
command: |
set -ex
pwd
mkdir config build install
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y scons cython3 git libfftw3-dev libgdal-dev libhdf4-alt-dev libhdf5-dev libmotif-dev libopencv-dev libx11-dev python3-gdal python3-h5py python3-numpy python3-scipy
- run:
name: Build SConfigISCE and setup dirs
command: |
set -ex
pwd
cd config
echo "PRJ_SCONS_BUILD = /root/project/build" > SConfigISCE
echo "PRJ_SCONS_INSTALL = /root/project/install/isce" >> SConfigISCE
echo "LIBPATH = /usr/lib64 /usr/lib /usr/lib/x86_64-linux-gnu" >> SConfigISCE
python_inc="/usr/include/python3.8 /usr/lib/python3/dist-packages/numpy/core/include"
echo "CPPPATH = $python_inc /usr/include /usr/include/gdal /usr/include/opencv4" >> SConfigISCE
echo "FORTRANPATH = /usr/include" >> SConfigISCE
echo "FORTRAN = /bin/gfortran" >> SConfigISCE
echo "CC = /bin/gcc" >> SConfigISCE
echo "CXX = /bin/g++" >> SConfigISCE
echo "MOTIFLIBPATH = /usr/lib64" >> SConfigISCE
echo "X11LIBPATH = /usr/lib64" >> SConfigISCE
echo "MOTIFINCPATH = /usr/include" >> SConfigISCE
echo "X11INCPATH = /usr/include" >> SConfigISCE
echo "RPATH = /usr/lib64 /usr/lib" >> SConfigISCE
cat SConfigISCE
- run:
name: Build and Install ISCE
command: |
set -ex
pwd
cd src
SCONS_CONFIG_DIR=/root/project/config scons install --skipcheck
- run:
name: Test ISCE installation
command: |
set -ex
pwd
ISCE_HOME=/root/project/install/isce
export PATH="$ISCE_HOME/bin:$ISCE_HOME/applications:$PATH"
export PYTHONPATH="/root/project/install:$PYTHONPATH"
topsApp.py --help --steps
stripmapApp.py --help --steps
python3 -c "import isce"
python3 -c "import isce; from isceobj.Sensor import SENSORS as s; [s[k]() for k in s]"
build:
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- run:
name: Install dependencies
command: |
apk add --no-cache \
python3-dev py3-pip bash pigz build-base libffi-dev openssl-dev \
docker-compose aws-cli
- run:
name: Build docker image
command: |
mkdir images
SHA1=$(echo $CIRCLE_SHA1 | cut -c1-7)
echo "export TAG=$SHA1" >> images/env.sh
source images/env.sh
docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile .
cd images
docker save isce/isce2:$TAG > isce2.tar
- persist_to_workspace:
root: images
paths:
- "*"
build-release:
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- run:
name: Install dependencies
command: |
apk add --no-cache \
python3-dev py3-pip bash pigz build-base libffi-dev openssl-dev \
docker-compose aws-cli
- run:
name: Build docker image
command: |
mkdir images
echo "export TAG=$CIRCLE_TAG" >> images/env.sh
source images/env.sh
docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile .
cd images
docker save isce/isce2:$TAG > isce2.tar
- persist_to_workspace:
root: images
paths:
- "*"
build-periodically:
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- run:
name: Install dependencies
command: |
apk add --no-cache \
python3-dev py3-pip bash pigz build-base libffi-dev openssl-dev \
docker-compose aws-cli
- run:
name: Build docker image
command: |
mkdir images
echo 'export TAG=$(date -u +%Y%m%d)' >> images/env.sh
source images/env.sh
docker build --rm --force-rm -t isce/isce2:$TAG -f docker/Dockerfile .
cd images
docker save isce/isce2:$TAG > isce2.tar
- persist_to_workspace:
root: images
paths:
- "*"
deploy:
docker:
- image: docker:stable-git
steps:
- setup_remote_docker
- run:
name: Install dependencies
command: |
apk add --no-cache \
curl file
- attach_workspace:
at: images
- run:
name: Deploy
command: |
cd images
source env.sh
docker load -i isce2.tar
docker tag isce/isce2:$TAG isce/isce2:latest
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push isce/isce2:$TAG
docker push isce/isce2:latest
workflows:
version: 2
test:
jobs:
- test
- test-cmake
- build
build-deploy:
jobs:
- build:
filters:
branches:
only: main
- deploy:
requires:
- build
filters:
branches:
only: main
build-deploy-release:
jobs:
- build-release:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- deploy:
requires:
- build-release
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
weekly:
triggers:
- schedule:
cron: "0 7 * * 0"
filters:
branches:
only:
- main
jobs:
- build-periodically:
filters:
branches:
only: main
- deploy:
requires:
- build-periodically
filters:
branches:
only: main
# Tries to run Cython using `python -m cython`
execute_process(COMMAND ${Python_EXECUTABLE} -m cython --help
RESULT_VARIABLE cython_status
ERROR_QUIET OUTPUT_QUIET)
if(NOT cython_status)
set(CYTHON_EXECUTABLE ${Python_EXECUTABLE} -m cython CACHE STRING
"Cython executable")
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cython REQUIRED_VARS CYTHON_EXECUTABLE)
mark_as_advanced(CYTHON_EXECUTABLE)
#[[
Usage:
find_package(FFTW [REQUIRED] [QUIET] [COMPONENTS ...])
Be warned that this will only search for FFTW3 libraries.
It sets the following variables:
FFTW_FOUND .. true if FFTW is found on the system
FFTW_[component]_LIB_FOUND .. true if the component is found (see below)
FFTW_LIBRARIES .. full paths to all found FFTW libraries
FFTW_[component]_LIB .. full path to one component (see below)
FFTW_INCLUDE_DIRS .. FFTW include directory paths
The following variables will be checked by the function
FFTW_USE_STATIC_LIBS .. if true, only static libraries are searched
FFTW_ROOT .. if set, search under this path first
Paths will be searched in the following order:
FFTW_ROOT (if provided)
PkgConfig paths (if found)
Library/include installation directories
Default find_* paths
The following component library locations will be defined (if found):
FFTW_FLOAT_LIB
FFTW_DOUBLE_LIB
FFTW_LONGDOUBLE_LIB
FFTW_FLOAT_THREADS_LIB
FFTW_DOUBLE_THREADS_LIB
FFTW_LONGDOUBLE_THREADS_LIB
FFTW_FLOAT_OMP_LIB
FFTW_DOUBLE_OMP_LIB
FFTW_LONGDOUBLE_OMP_LIB
The following IMPORTED targets will be created (if found):
FFTW::Float
FFTW::Double
FFTW::LongDouble
FFTW::FloatThreads
FFTW::DoubleThreads
FFTW::LongDoubleThreads
FFTW::FloatOMP
FFTW::DoubleOMP
FFTW::LongDoubleOMP
]]
include(FindPackageHandleStandardArgs)
if(NOT FFTW_ROOT AND DEFINED ENV{FFTWDIR})
set(FFTW_ROOT $ENV{FFTWDIR})
endif()
# Check if we can use PkgConfig
find_package(PkgConfig)
# Determine from PKG
if(PKG_CONFIG_FOUND)
pkg_check_modules(PKG_FFTW QUIET fftw3)
endif()
# Check whether to search static or dynamic libs
set(CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(${FFTW_USE_STATIC_LIBS})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV})
endif()
# Paths to pass to find_library for each component
set(findlib_paths
${FFTW_ROOT}
${PKG_FFTW_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
)
# Find include directory
find_path(FFTW_INCLUDE_DIRS
NAMES fftw3.h
PATHS ${FFTW_ROOT}
${PKG_FFTW_INCLUDE_DIRS}
${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES include
)
set(FFTW_LIBRARIES "")
foreach(dtype Float Double LongDouble)
# Single-letter suffix for the library name
string(REGEX REPLACE "(.).*" "\\1" letter ${dtype})
string(TOLOWER ${letter} letter)
# The double-precision library doesn't use a suffix
if("${letter}" STREQUAL "d")
set(letter "")
endif()
foreach(system "" Threads OMP)
# CamelCase component name used for interface libraries
# e.g. FloatThreads
set(component ${dtype}${system})
# Component library location variable used via find_library
# e.g. FFTW_DOUBLE_THREADS_LIB
if(system)
set(libvar FFTW_${dtype}_${system}_LIB)
else()
set(libvar FFTW_${dtype}_LIB)
endif()
string(TOUPPER ${libvar} libvar)
# Filename root common to all libraries
set(libname fftw3${letter})
if(system)
string(TOLOWER ${system} systemlower)
set(libname ${libname}_${systemlower})
endif()
# Actual filenames looked for by find_library
set(libnames
${libname}
lib${libname}3-3
)
find_library(
${libvar}
NAMES ${libnames}
PATHS ${findlib_paths}
PATH_SUFFIXES lib lib64
)
# Tell find_package whether this component was found
set(FFTW_${component}_FIND_QUIETLY TRUE)
# Also set the value of the legacy library-variable
# (Will be set to *-NOTFOUND if not found)
set(${libvar} ${FFTW_${component}})
# If the library was found:
if(${libvar} AND NOT TARGET FFTW::${component})
# Add it to the list of FFTW libraries
list(APPEND FFTW_LIBRARIES ${${libvar}})
# Create a corresponding interface library
add_library(FFTW::${component} IMPORTED INTERFACE)
target_include_directories(
FFTW::${component} SYSTEM INTERFACE ${FFTW_INCLUDE_DIRS})
target_link_libraries(
FFTW::${component} INTERFACE ${${libvar}})
endif()
mark_as_advanced(${libvar})
endforeach()
endforeach()
# Restore saved find_library suffixes
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV})
find_package_handle_standard_args(FFTW
REQUIRED_VARS FFTW_LIBRARIES FFTW_INCLUDE_DIRS
HANDLE_COMPONENTS
)
mark_as_advanced(
FFTW_INCLUDE_DIRS
FFTW_LIBRARIES
)
find_package(GDAL)
# Make a compatibility GDAL::GDAL interface target
# In CMake >= 3.14, this already exists for us :)
if(GDAL_FOUND AND NOT TARGET GDAL::GDAL)
add_library(GDAL::GDAL IMPORTED INTERFACE)
target_include_directories(GDAL::GDAL SYSTEM INTERFACE ${GDAL_INCLUDE_DIRS})
target_link_libraries(GDAL::GDAL INTERFACE ${GDAL_LIBRARIES})
endif()
find_package(Motif)
if(MOTIF_FOUND AND NOT TARGET Motif::Motif)
add_library(Motif::Motif IMPORTED INTERFACE)
target_include_directories(Motif::Motif
SYSTEM INTERFACE ${MOTIF_INCLUDE_DIR})
target_link_libraries(Motif::Motif
INTERFACE ${MOTIF_LIBRARIES})
endif()
set(components
Xau
Xt
)
find_package(X11 COMPONENTS ${components})
if(X11_FOUND)
# make X11 look like a regular find_package component
set(X11_X11_FOUND TRUE)
set(X11_X11_INCLUDE_PATH ${X11_INCLUDE_DIR})
list(APPEND components X11)
foreach(component ${components})
if(X11_${component}_FOUND AND
NOT TARGET X11::${component})
add_library(X11::${component} IMPORTED INTERFACE)
target_link_libraries(X11::${component}
INTERFACE ${X11_${component}_LIB})
target_include_directories(X11::${component} SYSTEM
INTERFACE ${X11_${component}_INCLUDE_PATH})
endif()
endforeach()
endif()
# Define a function to create Cython modules.
#
# For more information on the Cython project, see http://cython.org/.
# "Cython is a language that makes writing C extensions for the Python language
# as easy as Python itself."
#
# This file defines a CMake function to build a Cython Python module.
# To use it, first include this file.
#
# include(UseCython)
#
# Then call cython_add_module to create a module.
#
# cython_add_module(<module_name> <src1> <src2> ... <srcN>)
#
# Where <module_name> is the name of the resulting Python module and
# <src1> <src2> ... are source files to be compiled into the module, e.g. *.pyx,
# *.py, *.cxx, etc. A CMake target is created with name <module_name>. This can
# be used for target_link_libraries(), etc.
#
# The sample paths set with the CMake include_directories() command will be used
# for include directories to search for *.pxd when running the Cython complire.
#
# Cache variables that effect the behavior include:
#
# CYTHON_ANNOTATE
# CYTHON_NO_DOCSTRINGS
# CYTHON_FLAGS
#
# See also FindCython.cmake
#=============================================================================
# Copyright 2011 Kitware, Inc.
#
# 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.
#=============================================================================
# Configuration options.
set( CYTHON_ANNOTATE OFF
CACHE BOOL "Create an annotated .html file when compiling *.pyx." )
set( CYTHON_NO_DOCSTRINGS OFF
CACHE BOOL "Strip docstrings from the compiled module." )
set( CYTHON_FLAGS "" CACHE STRING
"Extra flags to the cython compiler." )
mark_as_advanced( CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS )
find_package(Cython REQUIRED)
find_package(Python REQUIRED COMPONENTS Development)
# Check the version of Cython
execute_process( COMMAND ${CYTHON_EXECUTABLE} --version
OUTPUT_VARIABLE CYTHON_VERSION ERROR_VARIABLE CYTHON_VERSION )
string(REGEX MATCH "([0-9]|\\.)+" CYTHON_VERSION ${CYTHON_VERSION})
if((CYTHON_VERSION VERSION_GREATER_EQUAL 0.28.1))
message(STATUS "Found Cython: ${CYTHON_VERSION}")
else()
message(FATAL_ERROR "Could not find Cython version >= 0.28.1")
endif()
# Create a *.cxx file from a *.pyx file.
# Input the generated file basename. The generate file will put into the variable
# placed in the "generated_file" argument. Finally all the *.py and *.pyx files.
function( compile_pyx _name generated_file )
set( pyx_locations "" )
foreach( pyx_file ${ARGN} )
# Get the include directories.
get_source_file_property( pyx_location ${pyx_file} LOCATION )
get_filename_component( pyx_path ${pyx_location} PATH )
list( APPEND pyx_locations "${pyx_location}" )
endforeach() # pyx_file
# Set additional flags.
set(cython_args "")
if( CYTHON_ANNOTATE )
list(APPEND cython_args "--annotate" )
endif()
if( CYTHON_NO_DOCSTRINGS )
list(APPEND cython_args "--no-docstrings")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
set(APPEND cython_args "--gdb")
endif()
list(APPEND cython_args "-${Python_VERSION_MAJOR}")
# Determining generated file name.
set(_generated_file ${CMAKE_CURRENT_BINARY_DIR}/${_name}.cxx)
set_source_files_properties( ${_generated_file} PROPERTIES GENERATED TRUE )
set( ${generated_file} ${_generated_file} PARENT_SCOPE )
# Add the command to run the compiler.
add_custom_command( OUTPUT ${_generated_file}
COMMAND ${CYTHON_EXECUTABLE}
ARGS --cplus ${cython_args} ${CYTHON_FLAGS}
--output-file ${_generated_file} ${pyx_locations}
DEPENDS ${pyx_locations}
IMPLICIT_DEPENDS CXX
COMMENT "Compiling Cython CXX source for ${_name}..."
)
endfunction()
# cython_add_module( <name> src1 src2 ... srcN )
# Build the Cython Python module.
function( cython_add_module _name )
set( pyx_module_sources "" )
set( other_module_sources "" )
foreach( _file ${ARGN} )
if( ${_file} MATCHES ".*\\.py[x]?$" )
list( APPEND pyx_module_sources ${_file} )
else()
list( APPEND other_module_sources ${_file} )
endif()
endforeach()
set( CYTHON_FLAGS ${CYTHON_FLAGS} -X embedsignature=True)
compile_pyx( ${_name} generated_file ${pyx_module_sources} )
Python_add_library( ${_name} MODULE ${generated_file} ${other_module_sources} )
if( APPLE )
set_target_properties( ${_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
endif()
# ignore overflow warnings caused by Python's implicit conversions
set_property( SOURCE ${generated_file}
PROPERTY COMPILE_OPTIONS -Wno-overflow APPEND )
# ignore Numpy deprecated API warning
# ignore warnings for using the #warning extension directive
# TODO fix -Wno-cpp for nvcc
# target_compile_options( ${_name} PRIVATE -Wno-cpp -Wno-pedantic)
endfunction()
# TODO (global build flags)
# These definitions and compile options are
# set globally for convenience.
# Perhaps we should apply them only as needed on a
# per-target basis, and propagate them via the interface?
add_definitions(-DNEEDS_F77_TRANSLATION -DF77EXTERNS_LOWERCASE_TRAILINGBAR)
add_compile_options(
$<$<COMPILE_LANGUAGE:Fortran>:-ffixed-line-length-none>
$<$<COMPILE_LANGUAGE:Fortran>:-ffree-line-length-none>
$<$<COMPILE_LANGUAGE:Fortran>:-fno-range-check>
$<$<COMPILE_LANGUAGE:Fortran>:-fno-second-underscore>)
# Set up build flags for C++ and Fortran.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED y)
set(CMAKE_CXX_EXTENSIONS n)
include(GNUInstallDirs)
# add automatically determined parts of the RPATH, which point to directories
# outside of the build tree, to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
# the RPATH to be used when installing, but only if it's not a system directory
set(abs_libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${abs_libdir} isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
list(APPEND CMAKE_INSTALL_RPATH ${abs_libdir})
endif()
option(ISCE2_STRICT_COMPILATION "Enable strict checks during compilation" ON)
if(ISCE2_STRICT_COMPILATION)
# Set -fno-common when supported to catch ODR violations
include(CheckCCompilerFlag)
check_c_compiler_flag(-fno-common C_FNO_COMMON)
if(C_FNO_COMMON)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-fno-common>)
endif()
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-fno-common CXX_FNO_COMMON)
if(CXX_FNO_COMMON)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-common>)
endif()
endif()
# There are a lot of similarly-built modules in isce2
# so we add some helpers here to avoid code duplication.
# TODO maybe these helpers should have a unique prefix, e.g. "isce2_"
# Compute a prefix based on the current project subdir
# This disambiguates tests with similar names and
# allows better pattern matching using `ctest -R`
macro(isce2_get_dir_prefix)
file(RELATIVE_PATH dir_prefix ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR})
string(REPLACE "/" "." dir_prefix ${dir_prefix})
endmacro()
# Usage: isce2_add_staticlib(name [sources ...])
# Creates a SCons-like isce2 intermediate library.
# The actual target will also be available via the namespaced isce2:: alias.
macro(isce2_add_staticlib name)
add_library(${name} STATIC ${ARGN})
set_target_properties(${name} PROPERTIES
OUTPUT_NAME ${name}
POSITION_INDEPENDENT_CODE ON
)
# add alias matching exported target
add_library(isce2::${name} ALIAS ${name})
endmacro()
# Usage: isce2_add_cdll(libname [sources ...])
# These libraries are loaded using a hardcoded filename, so this
# macro simplifies adding target properties to make that possible.
macro(isce2_add_cdll target)
add_library(${target} SHARED ${ARGN})
set_target_properties(${target} PROPERTIES
PREFIX ""
OUTPUT_NAME ${target}
SUFFIX .so)
# If we're the root cmake project (e.g. not add_subdirectory):
if("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
# override this to also test the resulting extension
add_test(NAME load_cdll_${target}
COMMAND ${Python_EXECUTABLE} -c
"from ctypes import cdll; \
cdll.LoadLibrary('$<TARGET_FILE:${target}>')"
)
endif()
endmacro()
# Usage:
# add_exe_test(main.cpp helpers.F [additional_source.c ...] )
# or
# add_exe_test(target_from_add_executable)
# The latter form is useful when you need to add dependencies,
# since the former mangles the name via dir_prefix.
function(add_exe_test testfile)
isce2_get_dir_prefix()
if(TARGET ${testfile})
set(target ${testfile})
set(testname ${dir_prefix}.${testfile})
else()
set(target ${dir_prefix}.${testfile})
add_executable(${target} ${testfile} ${ARGN})
set(testname ${target})
endif()
add_test(NAME ${testname} COMMAND ${target})
endfunction()
# Usage:
# add_python_test(mytest.py)
# This is simpler than add_exe_test since there is no compilation step.
# The python file is esecuted directly, using the exit status as the result.
function(add_python_test testfile)
isce2_get_dir_prefix()
set(testname ${dir_prefix}.${testfile})
add_test(NAME ${testname} COMMAND
${Python_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/${testfile})
set_tests_properties(${testname} PROPERTIES
ENVIRONMENT PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_DIR})
endfunction()
# Computes the relative path from the current binary dir to the base binary
# dir, and installs the given files/targets using this relative path with
# respect to the python package dir.
# This greatly simplifies installation since the source dir structure
# primarily mimics the python package directory structure.
# Note that it first checks if a provided file is a target,
# and if so, installs it as a TARGET instead. Make sure your
# filenames and target names don't have any overlap!
function(InstallSameDir)
foreach(name ${ARGN})
if(TARGET ${name})
set(installtype TARGETS)
else()
set(installtype FILES)
endif()
file(RELATIVE_PATH path ${isce2_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
install(${installtype} ${name}
DESTINATION ${ISCE2_PKG}/${path}
)
endforeach()
endfunction()
*.pyc
*~
*.swp
*.DS_Store
__pycache__
.sconf_temp
.sconsign.dblite
config.log
insar.log
isce.log
.ipynb_checkpoints
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
# Build a Docker image with CI/CD and push to the GitLab registry.
# Docker-in-Docker documentation: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
#
# This template uses one generic job with conditional builds
# for the default branch and all other (MR) branches.
docker-build:
# Use the official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug)
script:
- tag="$CI_COMMIT_SHA"
- docker build --pull -t "${CI_REGISTRY_IMAGE}:${tag}" -f infiles_dps/dockerfile .
- docker push "${CI_REGISTRY_IMAGE}:${tag}"
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
exists:
- infiles_dps/dockerfile
tags:
- shell
cmake_minimum_required(VERSION 3.13...3.18)
project(isce2 LANGUAGES C CXX Fortran)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake)
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
enable_language(CUDA)
find_package(CUDAToolkit) # TODO added in cmake 3.17 - copy this module
endif()
find_package(Python 3.5 REQUIRED COMPONENTS Interpreter Development
OPTIONAL_COMPONENTS NumPy)
find_package(FFTW REQUIRED)
find_package(Motif)
find_package(OpenMP REQUIRED COMPONENTS C CXX Fortran)
find_package(OpenCV COMPONENTS core highgui imgproc)
find_package(pybind11 CONFIG)
# Find these, and create IMPORTED INTERFACE libraries for them if they exist
include(TargetGDAL)
include(TargetMotif)
include(TargetX11)
include(UseCython)
# If we're the root cmake project (e.g. not add_subdirectory):
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
# override this to also test the resulting extension
function(Python_add_library target)
_Python_add_library(${target} ${ARGN})
set(name "$<TARGET_PROPERTY:${target},OUTPUT_NAME>")
add_test(NAME import_${target}
COMMAND ${Python_EXECUTABLE} -c
"import $<IF:$<BOOL:${name}>,${name},${target}>"
)
endfunction()
endif()
if(NOT DEFINED PYTHON_MODULE_DIR)
set(PYTHON_MODULE_DIR packages CACHE PATH "Python module directory")
endif()
if(NOT DEFINED ISCE2_PKG)
set(ISCE2_PKG ${PYTHON_MODULE_DIR}/isce2 CACHE PATH
"ISCE 2 python package install dir")
endif()
if(IS_ABSOLUTE "${ISCE2_PKG}")
set(ISCE2_PKG_FULL "${ISCE2_PKG}")
else()
set(ISCE2_PKG_FULL "${CMAKE_INSTALL_PREFIX}/${ISCE2_PKG}")
endif()
include(isce2_buildflags)
include(isce2_helpers)
enable_testing()
add_subdirectory(applications)
add_subdirectory(components)
add_subdirectory(contrib components/contrib)
add_subdirectory(defaults)
add_subdirectory(library)
add_subdirectory(test)
InstallSameDir(
__init__.py
release_history.py
)
file(READ license.py LICENSE_TXT)
string(FIND "${LICENSE_TXT}" "stanford_license = None" match)
if(${match} EQUAL -1)
set(ISCE2_HAVE_LICENSE YES)
else()
set(ISCE2_HAVE_LICENSE NO)
endif()
option(ISCE2_WITH_STANFORD "Build Stanford components" ${ISCE2_HAVE_LICENSE})
if(ISCE2_WITH_STANFORD)
InstallSameDir(license.py)
message(STATUS "ISCE2's Stanford-licensed components will be built.")
else()
message(STATUS "ISCE2's Stanford-licensed components will NOT be built.")
endif()
# We also need to create an empty directory for help
install(DIRECTORY DESTINATION ${ISCE2_PKG}/helper)
# CMake will install a python package named "isce2",
# but legacy scripts import it as simply "isce".
# Make a symlink isce -> isce2 for compatibility.
set(symsrc isce2)
if(IS_ABSOLUTE "${PYTHON_MODULE_DIR}")
set(symdest "${PYTHON_MODULE_DIR}/isce")
else()
set(symdest "${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_DIR}/isce")
endif()
install(CODE "execute_process(COMMAND
${CMAKE_COMMAND} -E create_symlink ${symsrc} ${symdest})")
# Enable native packaging using CPack
if(NOT CPACK_PACKAGE_CONTACT)
set(CPACK_PACKAGE_CONTACT "Ryan Burns <rtburns@jpl.nasa.gov>")
endif()
include(CPack)
# Contributing Guidelines
This document is inspired by similar instructions document in the GDAL and pygmt repositories.
These are some of the many ways to contribute to the ISCE project:
* Submitting bug reports and feature requests
* Writing tutorials or jupyter-notebooks
* Fixing typos, code and improving documentation
* Writing code for everyone to use
If you get stuck at any point you can create an issue on GitHub (look for the *Issues*
tab in the repository) or contact us on the [user forum](http://earthdef.caltech.edu/projects/isce_forum/boards).
For more information on contributing to open source projects,
[GitHub's own guide](https://guides.github.com/activities/contributing-to-open-source/)
is a great starting point if you are new to version control.
## Ground Rules
We realize that we don't have a Continuous Integration (CI) system in place yet (maybe you could start by contributing this). So, please be patient if Pull Requests result in some detailed discussions.
## Git workflows with ISCE
This is not a git tutorial or reference manual by any means. This just collects a few best practice for git usage for ISCE development. There are plenty of good resources on YouTube and online to help get started.
### Commit message
Indicate a component name, a short description and when relevant, a reference to a issue (with 'fixes #' if it actually fixes it)
```
COMPONENT_NAME: fix bla bla (fixes #1234)
Details here...
```
### Initiate your work repository
Fork isce-framework/isce from github UI, and then
```
git clone https://github.com/isce_framework/isce2
cd isce2
git remote add my_user_name https://github.com/my_user_name/isce2.git
```
### Updating your local main branch against upstream
```
git checkout main
git fetch origin
# Be careful: this will lose all local changes you might have done now
git reset --hard origin/main
```
### Working with a feature branch
```
git checkout main
(potentially update your local reference against upstream, as described above)
git checkout -b my_new_feature_branch
# do work. For example:
git add my_new_file
git add my_modifid_message
git rm old_file
git commit -a
# you may need to resynchronize against main if you need some bugfix
# or new capability that has been added to main since you created your
# branch
git fetch origin
git rebase origin/main
# At end of your work, make sure history is reasonable by folding non
# significant commits into a consistent set
git rebase -i main (use 'fixup' for example to merge several commits together,
and 'reword' to modify commit messages)
# or alternatively, in case there is a big number of commits and marking
# all them as 'fixup' is tedious
git fetch origin
git rebase origin/main
git reset --soft origin/main
git commit -a -m "Put here the synthetic commit message"
# push your branch
git push my_user_name my_new_feature_branch
From GitHub UI, issue a pull request
```
If the pull request discussion results in changes,
commit locally and push. To get a reasonable history, you may need to
```
git rebase -i main
```
, in which case you will have to force-push your branch with
```
git push -f my_user_name my_new_feature_branch
```
### Things you should NOT do
(For anyone with push rights to github.com/isce-framework/isce2) Never modify a commit or
the history of anything that has been
committed to https://github.com/isce-framework/isce2
Copyright 2008 California Institute of Technology. ALL RIGHTS RESERVED.
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.
United States Government Sponsorship acknowledged. This software is subject to
U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
(No [Export] License Required except when exporting to an embargoed country,
end user, or in support of a prohibited end use). By downloading this software,
the user agrees to comply with all applicable U.S. export laws and regulations.
The user has the responsibility to obtain export licenses, or other export
authority as may be required before exporting this software to any 'EAR99'
embargoed foreign country or citizen of those countries.
This diff is collapsed.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
#!/usr/bin/env python
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED.
#
# 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.
#
# United States Government Sponsorship acknowledged. This software is subject to
# U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
# (No [Export] License Required except when exporting to an embargoed country,
# end user, or in support of a prohibited end use). By downloading this software,
# the user agrees to comply with all applicable U.S. export laws and regulations.
# The user has the responsibility to obtain export licenses, or other export
# authority as may be required before exporting this software to any 'EAR99'
# embargoed foreign country or citizen of those countries.
#
# Author: Giangi Sacco
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import os
import sys
if sys.version_info[0] == 2:
print('Building with scons from python2')
else:
raw_input = input
print('Building with scons from python3')
if 'SCONS_CONFIG_DIR' in os.environ:
sconsConfigDir = os.environ['SCONS_CONFIG_DIR']
else:
print("Error. Need to set the variable SCONS_CONFIG_DIR in the shell environment")
raise Exception
from configuration import sconsConfigFile
#allow scons to take the input argument --setupfile=someOtherFile to allow change of the default SConfigISCE
AddOption('--setupfile',dest='setupfile',type='string',default='SConfigISCE')
AddOption('--isrerun',dest='isrerun',type='string',default='no')
AddOption('--skipcheck',dest='skipcheck', action='store_true', default=False)
env = Environment(ENV = os.environ)
sconsSetupFile = GetOption('setupfile')
isrerun = GetOption('isrerun')
skipcheck = GetOption('skipcheck')
sconsConfigFile.setupScons(env,sconsSetupFile)
#add some information that are necessary to build the framework such as specific includes, libpath and so on
buildDir = env['PRJ_SCONS_BUILD']
libPath = os.path.join(buildDir,'libs')
#this is the directory where all the built library are put so they can easily be found during linking
env['PRJ_LIB_DIR'] = libPath
# add the libPath to the LIBPATH environment that is where all the libs are serched
env.AppendUnique(LIBPATH = [libPath])
# add the modPath to the FORTRANMODDIR environment that is where all the fortran mods are searched
#not working yet
modPath = os.path.join(buildDir,'mods')
env['FORTRANMODDIR'] = modPath
env.AppendUnique(FORTRANPATH = [modPath])
env.AppendUnique(F90PATH = [modPath])
env.AppendUnique(F77PATH = [modPath])
#add the includes needed by the framework
imageApiInc = os.path.join(buildDir,'components/iscesys/ImageApi/include')
dataCasterInc = os.path.join(buildDir,'components/iscesys/ImageApi/DataCaster/include')
lineAccessorInc = os.path.join(buildDir,'components/isceobj/LineAccessor/include')
stdOEInc = os.path.join(buildDir,'components/iscesys/StdOE/include')
utilInc = os.path.join(buildDir,'components/isceobj/Util/include')
utilLibInc = os.path.join(buildDir,'components/isceobj/Util/Library/include')
env.AppendUnique(CPPPATH = [imageApiInc,dataCasterInc,lineAccessorInc,stdOEInc,utilInc,utilLibInc])
env['HELPER_DIR'] = os.path.join(env['PRJ_SCONS_INSTALL'],'helper')
env['HELPER_BUILD_DIR'] = os.path.join(env['PRJ_SCONS_BUILD'],'helper')
#put the pointer function createHelp in the environment so it can be access anywhere
from configuration.buildHelper import createHelp
env['HELP_BUILDER'] = createHelp
#Create an env variable to hold all the modules added to the sys.path by default.
#They are the same as the one in in __init__.py in the same directory of this file
moduleList = []
installDir = env['PRJ_SCONS_INSTALL']
moduleList.append(os.path.join(installDir,'applications'))
moduleList.append(os.path.join(installDir,'components'))
env['ISCEPATH'] = moduleList
env.PrependUnique(LIBS=['gdal'])
Export('env')
inst = env['PRJ_SCONS_INSTALL']
####new part
#####PSA. Check for header files and libraries up front
confinst = Configure(env)
hdrparams = [('python3 header', 'Python.h', 'Install python3-dev or add path to Python.h to CPPPATH'),
('fftw3', 'fftw3.h', 'Install fftw3 or libfftw3-dev or add path to fftw3.h to CPPPATH and FORTRANPATH'),
('hdf5', 'hdf5.h', 'Install HDF5 of libhdf5-dev or add path to hdf5.h to CPPPATH'),
('X11', 'X11/Xlib.h', 'Install X11 or libx11-dev or add path to X11 directory to X11INCPATH'),
('Xm', 'Xm/Xm.h', 'Install libXm or libXm-dev or add path to Xm directory to MOTIFINCPATH'),
('openmp', 'omp.h', 'Compiler not built with OpenMP. Use a different compiler or add path to omp.h to CPPPATH'),]
allflag = False
for (name,hname,msg) in hdrparams:
if not (confinst.CheckCHeader(hname) or confinst.CheckCXXHeader(hname)):
print('Could not find: {0} header for {1}'.format(hname, name))
print('Error: {0}'.format(msg))
allflag = True
libparams= [('libhdf5', 'hdf5', 'Install hdf5 or libhdf5-dev'),
('libfftw3f', 'fftw3f', 'Install fftw3 or libfftw3-dev'),
('libXm', 'Xm', 'Install Xm or libXm-dev'),
('libXt', 'Xt', 'Install Xt or libXt-dev')]
for (name,hname,msg) in libparams:
if not confinst.CheckLib(hname):
print('Could not find: {0} lib for {1}'.format(hname, name))
print('Error: {0}'.format(msg))
allflag = True
if env.FindFile('fftw3.f', env['FORTRANPATH']) is None:
print('Checking for F include fftw3 ... no')
print('Could not find: fftw3.f header for fftw3')
print('Error: Install fftw3 or libfftw3-dev or add path to FORTRANPATH')
allflag = True
else:
print('Checking for F include fftw3 ... yes'.format(name))
###This part added to handle GDAL and C++11
gdal_version = os.popen('gdal-config --version').read()
print('GDAL version: {0}'.format(gdal_version))
try:
gdal_majorversion = int(gdal_version.split('.')[0])
gdal_subversion = int(gdal_version.split('.')[1])
except:
raise Exception('gdal-config not found. GDAL does not appear to be installed ... cannot proceed. If you have installed gdal, ensure that you have path to gdal-config in your environment')
env['GDALISCXX11'] = None
if (gdal_majorversion > 2) or (gdal_subversion >= 3):
env['GDALISCXX11'] = 'True'
##Add C++11 for GDAL checks
#Save default environment if C++11
if env['GDALISCXX11']:
preCXX11 = confinst.env['CXXFLAGS']
confinst.env.Replace(CXXFLAGS=preCXX11 + ['-std=c++11'])
if not confinst.CheckCXXHeader('gdal_priv.h'):
print('Could not find: gdal_priv.h for gdal')
print('Install gdal or add path to gdal includes to CPPPATH')
allflag = True
if not confinst.CheckLib('gdal'):
print('Could not find: libgdal for gdal')
print('Install gdal or include path to libs to LIBPATH')
allflag = True
###If C++11, revert to original environment
if env['GDALISCXX11']:
confinst.env.Replace(CXXFLAGS=preCXX11)
###Decide whether to complain or continue
if (allflag and not skipcheck):
print('Not all components of ISCE will be installed and can result in errors.')
raw_input('Press Enter to continue.... Ctrl-C to exit')
elif (allflag and skipcheck):
print('Not all components of ISCE will be installed and can result in errors.')
print('User has requested to skip checks. Expect failures ... continuing')
else:
print('Scons appears to find everything needed for installation')
try:
# Older versions of scons do not have CheckProg, so 'try' to use it
if confinst.CheckProg('cython3'):
env['CYTHON3'] = True
else:
print('cython3 is not installed. Packages that depend on cython3 will not be installed.')
env['CYTHON3'] = False
except:
# If CheckProg is not available set env['CYTHON3'] = True and hope for the best
# If the cython3 link does not exist, then a later error should prompt the user to
# create the cython3 link to their cython installed as cython.
env['CYTHON3'] = True
pass
env = confinst.Finish()
###End of new part
### GPU branch-specific modifications
if 'ENABLE_CUDA' in env and env['ENABLE_CUDA'].upper() == 'TRUE':
print('User requested compilation with CUDA, if available')
try:
env.Tool('cuda', toolpath=['scons_tools'])
env['GPU_ACC_ENABLED'] = True
print("CUDA-relevant libraries and toolkit found. GPU acceleration may be enabled.")
except:
env['GPU_ACC_ENABLED'] = False
print("CUDA-relevant libraries or toolkit not found. GPU acceleration will be disabled.")
else:
print('User did not request CUDA support. Add ENABLE_CUDA = True to SConfigISCE to enable CUDA support')
env['GPU_ACC_ENABLED'] = False
### End of GPU branch-specific modifications
env.Install(inst, '__init__.py')
env.Install(inst, 'release_history.py')
if not os.path.exists(inst):
os.makedirs(inst)
v = 0
if isrerun == 'no':
cmd = 'scons -Q install --isrerun=yes'
if skipcheck:
cmd += ' --skipcheck'
v = os.system(cmd)
if v == 0:
env.Alias('install',inst)
applications = os.path.join('applications','SConscript')
SConscript(applications)
components = os.path.join('components','SConscript')
SConscript(components)
defaults = os.path.join('defaults','SConscript')
SConscript(defaults)
library = os.path.join('library','SConscript')
SConscript(library)
contrib = os.path.join('contrib','SConscript')
SConscript(contrib)
if 'test' in sys.argv:
#Run the unit tests
env['Test'] = True
else:
#Don't run tests.
#This option only installs test support package for future test runs.
env['Test'] = False
tests = os.path.join('test', 'SConscript')
SConscript(tests)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED.
#
# 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.
#
# United States Government Sponsorship acknowledged. This software is subject to
# U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
# (No [Export] License Required except when exporting to an embargoed country,
# end user, or in support of a prohibited end use). By downloading this software,
# the user agrees to comply with all applicable U.S. export laws and regulations.
# The user has the responsibility to obtain export licenses, or other export
# authority as may be required before exporting this software to any 'EAR99'
# embargoed foreign country or citizen of those countries.
#
# Author: Giangi Sacco
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from .release_history import release_version, release_svn_revision, release_date
svn_revision = release_svn_revision
version = release_history # compatibility alias
__version__ = release_version
import sys, os
isce_path = os.path.dirname(os.path.abspath(__file__))
import logging
from logging.config import fileConfig as _fc
_fc(os.path.join(isce_path, 'defaults', 'logging', 'logging.conf'))
sys.path.insert(1,isce_path)
sys.path.insert(1,os.path.join(isce_path,'applications'))
sys.path.insert(1,os.path.join(isce_path,'components'))
sys.path.insert(1,os.path.join(isce_path,'library'))
try:
os.environ['ISCE_HOME']
except KeyError:
print('Using default ISCE Path: %s'%(isce_path))
os.environ['ISCE_HOME'] = isce_path
try:
from . license import stanford_license
except:
pass
set(files
__init__.py
alos2App.py
alos2burstApp.py
dataTileManager.py
dem.py
demdb.py
downsampleDEM.py
fixImageXml.py
gdal2isce_xml.py
imageMath.py
insarApp.py
isce2geotiff.py
isce2gis.py
isceApp.py
iscehelp.py
looks.py
make_raw.py
mdx.py
rtcApp.py
stitcher.py
stripmapApp.py
topsApp.py
upsampleDem.py
waterMask.py
wbd.py
wbdStitcher.py
)
install(PROGRAMS ${files}
DESTINATION ${ISCE2_PKG}/applications)
# Symlink apps into PREFIX/bin so they are on the $PATH
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory \
${CMAKE_INSTALL_FULL_BINDIR})"
)
foreach(file ${files})
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \
${ISCE2_PKG_FULL}/applications/${file} \
${CMAKE_INSTALL_FULL_BINDIR}/${file})"
)
endforeach()
#!/usr/bin/env python3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED.
#
# 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.
#
# United States Government Sponsorship acknowledged. This software is subject to
# U.S. export control laws and regulations and has been classified as 'EAR99 NLR'
# (No [Export] License Required except when exporting to an embargoed country,
# end user, or in support of a prohibited end use). By downloading this software,
# the user agrees to comply with all applicable U.S. export laws and regulations.
# The user has the responsibility to obtain export licenses, or other export
# authority as may be required before exporting this software to any 'EAR99'
# embargoed foreign country or citizen of those countries.
#
# Author: Walter Szeliga
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import math
from isce import logging
from iscesys.Compatibility import Compatibility
Compatibility.checkPythonVersion()
from isceobj.Location.Peg import Peg
from iscesys.Component.FactoryInit import FactoryInit
class CalculatePegPoint(FactoryInit):
def calculatePegPoint(self):
self.logger.info("Parsing Raw Data")
self.sensorObj.parse()
frame = self.sensorObj.getFrame()
# First, get the orbit nadir location at mid-swath and the end of the scene
orbit = self.sensorObj.getFrame().getOrbit()
midxyz = orbit.interpolateOrbit(frame.getSensingMid())
endxyz = orbit.interpolateOrbit(frame.getSensingStop())
# Next, calculate the satellite heading from the mid-point to the end of the scene
ellipsoid = frame.getInstrument().getPlatform().getPlanet().get_elp()
midllh = ellipsoid.xyz_to_llh(midxyz.getPosition())
endllh = ellipsoid.xyz_to_llh(endxyz.getPosition())
heading = ellipsoid.geo_hdg(midllh,endllh)
# Then create a peg point from this data
peg = Peg(latitude=midllh[0],longitude=midllh[1],heading=heading,ellipsoid=ellipsoid)
self.logger.info("Peg Point:\n%s" % peg)
def __init__(self,arglist):
FactoryInit.__init__(self)
self.initFactory(arglist)
self.sensorObj = self.getComponent('Sensor')
self.logger = logging.getLogger('isce.calculatePegPoint')
if __name__ == "__main__":
import sys
if (len(sys.argv) < 2):
print("Usage:%s <xml-parameter file>" % sys.argv[0])
sys.exit(1)
runObj = CalculatePegPoint(sys.argv[1:])
runObj.calculatePegPoint()