diff --git a/Dockerfile b/Dockerfile index 006334f5c41b7233522722ff4e90a82b912d5e13..d5fd620a38a2a7934a30479b18dfa39de8c9ffc3 100755 --- a/Dockerfile +++ b/Dockerfile @@ -171,7 +171,7 @@ ARG GIT_TOKEN RUN if [ -f "/kaniko/run/secrets/http_proxy" ]; then export http_proxy=$(cat /kaniko/run/secrets/http_proxy); export https_proxy=$(cat /kaniko/run/secrets/https_proxy); fi && \ mkdir -p /install && \ cd /install && \ - git -c http.sslVerify=false clone --branch master https://${GIT_USER}:${GIT_TOKEN}@gitlab.cnes.fr/eolab/processing/rastertools.git && \ + git clone --branch 0.6.0 https://github.com/CNES/rastertools.git && \ export PYTHONWARNINGS="ignore:Unverified HTTPS request" && \ pip3 install \ --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org \ diff --git a/docker/README.md b/docker/README.md index 62105d12461e246bfbd9bdedfc92b4effba1f95e..b48409eaa520d7c0a477c5c8f49a558251d4ffd1 100755 --- a/docker/README.md +++ b/docker/README.md @@ -1,6 +1,6 @@ # How to use this Dockerfile -## Retrieve OTB 7 +## Retrieve OTB 8 OTB and its dependances can be retrieved at https://www.orfeo-toolbox.org/ We need : * otb.tar.gz @@ -15,4 +15,18 @@ LIS can be retrieve from this repository by git clone and compress into the Dock ## Run `docker run --rm -it lis` -or define an entrypoint \ No newline at end of file +or define an entrypoint; + +## Validation + +You can validate the docker image created with the tests available in the "docker/tests" folder. + +There is actually four tests : +- FSC snow coverage on l8 +- FSC snow coverage on S2 with classic hillshade method +- FSC snow coverage on S2 with rastertools +- Snow synthesis on one month + +To launch a test : `docker run -v ./docker/tests:/tests -v __input_data_folder__:/input-data -v __baseline_folder__:/baseline lis /tests/tests-<name_test>.sh /input-data /baseline` + +The input data folder and baseline folder must be the same folders used for LIS validation tests. \ No newline at end of file diff --git a/docker/tests/test-fsc-snow-l8.sh b/docker/tests/test-fsc-snow-l8.sh new file mode 100755 index 0000000000000000000000000000000000000000..edea06061cc67da1cb2fde8dc5772b65a5b875b3 --- /dev/null +++ b/docker/tests/test-fsc-snow-l8.sh @@ -0,0 +1,45 @@ +#!/bin/bash -u +# Usage: test-fsc-snow-l8.sh <data-test> <baseline> + +DATA_TEST=$1 +BASELINE=$2 + +test_name="l8" + +# Cleanup +rm -rf ${test_name} + +# Run test +let_it_snow_fsc.py \ + -c ${DATA_TEST}/Landsat/lis_configuration.json \ + -i ${DATA_TEST}/Landsat/LANDSAT8_OLITIRS_XS_20170308_N2A_France-MetropoleD0004H0001 \ + -d ${DATA_TEST}/Landsat/LANDSAT8_OLITIRS_XS_20170308_N2A_France-MetropoleD0004H0001/SRTM/dem.tif \ + -o ${test_name} + + +# Output comparison +errors=0 + +echo "-- Comparison pass1" +gdalcompare.py ${BASELINE}/l8_test/pass1.tif ${test_name}/tmp/snow_pass1.tif +errors=$((errors+$?)) + +echo "-- Comparison pass2" +gdalcompare.py ${BASELINE}/l8_test/pass2.tif ${test_name}/tmp/snow_pass2.tif +errors=$((errors+$?)) + +echo "-- Comparison pass3" +gdalcompare.py ${BASELINE}/l8_test/pass3.tif ${test_name}/tmp/snow_pass3.tif +errors=$((errors+$?)) + +echo "-- Comparison snow_all" +gdalcompare.py ${BASELINE}/l8_test/snow_all.tif ${test_name}/tmp/LIS_SNOW_ALL.TIF +errors=$((errors+$?)) + +echo "-- Comparison final_mask" +gdalcompare.py ${BASELINE}/l8_test/final_mask.tif ${test_name}/tmp/LIS_SEB.TIF +errors=$((errors+$?)) + +exit ${errors} + + diff --git a/docker/tests/test-fsc-snow-s2-hillshade.sh b/docker/tests/test-fsc-snow-s2-hillshade.sh new file mode 100755 index 0000000000000000000000000000000000000000..d75dfac64414510b02655b4d960114032205b53f --- /dev/null +++ b/docker/tests/test-fsc-snow-s2-hillshade.sh @@ -0,0 +1,31 @@ +#!/bin/bash -u +# Usage: test-fsc-snow-s2-hillshade.sh <data-test> <baseline> + +DATA_TEST=$1 +BASELINE=$2 + +test_name="shaded_snow_no_relief_shadow_mask" + +# Cleanup +rm -rf ${test_name} + +# Run test +let_it_snow_fsc.py \ + -c ${DATA_TEST}/S2/shaded_snow/global_parameters_shaded_snow.json \ + -i ${DATA_TEST}/S2/SENTINEL2B_20210124-103807-070_L2A_T31TGM_C_V1-0 \ + -d ${DATA_TEST}/S2/SENTINEL2B_20210124-103807-070_L2A_T31TGM_C_V1-0/Leman_dem_merged.tif \ + -o ${test_name} \ + -V 1.11.0 + + +# Output comparison +errors=0 + +echo "-- Comparison FSC TOC" +gdalcompare.py \ + ${BASELINE}/shaded_snow_test/shaded_snow_no_relief_shadow_mask/LIS_S2-SNOW-FSC-TOC_T31TGM_20210124T103807_1.11.0.tif \ + ${test_name}/LIS_S2-SNOW-FSC-TOC_T31TGM_20210124T103807_1.11.0.tif + +errors=$((errors+$?)) +exit ${errors} + diff --git a/docker/tests/test-fsc-snow-s2-rastertools.sh b/docker/tests/test-fsc-snow-s2-rastertools.sh new file mode 100755 index 0000000000000000000000000000000000000000..fee5736dcd61671f9c09668221af68bdfe3e8fa6 --- /dev/null +++ b/docker/tests/test-fsc-snow-s2-rastertools.sh @@ -0,0 +1,30 @@ +#!/bin/bash -u +# Usage: test-fsc-snow-s2-rastertools.sh <data-test> <baseline> + +DATA_TEST=$1 +BASELINE=$2 + +test_name="shaded_snow_rastertools" + +# Cleanup +rm -rf ${test_name} + +# Run test +let_it_snow_fsc.py \ + -c ${DATA_TEST}/S2/shaded_snow/global_parameters_shaded_snow_rastertools.json \ + -i ${DATA_TEST}/S2/SENTINEL2B_20210124-103807-070_L2A_T31TGM_C_V1-0 \ + -d ${DATA_TEST}/S2/SENTINEL2B_20210124-103807-070_L2A_T31TGM_C_V1-0/Leman_dem_merged.tif \ + -o ${test_name} \ + -V 1.11.0 + + +# Output comparison +errors=0 + +echo "-- Comparison FSC TOC" +gdalcompare.py \ + ${BASELINE}/shaded_snow_test/shaded_snow_detect_shaded_snow_rastertools/LIS_S2-SNOW-FSC-TOC_T31TGM_20210124T103807_1.11.0.tif \ + ${test_name}/LIS_S2-SNOW-FSC-TOC_T31TGM_20210124T103807_1.11.0.tif + +errors=$((errors+$?)) +exit ${errors} diff --git a/docker/tests/test-snow-synthesis.sh b/docker/tests/test-snow-synthesis.sh new file mode 100755 index 0000000000000000000000000000000000000000..bd96dd002b9256c34f3d930776e7cfbb3818bd73 --- /dev/null +++ b/docker/tests/test-snow-synthesis.sh @@ -0,0 +1,63 @@ +#!/bin/bash -u +# Usage: test-synthesis.sh <data-test> <baseline> + +DATA_TEST=$1 +BASELINE=$2 + +test_name="snow_synthesis" + +# Cleanup +rm -rf ${test_name} + +# Run test +let_it_snow_synthesis.py \ + -i ${DATA_TEST}/SNOW_PRODUCTS/SENTINEL2A_20180101-105435-457_L2A_T31TCH_D_V1-4 \ + -i ${DATA_TEST}/SNOW_PRODUCTS/SENTINEL2A_20180131-105416-437_L2A_T31TCH_D_V1-4 \ + -d ${DATA_TEST}/SNOW_PRODUCTS/LANDSAT8-OLITIRS-XS_20180115-103629-617_L2A_T31TCH_D_V1-9 \ + -d ${DATA_TEST}/SNOW_PRODUCTS/LANDSAT8-OLITIRS-XS_20180131-103619-890_L2A_T31TCH_D_V1-9 \ + -c ${DATA_TEST}/SYNTHESIS/synthesis_configuration.json \ + -j ${DATA_TEST}/SYNTHESIS/synthesis_launch.json \ + -o ${test_name} \ + -V 1.11.0 + + +# Output comparison +errors=0 + +echo "-- Comparison SCD" +gdalcompare.py \ + ${BASELINE}/snow_synthesis_test/LIS_S2L8-SNOW-SCD_T31TCH_20180101_20180131_1.11.0_1.tif \ + ${test_name}/LIS_S2L8-SNOW-SCD_T31TCH_20180101_20180131_1.11.0_1.tif +errors=$((errors+$?)) + +echo "-- Comparison NOBS" +gdalcompare.py \ + ${BASELINE}/snow_synthesis_test/LIS_S2L8-SNOW-NOBS_T31TCH_20180101_20180131_1.11.0_1.tif \ + ${test_name}/LIS_S2L8-SNOW-NOBS_T31TCH_20180101_20180131_1.11.0_1.tif +errors=$((errors+$?)) + +echo "-- Comparison SOD" +gdalcompare.py \ + ${BASELINE}/snow_synthesis_test/LIS_S2L8-SNOW-SOD_T31TCH_20180101_20180131_1.11.0_1.tif \ + ${test_name}/LIS_S2L8-SNOW-SOD_T31TCH_20180101_20180131_1.11.0_1.tif +errors=$((errors+$?)) + +echo "-- Comparison SMOD" +gdalcompare.py \ + ${BASELINE}/snow_synthesis_test/LIS_S2L8-SNOW-SMOD_T31TCH_20180101_20180131_1.11.0_1.tif \ + ${test_name}/LIS_S2L8-SNOW-SMOD_T31TCH_20180101_20180131_1.11.0_1.tif +errors=$((errors+$?)) + +echo "-- Comparison NSP" +gdalcompare.py \ + ${BASELINE}/snow_synthesis_test/LIS_S2L8-SNOW-NSP_T31TCH_20180101_20180131_1.11.0_1.tif \ + ${test_name}/LIS_S2L8-SNOW-NSP_T31TCH_20180101_20180131_1.11.0_1.tif +errors=$((errors+$?)) + +echo "-- Comparison CCD" +gdalcompare.py \ + ${BASELINE}/snow_synthesis_test/CLOUD_OCCURENCE_T31TCH_20180101_20180131.tif \ + ${test_name}/tmp/CLOUD_OCCURENCE_T31TCH_20180101_20180131.tif +errors=$((errors+$?)) + +exit ${errors}