diff --git a/Dockerfile b/Dockerfile index 08d78696fadc88f2062287302a8d1bfe5ed3b716..67b42a7eeea7b74c8f1591719527ec0f4609b8cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ RUN apt-get update --quiet && \ swig \ ninja-build \ python3-dev \ + git \ python3-numpy \ libgdal-dev \ freeglut3-dev \ @@ -33,13 +34,16 @@ RUN apt-get update --quiet && \ libtinyxml-dev \ libmuparser-dev \ libmuparserx-dev \ - libfftw3-dev && \ + libfftw3-dev \ + libgsl-dev \ + && \ rm -rf /var/lib/apt/lists/* # Build OTB +# Enabling Module_OTBTemporalGapFilling makes OTB become AfferoGPL RUN mkdir -p /root/otb-build/build && \ cd /root/otb-build && \ - wget -nv --show-progress --progress=bar:force:noscroll https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-7.1.0.zip -O /tmp/OTB.zip && \ + wget -nv --show-progress --progress=bar:force:noscroll https://www.orfeo-toolbox.org/packages/archives/OTB/OTB-7.0.0.zip -O /tmp/OTB.zip && \ unzip /tmp/OTB.zip && \ cd /root/otb-build/build && \ cmake \ @@ -53,21 +57,26 @@ RUN mkdir -p /root/otb-build/build && \ "-DOTB_USE_SIFTFAST:BOOL=ON" \ "-DOTB_USE_SPTW:BOOL=ON" \ "-DOTB_USE_SSE_FLAGS:BOOL=ON" \ + "-DOTB_USE_LIBKML:BOOL=ON" \ + "-DModule_OTBTemporalGapFilling:BOOL=ON" \ + "-DModule_SertitObject:BOOL=ON" \ + "-DModule_otbGRM:BOOL=ON" \ + "-DModule_DiapOTBModule:BOOL=ON" \ "-DCMAKE_BUILD_TYPE=Release" \ - -DCMAKE_INSTALL_PREFIX="/install/otb" -GNinja .. && \ + -DCMAKE_INSTALL_PREFIX="/install/otb" -GNinja .. && \ ninja install && \ rm -rf /root/otb-build /tmp/OTB.zip # Build LIS ADD . /LIS_src/ -RUN ln -s /usr/bin/python3 /usr/bin/python && \ - mkdir -p /root/lis-build && \ - cd /root/lis-build && \ - cmake -DCMAKE_PREFIX_PATH=/install/otb \ +RUN ln -s /usr/bin/python3 /usr/bin/python && \ + mkdir -p /root/lis-build && \ + cd /root/lis-build && \ + cmake -DCMAKE_PREFIX_PATH=/install/otb \ -DCMAKE_INSTALL_PREFIX=/install/lis /LIS_src/ && \ - make -j 6 && \ - make install && \ - chmod a+x /install/lis/app/* + make -j 6 && \ + make install && \ + chmod a+x /install/lis/app/* # Build DANS-GDAL scripts RUN mkdir -p /root/dans-build && \ @@ -108,6 +117,8 @@ RUN apt-get update --quiet && \ libmuparser2v5 \ libmuparserx4.0.7 \ libfftw3-3 \ + libgsl23 \ + libgslcblas0 \ && \ rm -rf /var/lib/apt/lists/* diff --git a/app/let_it_snow_synthesis.py b/app/let_it_snow_synthesis.py index da25e922436bff44a7f899c6d163ada71adc86c6..9d85946ce0c97ded1eee913d7b17442e2a4311a8 100644 --- a/app/let_it_snow_synthesis.py +++ b/app/let_it_snow_synthesis.py @@ -25,10 +25,12 @@ import sys import json from logging.handlers import RotatingFileHandler -from s2snow.lis_exception import LisConfigurationException +from s2snow.lis_exception import LisConfigurationException, NoSnowProductFound, NoZipFound, NoProductMatchingSynthesis, \ + UnknownPlatform from s2snow.snow_synthesis import compute_snow_synthesis from s2snow.synthesis_config import SynthesisConfig -from s2snow.lis_constant import INPUT_PARAMETER_ERROR, CONFIGURATION_ERROR, TMP_DIR, LOG_FILE +from s2snow.lis_constant import INPUT_PARAMETER_ERROR, CONFIGURATION_ERROR, TMP_DIR, LOG_FILE, NO_SNOW_PRODUCT_FOUND, \ + NO_ZIP_FOUND, NO_PRODUCT_MATCHING_SYNTHESIS, UNKNOWN_PLATFORM from s2snow.parser import create_synthesis_argument_parser @@ -57,6 +59,18 @@ def main(config_file, tile_id, input_products_list, densification_products_list, try: logging.info("Launch snow synthesis computation.") compute_snow_synthesis(config, output_dir, h2_chain_version, product_counter) + except UnknownPlatform as e: + logging.error(e) + return UNKNOWN_PLATFORM + except NoProductMatchingSynthesis as e: + logging.error(e) + return NO_PRODUCT_MATCHING_SYNTHESIS + except NoSnowProductFound as e: + logging.error(e) + return NO_SNOW_PRODUCT_FOUND + except NoZipFound as e: + logging.error(e) + return NO_ZIP_FOUND except Exception as e: logging.error(e) return -1 @@ -78,7 +92,7 @@ if __name__ == "__main__": date_start = global_config.get("date_start", None) date_stop = global_config.get("date_stop", None) date_margin = global_config.get("date_margin", None) - log_level = global_config.get("log", "INFO") + log_level = global_config.get("log_level", "INFO") config_file = global_config.get("config_file", None) h2_chain_version = global_config.get("chain_version", None) product_counter = global_config.get("product_counter", "1") diff --git a/doc/synthesis_launch_example.json b/doc/synthesis_launch_example.json index 3c7e3a550ca2d6b5231b3abacfd620923c86dd7b..b6e6fa9af309d3bbb89a272cc22e19f359a3c618 100644 --- a/doc/synthesis_launch_example.json +++ b/doc/synthesis_launch_example.json @@ -6,8 +6,8 @@ ], "date_start": "01/01/2018", "date_stop": "31/01/2018", - "output_dir": "/work/scratch/gonzalesf/lis/lis_install_15_10/build/Testing/Temporary/SNOW_SYNTHESIS", - "config_file": "/work/scratch/gonzalesf/lis/lis_install_15_10/build/Testing/Temporary/SNOW_SYNTHESIS/synthesis_configuration.json", + "output_dir": "lis/lis_install_15_10/build/Testing/Temporary/SNOW_SYNTHESIS", + "config_file": "lis/lis_install_15_10/build/Testing/Temporary/SNOW_SYNTHESIS/synthesis_configuration.json", "date_margin": 10, "densification_products_list": [ "/work/OT/siaa/Theia/Neige/TEST/Data-LIS-1.6/Input-Data-Test/SNOW_PRODUCTS/LANDSAT8-OLITIRS-XS_20180115-103629-617_L2A_T31TCH_D_V1-9", diff --git a/python/s2snow/compute_NOBS.py b/python/s2snow/compute_NOBS.py index 43e947115cd2f42ba960701a9cc0a0b97b9b1fee..41bc04792e168ef5d809fc02375e40c7951ffeb3 100644 --- a/python/s2snow/compute_NOBS.py +++ b/python/s2snow/compute_NOBS.py @@ -36,12 +36,12 @@ def compute_NOBS(input_file, synthesis_name=None, output_dir=None): :return: """ logging.debug("compute_NOBS") - logging.debug("input_file", input_file) - logging.debug("synthesis_name", synthesis_name) - logging.debug("output_dir", output_dir) + logging.debug("input_file : %s", input_file) + logging.debug("synthesis_name : %s", synthesis_name) + logging.debug("output_dir : %s", output_dir) if not os.path.isfile(input_file): - logging.error("Input file does not exist : {}", input_file) + logging.error("Input file does not exist : %s", input_file) return if output_dir is None: @@ -69,8 +69,6 @@ def compute_NOBS(input_file, synthesis_name=None, output_dir=None): with rasterio.open(output_file, 'w', **profile) as dst: dst.write(S.astype(rasterio.uint16), 1) - logging.info("End of compute_NOBS.py") - def show_help(): """ diff --git a/python/s2snow/compute_SOD_SMOD.py b/python/s2snow/compute_SOD_SMOD.py index 1fb2d83b7fa57011fae98f2e58e7fbe641fd3126..5641506d36f9ccccebb0400637a7c6083d3258b2 100644 --- a/python/s2snow/compute_SOD_SMOD.py +++ b/python/s2snow/compute_SOD_SMOD.py @@ -38,9 +38,9 @@ def compute_SOD_SMOD(input_file, synthesis_name=None, output_dir=None): """ logging.info("Start compute_SOD_SMOD.py using: {}".format(input_file)) logging.debug("compute_SOD_SMOD") - logging.debug("tmp_dir", output_dir) - logging.debug("input_file", input_file) - logging.debug("synthesis_name", synthesis_name.format("XXX")) + logging.debug("tmp_dir : %s", output_dir) + logging.debug("input_file : %s", input_file) + logging.debug("synthesis_name : %s", synthesis_name.format("XXX")) if not os.path.isfile(input_file): msg = "Input file does not exist : {}".format(input_file) diff --git a/python/s2snow/lis_constant.py b/python/s2snow/lis_constant.py index 7abfa573ee26f100ee6c809175d572c87e449f5f..159d285ab9387aac34ddd0f776f4e29b51eafd3c 100755 --- a/python/s2snow/lis_constant.py +++ b/python/s2snow/lis_constant.py @@ -123,3 +123,12 @@ OUTPUT_DATES_FILE = "output_dates.txt" INPUT_PARAMETER_ERROR = -2 UNKNOWN_PRODUCT_EXCEPTION = -3 CONFIGURATION_ERROR = -4 +UNKNOWN_PLATFORM = -5 +NO_PRODUCT_MATCHING_SYNTHESIS = -6 +NO_SNOW_PRODUCT_FOUND = -7 +NO_ZIP_FOUND = -8 + +# Date Time format +MUSCATE_DATETIME_FORMAT = "%Y%m%d-%H%M%S-%f" +LANDSAT_DATETIME_FORMAT = "%Y%m%d" +LIS_DATETIME_FORMAT = "%Y%m%dT%H%M%S" diff --git a/python/s2snow/lis_exception.py b/python/s2snow/lis_exception.py index 570fd3647498b733eb647319b9d187e777a101f7..638b1259ece8af354e3125425d2d36bace183ee8 100644 --- a/python/s2snow/lis_exception.py +++ b/python/s2snow/lis_exception.py @@ -38,3 +38,13 @@ class UnknownPlatform(Exception): class NoProductMatchingSynthesis(Exception): def __init__(self, msg): self.msg = msg + + +class NoSnowProductFound(Exception): + def __init__(self, msg): + self.msg = msg + + +class NoZipFound(Exception): + def __init__(self, msg): + self.msg = msg \ No newline at end of file diff --git a/python/s2snow/snow_product.py b/python/s2snow/snow_product.py index f904db951f902eadbc7db813b3d00b55646a8e9d..a3e58d029e709ba0d7ef671260c9d8205024d4c1 100644 --- a/python/s2snow/snow_product.py +++ b/python/s2snow/snow_product.py @@ -19,6 +19,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import re from datetime import datetime import logging import os @@ -26,165 +27,147 @@ import os.path as op import zipfile from os.path import basename, dirname -from s2snow.lis_constant import SENTINEL2, LIS, LANDSAT8_OLITIRS_XS, LANDSAT8, N2A -from s2snow.lis_exception import UnknownPlatform -from s2snow.utils import str_to_datetime +from s2snow.lis_constant import SENTINEL2, LIS, LANDSAT8_OLITIRS_XS, LANDSAT8, N2A, MUSCATE_DATETIME_FORMAT, \ + LIS_DATETIME_FORMAT, LANDSAT_DATETIME_FORMAT +from s2snow.lis_exception import UnknownPlatform, NoSnowProductFound, NoZipFound -MUSCATE_DATETIME_FORMAT = "%Y%m%d-%H%M%S-%f" -LIS_DATETIME_FORMAT = "%Y%m%dT%H%M%S" - -class snow_product: - def __init__(self, absoluteFilename): +class SnowProduct: + def __init__(self, absolute_filename, tmp): # example 1 "SENTINEL2A_20160912-103551-370_L2B-SNOW_T32TLS_D_V1-0" # example 2 "LANDSAT8_OLITIRS_XS_20160812_N2A_France-MetropoleD0005H0001" # exemple 3 : "LIS_S2-SNOW-FSC_T31TCH_20180101T105435_1.7.0_1" logging.debug("snow_product initialisation") - logging.debug("absoluteFilename : " + absoluteFilename) + logging.debug("absolute_filename : " + absolute_filename) + + self.product_name = basename(absolute_filename) + logging.debug("product_name : " + self.product_name) + self.acquisition_date = None + self.tile_id = None + self.snow_mask = None + self.metadata_file = None - self.product_name = basename(absoluteFilename) - self.product_path = dirname(absoluteFilename) + self.product_path = absolute_filename name_splitted = self.product_name.split("_") - self.platform = name_splitted[0] + platform = name_splitted[0] + + # unzip input if zipped + zip_product = absolute_filename.lower().endswith('.zip') + zip_file = None + if not zip_product: + for root, dirs, files in os.walk(absolute_filename): + for file in files: + if file.lower().endswith('.zip'): + zip_file = file + break + else: + zip_file = absolute_filename - logging.debug("product_name : " + self.product_name) - logging.debug("product_path : " + self.product_path) - logging.debug("platform : " + self.platform) + if zip_file is not None: + logging.debug("zipfile : " + op.join(absolute_filename, zip_file)) + logging.info("The snow product is stored in a zip, extracting zip file.") + extract_snow_mask(op.join(absolute_filename, zip_file), tmp) + # self.product_path = op.join(tmp, op.basename(op.splitext(zip_file)[0])) + self.product_path = tmp + logging.debug("product_path : " + self.product_path) - if SENTINEL2 in self.platform : + if SENTINEL2 in platform: self.acquisition_date = datetime.strptime(name_splitted[1], MUSCATE_DATETIME_FORMAT) - logging.debug("acquisition_date : " + str(self.acquisition_date)) - self.product_level = name_splitted[2] - logging.debug("product_level : " + self.product_level) self.tile_id = name_splitted[3] - logging.debug("tile_id : " + self.tile_id) - self.flag = name_splitted[4] - logging.debug("flag : " + self.flag) - self.product_version = name_splitted[5] - logging.debug("product_version : " + self.product_version) - elif LANDSAT8_OLITIRS_XS == self.platform: + self.snow_mask = find_files(self.product_path, ".*_SNW_R2.(tif|TIF)") + self.metadata_file = find_files(self.product_path, ".*_MTD_ALL.(xml|XML)") + elif LANDSAT8_OLITIRS_XS == platform: self.acquisition_date = datetime.strptime(name_splitted[1], MUSCATE_DATETIME_FORMAT) - logging.debug("acquisition_date : " + str(self.acquisition_date)) - self.product_level = name_splitted[2] - logging.debug("product_level : " + self.product_level) self.tile_id = name_splitted[3] - logging.debug("tile_id : " + self.tile_id) - self.flag = name_splitted[4] - logging.debug("flag : " + self.flag) - self.product_version = name_splitted[5] - logging.debug("product_version : " + self.product_version) - elif LANDSAT8 in self.platform and N2A in self.product_name: - self.acquisition_date = datetime.strptime(name_splitted[3], "%Y%m%d") - logging.debug("acquisition_date : " + str(self.acquisition_date)) - self.product_level = name_splitted[4] - logging.debug("product_level : " + self.product_level) + self.snow_mask = find_files(self.product_path, ".*_SNW_XS.(tif|TIF)") + self.metadata_file = find_files(self.product_path, ".*_MTD_ALL.(xml|XML)") + elif LANDSAT8 in platform and N2A in self.product_name: + self.acquisition_date = datetime.strptime(name_splitted[3], LANDSAT_DATETIME_FORMAT) self.tile_id = name_splitted[5] - logging.debug("tile_id : " + self.tile_id) - self.flag = None - self.product_version = None - elif LIS in self.platform: - # FSC product + self.snow_mask = find_files(self.product_path, ".*_SNW_XS.(tif|TIF)") + self.metadata_file = find_files(self.product_path, ".*_MTD_ALL.(xml|XML)") + elif LIS in platform: self.acquisition_date = datetime.strptime(name_splitted[3], LIS_DATETIME_FORMAT) - logging.debug("acquisition_date : " + str(self.acquisition_date)) - self.product_level = "L2B" - logging.debug("product_level : " + self.product_level) self.tile_id = name_splitted[2] - logging.debug("tile_id : " + self.tile_id) - self.flag = None - self.product_version = name_splitted[4] - logging.debug("product_version : " + self.product_version) + self.snow_mask = find_files(self.product_path, ".*SNOW-FS.*C_.*(tif|TIF)") + self.metadata_file = find_files(self.product_path, ".*SNOW-.*.(xml|XML)") else: - msg = "Unknown platform: " + self.platform + msg = "Unknown platform or producer: " + platform logging.error(msg) raise UnknownPlatform(msg) - self.zip_product = None - self.is_extracted = False - self.snow_mask = None - self.is_fsc = False - - self.sub_files = os.listdir(absoluteFilename) - for sub_file in self.sub_files: - if sub_file.lower().endswith(".zip"): - logging.info("The snow product is stored in a zip") - self.zip_product = op.join(absoluteFilename, sub_file) - if sub_file == self.product_name: - logging.info("The zipped snow product is already extracted") - self.is_extracted = True - self.extracted_product = op.join(absoluteFilename, sub_file) - self.snow_mask = op.join(self.extracted_product, - self.product_name + "_SNW_R2.tif") - if sub_file.upper().endswith("_SNW_R2.TIF"): - self.is_extracted = True - self.snow_mask = op.join(absoluteFilename, sub_file) - if sub_file.upper().endswith("_SNW_XS.TIF"): - self.is_extracted = True - self.snow_mask = op.join(absoluteFilename, sub_file) - if sub_file.upper() == "LIS_PRODUCTS": - self.is_extracted = True - self.extracted_product = op.join(absoluteFilename, sub_file) - self.snow_mask = op.join(self.extracted_product, "LIS_SEB.TIF") - if "SNOW-FSC_" in sub_file or "SNOW-FSC-TOC" in sub_file: - self.is_extracted = True - self.snow_mask = op.join(absoluteFilename, sub_file) - logging.debug("snow_mask : " + self.snow_mask) - self.is_fsc = True - if "SNOW-MSK" in sub_file: - self.is_extracted = True - self.snow_mask = op.join(absoluteFilename, sub_file) - logging.debug("snow_mask : " + self.snow_mask) - self.is_fsc = False - - self.metadata_file = op.join(absoluteFilename, - self.product_name + "_MTD_ALL.xml") + if self.snow_mask is None: + self.snow_mask = find_files(self.product_path, "LIS_SEB") + + if self.metadata_file is None: + self.metadata_file = find_files(self.product_path, "LIS_METADATA.XML") + + self.log_product() def __repr__(self): - return op.join(self.product_path, self.product_name) + return op.join(self.product_path) def __str__(self): - return op.join(self.product_path, self.product_name) + return op.join(self.product_path) - def extract_snow_mask(self, output_folder): - if self.snow_mask and op.exists(self.snow_mask): - logging.info("The snow mask is already extracted and available") - elif self.zip_product and op.exists(self.zip_product): - extracted_files = extract_from_zipfile(self.zip_product, - output_folder, - ["_SNW_R2.tif"]) - self.snow_mask = extracted_files[0] - else: - logging.error("Extraction failed") + def log_product(self): + logging.debug("-------------------------------------") + logging.debug("SNOW PRODUCT") + logging.debug("-------------------------------------") + logging.debug("product_name : " + self.product_name) + logging.debug("acquisition_date : " + str(self.acquisition_date)) + logging.debug("tile_id : " + self.tile_id) + logging.debug("snow_mask : " + self.get_snow_mask()) + if self.metadata_file: + logging.debug("metadata_file : " + self.metadata_file) def get_snow_mask(self): if self.snow_mask and op.exists(self.snow_mask): - if self.is_fsc: - #TODO transform FSC en masque de neige - return self.snow_mask - else: - return self.snow_mask + return self.snow_mask else: - logging.info("The snow mask must first be extracted") + msg = "The snow mask has not been found." + logging.error(msg) + raise NoSnowProductFound(msg) def get_metadata(self): if self.metadata_file and op.exists(self.metadata_file): return self.metadata_file else: - logging.info("The metadata file was not found") + logging.warning("The metadata file has not been found.") -def extract_from_zipfile(file_name, output_folder, patterns=[]): +def extract_from_zipfile(file_name, output_folder): """ Extract from the zip file all files corresponding to one of the provided patterns """ - f = open(file_name, 'r') - z = zipfile.ZipFile(f) - extracted_files = [] - for pattern in patterns: - for name in z.namelist(): - if pattern in name: - logging.debug(name) - z.extract(name, output_folder) - extracted_files.append(op.join(output_folder, name)) - f.close() - return extracted_files + zip_input = zipfile.ZipFile(file_name) + zip_input.extractall(path=output_folder) + + +def extract_snow_mask(zip_file, output_folder): + if op.exists(zip_file): + extract_from_zipfile(zip_file, output_folder) + else: + msg = "Extraction failed - zipfile does not exist : " + zip_file + logging.error(msg) + raise NoZipFound(msg) + + +def find_files(folder, pattern): + """ Search recursively into a folder to find a pattern match + """ + logging.debug("folder :%s", folder) + logging.debug("pattern :%s", pattern) + + for root, dirs, files in os.walk(folder): + for file in files: + logging.debug("file:" + file) + if re.match(pattern, file): + logging.debug("match file :%s", file) + return os.path.join(root, file) + + return None + + + diff --git a/python/s2snow/snow_synthesis.py b/python/s2snow/snow_synthesis.py index 410077f7d36e08c368525967aa012b76cffacdd3..4eb7fa91044f9efeb1efac1483261009802fc48b 100644 --- a/python/s2snow/snow_synthesis.py +++ b/python/s2snow/snow_synthesis.py @@ -38,7 +38,7 @@ from s2snow.compute_SOD_SMOD import compute_SOD_SMOD from s2snow.lis_constant import TMP_DIR, OUTPUT_DATES_FILE from s2snow.lis_exception import NoProductMatchingSynthesis from s2snow.otb_wrappers import band_math, super_impose, band_mathX, gap_filling, get_app_output -from s2snow.snow_product import snow_product +from s2snow.snow_product import SnowProduct from s2snow.utils import datetime_to_str from s2snow.utils import write_list_to_file, read_list_from_file @@ -69,7 +69,7 @@ def compute_snow_synthesis(config, output_dir, h2_chain_version=None, product_co logging.info("Load S2 snow products.") product_dict = load_snow_products(config.date_start, config.date_stop, config.date_margin, - config.input_products_list, config.tile_id) + config.input_products_list, config.tile_id, tmp_dir) # Exiting with error if none of the input products were loaded if not product_dict: @@ -391,7 +391,7 @@ def load_densification_products(date_margin, date_start, date_stop, densificatio logging.debug("ram : %s", str(ram)) # load densification snow products - densification_product_dict = load_snow_products(date_start, date_stop, date_margin, densification_products_list, None) + densification_product_dict = load_snow_products(date_start, date_stop, date_margin, densification_products_list, None, path_tmp) logging.debug("Densification product dict:") logging.debug(densification_product_dict) @@ -430,7 +430,7 @@ def load_densification_products(date_margin, date_start, date_stop, densificatio logging.warning("No Densifying candidate product found!") -def load_snow_products(date_start, date_stop, date_margin, snow_products_list, tile_id): +def load_snow_products(date_start, date_stop, date_margin, snow_products_list, tile_id, path_tmp): logging.debug("load_products") logging.debug("date_start : %s", str(date_start)) logging.debug("date_stop : %s", str(date_stop)) @@ -445,7 +445,7 @@ def load_snow_products(date_start, date_stop, date_margin, snow_products_list, t for product_path in snow_products_list: logging.debug("product_path : %s", str(product_path)) - product = snow_product(str(product_path)) + product = SnowProduct(str(product_path), path_tmp) logging.debug("product : %s", str(product)) acquisition_day = datetime.strftime(product.acquisition_date, "%Y%m%d") diff --git a/python/s2snow/synthesis_config.py b/python/s2snow/synthesis_config.py index fe9cc0fd48f6fc06618f2b6c3262b09c85353476..c35aab62f6610fd52a13b2b575a5056d401fafc9 100644 --- a/python/s2snow/synthesis_config.py +++ b/python/s2snow/synthesis_config.py @@ -73,6 +73,11 @@ class SynthesisConfig: logging.error(msg) raise LisConfigurationException(msg) + if self.tile_id is None: + msg = "Tile id is not defined." + logging.error(msg) + raise LisConfigurationException(msg) + def log_configuration(self): logging.debug("==== Configuration ====") for input_product in self.input_products_list: diff --git a/python/s2snow/version.py b/python/s2snow/version.py index 63fa31ae1d48c5d1e89833dd687e45126e3f4d5b..68c39fc72177508a776b5293d5fc9eaa80dd7e38 100644 --- a/python/s2snow/version.py +++ b/python/s2snow/version.py @@ -20,4 +20,4 @@ # limitations under the License. # -VERSION = "1.7.1" +VERSION = "1.7.2" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 18bdbfca839eaa45c3870ea90db1801a388204b7..810a4511f1d340420188461d419905891f557139 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -272,6 +272,7 @@ add_test(NAME snow_synthesis_test -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 + -V 1.7.1 -o ${OUTPUT_TEST}/SNOW_SYNTHESIS ) @@ -333,7 +334,7 @@ add_test(NAME snow_synthesis_without_densification_test -m 10 -l DEBUG -c ${DATA_TEST}/SYNTHESIS/synthesis_configuration.json - -o ${OUTPUT_TEST}/SNOW_ANNUAL_MAP_WITHOUT_DENSIFICATION + -o ${OUTPUT_TEST}/SNOW_SYNTHESIS_WITHOUT_DENSIFICATION ) @@ -432,6 +433,42 @@ add_test(NAME snow_synthesis_from_last_version_test set_tests_properties(snow_synthesis_from_last_version_test PROPERTIES DEPENDS synthesis_from_l2A_S2_20180131) set_tests_properties(snow_synthesis_from_last_version_test PROPERTIES DEPENDS synthesis_from_l2A_S2_20180101) +# ---------------------------------- +# Synthesis with zip files +# ---------------------------------- +add_test(NAME snow_synthesis_with_zip + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/app/let_it_snow_synthesis.py + -t T31TCH + -i ${DATA_TEST}/SNOW_PRODUCTS/SENTINEL2A_20170910-104212-297_L2B-SNOW_T31TCH_D_V1-7 + -i ${DATA_TEST}/SNOW_PRODUCTS/SENTINEL2A_20170913-105335-667_L2B-SNOW_T31TCH_D_V1-7 + -d ${DATA_TEST}/SNOW_PRODUCTS/LANDSAT8-OLITIRS-XS_20170916-104232-708_L2B-SNOW_T31TCH_D_V1-6 + -d ${DATA_TEST}/SNOW_PRODUCTS/LANDSAT8-OLITIRS-XS_20171002-104239-944_L2B-SNOW_T31TCH_D_V1-6 + -b 01/09/2017 + -e 31/08/2018 + -m 10 + -l INFO + -c ${DATA_TEST}/SYNTHESIS/synthesis_configuration.json + -o ${OUTPUT_TEST}/SNOW_SYNTHESIS_WITH_ZIP + ) + + # ---------------------------------- +# Synthesis with H2 snow products +# ---------------------------------- +add_test(NAME snow_synthesis_with_h2_snow_products + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/app/let_it_snow_synthesis.py + -t T32TLQ + -i ${DATA_TEST}/SNOW_PRODUCTS/LIS_S2-SNOW-FSC_T32TLQ_20220203T103832_2-0_14 + -i ${DATA_TEST}/SNOW_PRODUCTS/LIS_S2-SNOW-FSC_T32TLQ_20220205T102830_2-0_01 + -i ${DATA_TEST}/SNOW_PRODUCTS/LIS_S2-SNOW-FSC_T32TLQ_20220208T103827_2-0_01 + -i ${DATA_TEST}/SNOW_PRODUCTS/LIS_S2-SNOW-FSC_T32TLQ_20220210T102834_2-0_02 + -b 21/01/2022 + -e 19/02/2022 + -m 2 + -l INFO + -c ${DATA_TEST}/SYNTHESIS/synthesis_h2_configuration.json + -o ${OUTPUT_TEST}/SNOW_SYNTHESIS_WITH_H2_SNOW_PRODUCTS + ) + ADD_EXECUTABLE(histo_utils_snowline_internal_test histo_utils_snowline_internal_test.cxx) TARGET_LINK_LIBRARIES(histo_utils_snowline_internal_test histo_utils)