diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/analysis/app_wrappers.py b/analysis/app_wrappers.py old mode 100644 new mode 100755 diff --git a/analysis/cloud_builder.py b/analysis/cloud_builder.py old mode 100644 new mode 100755 diff --git a/analysis/cloud_removal.py b/analysis/cloud_removal.py old mode 100644 new mode 100755 diff --git a/analysis/readme.md b/analysis/readme.md old mode 100644 new mode 100755 diff --git a/analysis/run_cloud_removal.py b/analysis/run_cloud_removal.py old mode 100644 new mode 100755 diff --git a/analysis/run_snowcover.py b/analysis/run_snowcover.py old mode 100644 new mode 100755 diff --git a/analysis/snow_annual_map.py b/analysis/snow_annual_map.py old mode 100644 new mode 100755 diff --git a/analysis/snow_annual_map_analysis_schema.json b/analysis/snow_annual_map_analysis_schema.json old mode 100644 new mode 100755 diff --git a/analysis/snow_annual_map_evaluation.py b/analysis/snow_annual_map_evaluation.py old mode 100644 new mode 100755 diff --git a/analysis/snowcover.py b/analysis/snowcover.py old mode 100644 new mode 100755 diff --git a/analysis/utils/profiling_pass1.5.py b/analysis/utils/profiling_pass1.5.py old mode 100644 new mode 100755 diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/app/let_it_snow_fsc.py b/app/let_it_snow_fsc.py old mode 100644 new mode 100755 index 4618379911738caa25cf7f7526de4d639477300e..b2afcb62d16ccc0445b49194e75533d05757bf25 --- a/app/let_it_snow_fsc.py +++ b/app/let_it_snow_fsc.py @@ -26,50 +26,13 @@ import json from logging.handlers import RotatingFileHandler from s2snow.fsc_config import FscConfig, LisConfigurationException, UnknownProductException -from s2snow.lis_constant import INPUT_PARAMETER_ERROR, UNKNOWN_PRODUCT_EXCEPTION, CONFIGURATION_ERROR, TMP_DIR, LOG_FILE +from s2snow.lis_constant import INPUT_PARAMETER_ERROR, UNKNOWN_PRODUCT_EXCEPTION, CONFIGURATION_ERROR, TMP_DIR, \ + LOG_FILE, OUTPUT_UNDEFINED from s2snow.parser import create_fsc_argument_parser from s2snow.snow_detector import detect_snow -def main(config_file, input_dir, output_dir, dem, tcd, water_mask, h2_chain_version=None, product_counter=None): - # Check configuration file - if not os.path.exists(config_file): - logging.error("Configuration file does not exist.") - return INPUT_PARAMETER_ERROR - - # Load json_file from json files - with open(config_file) as json_data_file: - data = json.load(json_data_file) - logging.info("Reading configuration = " + config_file) - try: - config = FscConfig(data, input_dir, dem, tcd, water_mask) - except LisConfigurationException: - return CONFIGURATION_ERROR - except UnknownProductException: - return UNKNOWN_PRODUCT_EXCEPTION - except IOError: - return INPUT_PARAMETER_ERROR - - if not os.path.exists(output_dir): - logging.warning("Output directory product does not exist.") - logging.info("Create directory " + output_dir + "...") - os.makedirs(output_dir) - - # Run the snow detector - try: - logging.info("Launch snow detection.") - detect_snow(config, output_dir, h2_chain_version, product_counter) - except Exception as e: - logging.error(e) - return -1 - - return 0 - - -if __name__ == "__main__": - args_parser = create_fsc_argument_parser() - args = args_parser.parse_args(sys.argv[1:]) - +def main(args): if args.json_config_file is not None: with open(args.json_config_file) as json_config_file: global_config = json.load(json_config_file) @@ -97,12 +60,12 @@ if __name__ == "__main__": output_dir = args.output_dir if output_dir is None: - raise LisConfigurationException("Output directory is not defined.") + sys.exit(OUTPUT_UNDEFINED) if not os.path.exists(output_dir): os.makedirs(output_dir) - # Create tmp dir + # Create tmp dir os.makedirs(output_dir + "/" + TMP_DIR, exist_ok=True) tmp_dir = os.path.join(output_dir, TMP_DIR) log_file = os.path.join(tmp_dir, LOG_FILE) @@ -112,7 +75,7 @@ if __name__ == "__main__": if args.log_level is not None: log_level = args.log_level if log_level is None: - log_level="INFO" + log_level = "INFO" level = logging.getLevelName(log_level) logger.setLevel(level) @@ -157,4 +120,46 @@ if __name__ == "__main__": logging.info("product counter: %s", args.product_counter) product_counter = args.product_counter - main(config_file, input_dir, output_dir, dem, tcd, water_mask, h2_chain_version, product_counter) + let_it_snow_fsc(config_file, input_dir, output_dir, dem, tcd, water_mask, h2_chain_version, product_counter) + + +def let_it_snow_fsc(config_file, input_dir, output_dir, dem, tcd, water_mask, h2_chain_version=None, + product_counter=None): + # Check configuration file + if not os.path.exists(config_file): + logging.error("Configuration file does not exist.") + sys.exit(INPUT_PARAMETER_ERROR) + + # Load json_file from json files + with open(config_file) as json_data_file: + data = json.load(json_data_file) + logging.info("Reading configuration = " + config_file) + try: + config = FscConfig(data, input_dir, dem, tcd, water_mask) + except LisConfigurationException: + sys.exit(CONFIGURATION_ERROR) + except UnknownProductException: + sys.exit(UNKNOWN_PRODUCT_EXCEPTION) + except IOError: + sys.exit(INPUT_PARAMETER_ERROR) + + if not os.path.exists(output_dir): + logging.warning("Output directory product does not exist.") + logging.info("Create directory " + output_dir + "...") + os.makedirs(output_dir) + + # Run the snow detector + try: + logging.info("Launch snow detection.") + detect_snow(config, output_dir, h2_chain_version, product_counter) + except Exception as e: + logging.error(e) + sys.exit(1) + + sys.exit(0) + + +if __name__ == "__main__": + args_parser = create_fsc_argument_parser() + args = args_parser.parse_args(sys.argv[1:]) + main(args) diff --git a/app/let_it_snow_synthesis.py b/app/let_it_snow_synthesis.py old mode 100644 new mode 100755 index 9d85946ce0c97ded1eee913d7b17442e2a4311a8..855f007057fa1ff8b750599db49fd28f6cbe0ed0 --- a/app/let_it_snow_synthesis.py +++ b/app/let_it_snow_synthesis.py @@ -30,58 +30,11 @@ from s2snow.lis_exception import LisConfigurationException, NoSnowProductFound, 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, NO_SNOW_PRODUCT_FOUND, \ - NO_ZIP_FOUND, NO_PRODUCT_MATCHING_SYNTHESIS, UNKNOWN_PLATFORM + NO_ZIP_FOUND, NO_PRODUCT_MATCHING_SYNTHESIS, UNKNOWN_PLATFORM, OUTPUT_UNDEFINED from s2snow.parser import create_synthesis_argument_parser -def main(config_file, tile_id, input_products_list, densification_products_list, output_dir, date_start, date_stop, date_margin, - h2_chain_version=None, product_counter=None): - # Check configuration file - if not os.path.exists(config_file): - logging.error("Configuration file does not exist.") - return INPUT_PARAMETER_ERROR - - # Load json_file from json files - with open(config_file) as json_data_file: - data = json.load(json_data_file) - logging.info("Reading configuration = " + config_file) - try: - config = SynthesisConfig(data, tile_id, input_products_list, date_start, date_stop, date_margin=date_margin, - densification_products_list=densification_products_list) - except LisConfigurationException: - return CONFIGURATION_ERROR - except IOError: - return INPUT_PARAMETER_ERROR - - - - # Run the snow detector - 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 - - return 0 - - -if __name__ == "__main__": - args_parser = create_synthesis_argument_parser() - args = args_parser.parse_args(sys.argv[1:]) - +def main(args): if args.json_config_file is not None: with open(args.json_config_file) as json_config_file: global_config = json.load(json_config_file) @@ -99,7 +52,7 @@ if __name__ == "__main__": else: tile_id = None input_products_list = None - densification_products_list= None + densification_products_list = None output_dir = None config_file = None date_start = None @@ -113,7 +66,7 @@ if __name__ == "__main__": output_dir = args.output_dir if output_dir is None: - raise LisConfigurationException("Output directory is not defined.") + sys.exit(OUTPUT_UNDEFINED) if not os.path.exists(output_dir): os.makedirs(output_dir) @@ -135,8 +88,9 @@ if __name__ == "__main__": # file handler file_handler = RotatingFileHandler(log_file, 'a', 1000000, 1) - formatter = logging.Formatter(fmt='%(asctime)s.%(msecs)03d %(levelname)s:%(filename)s:line=%(lineno)s:%(funcName)s:%(message)s', - datefmt='%Y-%m-%dT%H:%M:%S') + formatter = logging.Formatter( + fmt='%(asctime)s.%(msecs)03d %(levelname)s:%(filename)s:line=%(lineno)s:%(funcName)s:%(message)s', + datefmt='%Y-%m-%dT%H:%M:%S') file_handler.setLevel(level) file_handler.setFormatter(formatter) logger.addHandler(file_handler) @@ -148,7 +102,6 @@ if __name__ == "__main__": logger.addHandler(stream_handler) logging.debug("Debug level activated.") - logging.info("output directory : %s", output_dir) if args.tile_id is not None: @@ -179,4 +132,54 @@ if __name__ == "__main__": logging.info("product counter: %s", args.product_counter) product_counter = args.product_counter - main(config_file, tile_id, input_products_list, densification_products_list, output_dir, date_start, date_stop, date_margin, h2_chain_version, product_counter) + let_it_snow_synthesis(config_file, tile_id, input_products_list, densification_products_list, output_dir, + date_start, date_stop, date_margin, h2_chain_version, product_counter) + + +def let_it_snow_synthesis(config_file, tile_id, input_products_list, densification_products_list, output_dir, + date_start, date_stop, date_margin, + h2_chain_version=None, product_counter=None): + # Check configuration file + if not os.path.exists(config_file): + logging.error("Configuration file does not exist.") + sys.exit(INPUT_PARAMETER_ERROR) + + # Load json_file from json files + with open(config_file) as json_data_file: + data = json.load(json_data_file) + logging.info("Reading configuration = " + config_file) + try: + config = SynthesisConfig(data, tile_id, input_products_list, date_start, date_stop, date_margin=date_margin, + densification_products_list=densification_products_list) + except LisConfigurationException: + sys.exit(CONFIGURATION_ERROR) + except IOError: + sys.exit(INPUT_PARAMETER_ERROR) + + # Run the snow detector + 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) + sys.exit(UNKNOWN_PLATFORM) + except NoProductMatchingSynthesis as e: + logging.error(e) + sys.exit(NO_PRODUCT_MATCHING_SYNTHESIS) + except NoSnowProductFound as e: + logging.error(e) + sys.exit(NO_SNOW_PRODUCT_FOUND) + except NoZipFound as e: + logging.error(e) + sys.exit(NO_ZIP_FOUND) + except Exception as e: + logging.error(e) + sys.exit(-1) + + sys.exit(0) + + +if __name__ == "__main__": + args_parser = create_synthesis_argument_parser() + args = args_parser.parse_args(sys.argv[1:]) + main(args) diff --git a/doc/LIS_configuration_for_experts.md b/doc/LIS_configuration_for_experts.md old mode 100644 new mode 100755 diff --git a/doc/TODO.md b/doc/TODO.md old mode 100644 new mode 100755 diff --git a/doc/atbd/ATBD_CES-Neige.pdf b/doc/atbd/ATBD_CES-Neige.pdf old mode 100644 new mode 100755 diff --git a/doc/atbd/ATBD_CES-Neige.tex b/doc/atbd/ATBD_CES-Neige.tex old mode 100644 new mode 100755 diff --git a/doc/atbd/ATBD_Cold_Cloud_Removal.tex b/doc/atbd/ATBD_Cold_Cloud_Removal.tex old mode 100644 new mode 100755 diff --git a/doc/atbd/README.md b/doc/atbd/README.md old mode 100644 new mode 100755 diff --git a/doc/atbd/algorithm2e.sty b/doc/atbd/algorithm2e.sty old mode 100644 new mode 100755 diff --git a/doc/atbd/enumitem.sty b/doc/atbd/enumitem.sty old mode 100644 new mode 100755 diff --git a/doc/atbd/fsc_config_schema.json b/doc/atbd/fsc_config_schema.json old mode 100644 new mode 100755 diff --git a/doc/atbd/fsc_launch_schema.json b/doc/atbd/fsc_launch_schema.json old mode 100644 new mode 100755 diff --git a/doc/atbd/images/.directory b/doc/atbd/images/.directory old mode 100644 new mode 100755 diff --git a/doc/atbd/images/L8vsS4-23042013_montage.png b/doc/atbd/images/L8vsS4-23042013_montage.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/Maroc_20130327_S4T5.png b/doc/atbd/images/Maroc_20130327_S4T5.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/S2snow.png b/doc/atbd/images/S2snow.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/S2snow_eq02512469557822599828.png b/doc/atbd/images/S2snow_eq02512469557822599828.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/S2snow_eq05316141687941017415.png b/doc/atbd/images/S2snow_eq05316141687941017415.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/S2snow_eq11519809210784707025.png b/doc/atbd/images/S2snow_eq11519809210784707025.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/Sentinel2_testmontage.png b/doc/atbd/images/Sentinel2_testmontage.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/Theia_en.png b/doc/atbd/images/Theia_en.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/castest_CESneige.png b/doc/atbd/images/castest_CESneige.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/castest_CESneige_01.png b/doc/atbd/images/castest_CESneige_01.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/castest_CESneige_02.png b/doc/atbd/images/castest_CESneige_02.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/castest_CESneige_03.png b/doc/atbd/images/castest_CESneige_03.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/fmask20140111.png b/doc/atbd/images/fmask20140111.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/logo_cesbio.png b/doc/atbd/images/logo_cesbio.png old mode 100644 new mode 100755 diff --git a/doc/atbd/images/montage_L8CESneige.png b/doc/atbd/images/montage_L8CESneige.png old mode 100644 new mode 100755 diff --git a/doc/atbd/include/S2snow.tex b/doc/atbd/include/S2snow.tex old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige.aux b/doc/atbd/include/castest_CESneige.aux old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige.tex b/doc/atbd/include/castest_CESneige.tex old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige.tex.aux b/doc/atbd/include/castest_CESneige.tex.aux old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige.tex.backup b/doc/atbd/include/castest_CESneige.tex.backup old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige_01-eps-converted-to.pdf b/doc/atbd/include/castest_CESneige_01-eps-converted-to.pdf old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige_01.eps b/doc/atbd/include/castest_CESneige_01.eps old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige_02-eps-converted-to.pdf b/doc/atbd/include/castest_CESneige_02-eps-converted-to.pdf old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige_02.eps b/doc/atbd/include/castest_CESneige_02.eps old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige_03-eps-converted-to.pdf b/doc/atbd/include/castest_CESneige_03-eps-converted-to.pdf old mode 100644 new mode 100755 diff --git a/doc/atbd/include/castest_CESneige_03.eps b/doc/atbd/include/castest_CESneige_03.eps old mode 100644 new mode 100755 diff --git a/doc/atbd/page_titre.tex b/doc/atbd/page_titre.tex old mode 100644 new mode 100755 diff --git a/doc/atbd/relsize.sty b/doc/atbd/relsize.sty old mode 100644 new mode 100755 diff --git a/doc/atbd/snow_annual_map_schema.json b/doc/atbd/snow_annual_map_schema.json old mode 100644 new mode 100755 diff --git a/doc/atbd/snow_detector_schema.json b/doc/atbd/snow_detector_schema.json old mode 100644 new mode 100755 diff --git a/doc/atbd/synthesis_config_schema.json b/doc/atbd/synthesis_config_schema.json old mode 100644 new mode 100755 diff --git a/doc/atbd/synthesis_launch_schema.json b/doc/atbd/synthesis_launch_schema.json old mode 100644 new mode 100755 diff --git a/doc/atbd/wrapfig.sty b/doc/atbd/wrapfig.sty old mode 100644 new mode 100755 diff --git a/doc/cla/ccla-en.doc b/doc/cla/ccla-en.doc old mode 100644 new mode 100755 diff --git a/doc/cla/icla-en.doc b/doc/cla/icla-en.doc old mode 100644 new mode 100755 diff --git a/doc/images/L8_interpolation_comparaison.png b/doc/images/L8_interpolation_comparaison.png old mode 100644 new mode 100755 diff --git a/doc/images/graph_comparison.png b/doc/images/graph_comparison.png old mode 100644 new mode 100755 diff --git a/doc/images/modis_annual_map.png b/doc/images/modis_annual_map.png old mode 100644 new mode 100755 diff --git a/doc/images/s2_annual_map.png b/doc/images/s2_annual_map.png old mode 100644 new mode 100755 diff --git a/doc/images/snow_annual_map_ex1.png b/doc/images/snow_annual_map_ex1.png old mode 100644 new mode 100755 diff --git a/doc/lis_default_configuration.json b/doc/lis_default_configuration.json old mode 100644 new mode 100755 diff --git a/doc/lis_launch_example.json b/doc/lis_launch_example.json old mode 100644 new mode 100755 diff --git a/doc/snow_annual_map.md b/doc/snow_annual_map.md old mode 100644 new mode 100755 diff --git a/doc/synthesis_default_configuration.json b/doc/synthesis_default_configuration.json old mode 100644 new mode 100755 diff --git a/doc/synthesis_launch_example.json b/doc/synthesis_launch_example.json old mode 100644 new mode 100755 diff --git a/doc/tutorials/images/artos-lis-compo-sen2cor.png b/doc/tutorials/images/artos-lis-compo-sen2cor.png old mode 100644 new mode 100755 diff --git a/doc/tutorials/images/artos-lis-compo.png b/doc/tutorials/images/artos-lis-compo.png old mode 100644 new mode 100755 diff --git a/doc/tutorials/images/artos-rgb.png b/doc/tutorials/images/artos-rgb.png old mode 100644 new mode 100755 diff --git a/doc/tutorials/lis_from_maja.md b/doc/tutorials/lis_from_maja.md old mode 100644 new mode 100755 diff --git a/doc/tutorials/lis_from_sen2cor.md b/doc/tutorials/lis_from_sen2cor.md old mode 100644 new mode 100755 diff --git a/doc/tutorials/prepare_snow_annual_map_data.md b/doc/tutorials/prepare_snow_annual_map_data.md old mode 100644 new mode 100755 diff --git a/docker/README.md b/docker/README.md old mode 100644 new mode 100755 diff --git a/hpc/LIS_SEB_style_OTB.txt b/hpc/LIS_SEB_style_OTB.txt old mode 100644 new mode 100755 diff --git a/hpc/batch_compute_NOBS.sh b/hpc/batch_compute_NOBS.sh old mode 100644 new mode 100755 diff --git a/hpc/batch_compute_PSL.sh b/hpc/batch_compute_PSL.sh old mode 100644 new mode 100755 diff --git a/hpc/batch_compute_SOD_SMOD.sh b/hpc/batch_compute_SOD_SMOD.sh old mode 100644 new mode 100755 diff --git a/hpc/computeLatestClearObservation.sh b/hpc/computeLatestClearObservation.sh old mode 100644 new mode 100755 diff --git a/hpc/compute_PSL.py b/hpc/compute_PSL.py old mode 100644 new mode 100755 diff --git a/hpc/get_altitude_tiles.sh b/hpc/get_altitude_tiles.sh old mode 100644 new mode 100755 diff --git a/hpc/makeTCDforLIS.sh b/hpc/makeTCDforLIS.sh old mode 100644 new mode 100755 diff --git a/hpc/makefigureTile_lis_Sentinel2_cluster_muscate.sh b/hpc/makefigureTile_lis_Sentinel2_cluster_muscate.sh old mode 100644 new mode 100755 diff --git a/hpc/param20190612T31TCH.json b/hpc/param20190612T31TCH.json old mode 100644 new mode 100755 diff --git a/hpc/prepare_data_for_snow_monthly_map.py b/hpc/prepare_data_for_snow_monthly_map.py old mode 100644 new mode 100755 diff --git a/hpc/runTile_lis_Sentinel2_datalake_anytile.sh b/hpc/runTile_lis_Sentinel2_datalake_anytile.sh old mode 100644 new mode 100755 diff --git a/hpc/runTile_lis_Sentinel2_datalake_anytile_anydate.sh b/hpc/runTile_lis_Sentinel2_datalake_anytile_anydate.sh old mode 100644 new mode 100755 diff --git a/hpc/run_lis_from_filelist.sh b/hpc/run_lis_from_filelist.sh old mode 100644 new mode 100755 diff --git a/hpc/run_snow_annual_map.sh b/hpc/run_snow_annual_map.sh old mode 100644 new mode 100755 diff --git a/hpc/selectNeigeSyntheseMultitemp.csv b/hpc/selectNeigeSyntheseMultitemp.csv old mode 100644 new mode 100755 diff --git a/legacy/doc/S2snow.m b/legacy/doc/S2snow.m old mode 100644 new mode 100755 diff --git a/legacy/doc/castest_CESneige.m b/legacy/doc/castest_CESneige.m old mode 100644 new mode 100755 diff --git a/legacy/doc/html/S2snow.html b/legacy/doc/html/S2snow.html old mode 100644 new mode 100755 diff --git a/legacy/doc/html/S2snow_eq02512469557822599828.png b/legacy/doc/html/S2snow_eq02512469557822599828.png old mode 100644 new mode 100755 diff --git a/legacy/doc/html/S2snow_eq05316141687941017415.png b/legacy/doc/html/S2snow_eq05316141687941017415.png old mode 100644 new mode 100755 diff --git a/legacy/doc/html/S2snow_eq11519809210784707025.png b/legacy/doc/html/S2snow_eq11519809210784707025.png old mode 100644 new mode 100755 diff --git a/legacy/doc/html/castest_CESneige.html b/legacy/doc/html/castest_CESneige.html old mode 100644 new mode 100755 diff --git a/legacy/doc/html/castest_CESneige.png b/legacy/doc/html/castest_CESneige.png old mode 100644 new mode 100755 diff --git a/legacy/doc/html/castest_CESneige_01.png b/legacy/doc/html/castest_CESneige_01.png old mode 100644 new mode 100755 diff --git a/legacy/doc/html/castest_CESneige_02.png b/legacy/doc/html/castest_CESneige_02.png old mode 100644 new mode 100755 diff --git a/legacy/doc/html/castest_CESneige_03.png b/legacy/doc/html/castest_CESneige_03.png old mode 100644 new mode 100755 diff --git a/legacy/doc/load_demo_input.m b/legacy/doc/load_demo_input.m old mode 100644 new mode 100755 diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/python/s2snow/__init__.py b/python/s2snow/__init__.py old mode 100644 new mode 100755 diff --git a/python/s2snow/cloud_extraction.py b/python/s2snow/cloud_extraction.py old mode 100644 new mode 100755 diff --git a/python/s2snow/compute_NOBS.py b/python/s2snow/compute_NOBS.py old mode 100644 new mode 100755 diff --git a/python/s2snow/compute_SOD_SMOD.py b/python/s2snow/compute_SOD_SMOD.py old mode 100644 new mode 100755 diff --git a/python/s2snow/dem_builder.py b/python/s2snow/dem_builder.py old mode 100644 new mode 100755 diff --git a/python/s2snow/fsc_config.py b/python/s2snow/fsc_config.py old mode 100644 new mode 100755 index 8b30f2ef567084194c4c67c456dcd5ba151b7103..62e52e9fb8fb318fd392b0cfbca7d771eb609617 --- a/python/s2snow/fsc_config.py +++ b/python/s2snow/fsc_config.py @@ -407,38 +407,38 @@ class FscConfig: m_greend_band = mission_config.get("green_band", None) if m_greend_band is not None: - self.green_band_path = find_files(input_dir, m_greend_band)[0] + self.green_band_path = find_file(input_dir, m_greend_band) m_red_band = mission_config.get("red_band", None) if m_red_band is not None: - self.red_band_path = find_files(input_dir, m_red_band)[0] + self.red_band_path = find_file(input_dir, m_red_band) m_swir_band = mission_config.get("swir_band", None) if m_swir_band is not None: - self.swir_band_path = find_files(input_dir, m_swir_band)[0] + self.swir_band_path = find_file(input_dir, m_swir_band) self.green_band_no_band = mission_config.get("green_band_number", None) - self.red_band_no_band = mission_config.get("red_band_number", None) + self.red_band_no_band = mission_config.get("red_band_number", None) self.swir_band_no_band = mission_config.get("swir_band_number", None) m_cloud_mask = mission_config.get("cloud_mask", None) if m_cloud_mask is not None: - self.cloud_mask = find_files(input_dir, m_cloud_mask)[0] + self.cloud_mask = find_file(input_dir, m_cloud_mask) m_div_mask = mission_config.get("div_mask", None) if m_div_mask is not None: logging.debug("m_div_mask : %s", m_div_mask) - div_mask = find_files(input_dir, m_div_mask) + div_mask = find_file(input_dir, m_div_mask) if div_mask is not None: - self.div_mask = div_mask[0] - logging.debug("self.div_mask :%s",self.div_mask) + self.div_mask = div_mask + logging.debug("self.div_mask :%s", self.div_mask) m_dem = mission_config.get("dem", None) if m_dem is not None: logging.debug("m_dem : %s", m_dem) - dem_found = find_files(input_dir, m_dem) + dem_found = find_file(input_dir, m_dem) if dem_found is not None: - self.dem = dem_found[0] + self.dem = dem_found self.shadow_in_mask = mission_config.get("shadow_in_mask", None) self.shadow_out_mask = mission_config.get("shadow_out_mask", None) @@ -604,20 +604,18 @@ class FscConfig: return mission_key -def find_files(folder, pattern): +def find_file(folder, pattern): """ Search recursively into a folder to find a pattern match """ logging.debug("folder :%s", folder) logging.debug("pattern :%s", pattern) - matches = [] + match = None for root, dirs, files in os.walk(folder): for file in files: if re.match(pattern, file): logging.debug("match file :%s", file) - matches.append(os.path.join(root, file)) + match = os.path.join(root, file) + break - if len(matches) == 0: - matches = None - - return matches + return match diff --git a/python/s2snow/gdal_wrappers.py b/python/s2snow/gdal_wrappers.py old mode 100644 new mode 100755 diff --git a/python/s2snow/lis_constant.py b/python/s2snow/lis_constant.py old mode 100644 new mode 100755 index dc8f85c1fddb74cac101b34783e4a2e468dc2581..6491a59043593474342d017481314ac4aa961b82 --- a/python/s2snow/lis_constant.py +++ b/python/s2snow/lis_constant.py @@ -108,13 +108,14 @@ QCOG = "LIS_FSC_QCOG.tif" OUTPUT_DATES_FILE = "output_dates.txt" # Error codes -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 +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 +OUTPUT_UNDEFINED = 9 # Date Time format MUSCATE_DATETIME_FORMAT = "%Y%m%d-%H%M%S-%f" diff --git a/python/s2snow/lis_exception.py b/python/s2snow/lis_exception.py old mode 100644 new mode 100755 diff --git a/python/s2snow/mission_config.py b/python/s2snow/mission_config.py old mode 100644 new mode 100755 diff --git a/python/s2snow/otb_wrappers.py b/python/s2snow/otb_wrappers.py old mode 100644 new mode 100755 diff --git a/python/s2snow/parser.py b/python/s2snow/parser.py old mode 100644 new mode 100755 diff --git a/python/s2snow/qc_flags.py b/python/s2snow/qc_flags.py old mode 100644 new mode 100755 diff --git a/python/s2snow/resolution.py b/python/s2snow/resolution.py old mode 100644 new mode 100755 diff --git a/python/s2snow/snow_detector.py b/python/s2snow/snow_detector.py old mode 100644 new mode 100755 diff --git a/python/s2snow/snow_product.py b/python/s2snow/snow_product.py old mode 100644 new mode 100755 index 0c5b20ff0a6a1b8de3c34c637525faa194f897aa..1bdc435566c139595d7f0fac53c2ece529532d85 --- a/python/s2snow/snow_product.py +++ b/python/s2snow/snow_product.py @@ -52,6 +52,7 @@ class SnowProduct: self.product_path = absolute_filename name_splitted = self.product_name.split("_") platform = name_splitted[0] + logging.debug("platform : " + platform) # unzip input if zipped zip_product = absolute_filename.lower().endswith('.zip') @@ -77,16 +78,22 @@ class SnowProduct: self.acquisition_date = datetime.strptime(name_splitted[1], MUSCATE_DATETIME_FORMAT) self.tile_id = name_splitted[3] self.snow_mask = find_files(self.product_path, ".*_SNW_R2.(tif|TIF)") + if self.snow_mask is None: + self.snow_mask = find_files(self.product_path, ".*SNOW-FS.*C_.*(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) self.tile_id = name_splitted[3] self.snow_mask = find_files(self.product_path, ".*_SNW_XS.(tif|TIF)") + if self.snow_mask is None: + self.snow_mask = find_files(self.product_path, ".*SNOW-MSK_.*(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] self.snow_mask = find_files(self.product_path, ".*_SNW_XS.(tif|TIF)") + if self.snow_mask is None: + self.snow_mask = find_files(self.product_path, ".*SNOW-MSK_.*(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) @@ -104,7 +111,7 @@ class SnowProduct: raise UnknownPlatform(msg) if self.snow_mask is None: - self.snow_mask = find_files(self.product_path, "LIS_SEB") + self.snow_mask = find_files(self.product_path, "LIS_SEB*(tif|TIF)") if self.metadata_file is None: self.metadata_file = find_files(self.product_path, "LIS_METADATA.XML") diff --git a/python/s2snow/snow_synthesis.py b/python/s2snow/snow_synthesis.py old mode 100644 new mode 100755 diff --git a/python/s2snow/synthesis_config.py b/python/s2snow/synthesis_config.py old mode 100644 new mode 100755 diff --git a/python/s2snow/utils.py b/python/s2snow/utils.py old mode 100644 new mode 100755 diff --git a/python/s2snow/version.py b/python/s2snow/version.py old mode 100644 new mode 100755 diff --git a/python/setup.py b/python/setup.py old mode 100644 new mode 100755 diff --git a/python/setup.py.in b/python/setup.py.in old mode 100644 new mode 100755 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/src/ComputeCloudMask.cxx b/src/ComputeCloudMask.cxx old mode 100644 new mode 100755 diff --git a/src/ComputeContours.cxx b/src/ComputeContours.cxx old mode 100644 new mode 100755 diff --git a/src/ComputeNbPixels.cxx b/src/ComputeNbPixels.cxx old mode 100644 new mode 100755 diff --git a/src/ComputeSnowLine.cxx b/src/ComputeSnowLine.cxx old mode 100644 new mode 100755 diff --git a/src/ComputeSnowMask.cxx b/src/ComputeSnowMask.cxx old mode 100644 new mode 100755 diff --git a/src/histo_utils.cxx b/src/histo_utils.cxx old mode 100644 new mode 100755 diff --git a/src/histo_utils.h b/src/histo_utils.h old mode 100644 new mode 100755 diff --git a/src/itkNarySnowMaskImageFilter.h b/src/itkNarySnowMaskImageFilter.h old mode 100644 new mode 100755 diff --git a/src/itkUnaryCloudMaskImageFilter.h b/src/itkUnaryCloudMaskImageFilter.h old mode 100644 new mode 100755 diff --git a/src/otbStreamingHistogramMaskedVectorImageFilter.h b/src/otbStreamingHistogramMaskedVectorImageFilter.h old mode 100644 new mode 100755 diff --git a/src/otbStreamingHistogramMaskedVectorImageFilter.txx b/src/otbStreamingHistogramMaskedVectorImageFilter.txx old mode 100644 new mode 100755 diff --git a/styles/LIS.1.2_SEB_style_vector.qml b/styles/LIS.1.2_SEB_style_vector.qml old mode 100644 new mode 100755 diff --git a/styles/LIS_FSC_style_raster.qml b/styles/LIS_FSC_style_raster.qml old mode 100644 new mode 100755 diff --git a/styles/LIS_NDSI_style_raster.qml b/styles/LIS_NDSI_style_raster.qml old mode 100644 new mode 100755 diff --git a/styles/LIS_SEB_style_raster.qml b/styles/LIS_SEB_style_raster.qml old mode 100644 new mode 100755 diff --git a/styles/LIS_SEB_style_vector.qml b/styles/LIS_SEB_style_vector.qml old mode 100644 new mode 100755 diff --git a/styles/LIS_SEB_style_vector_qgis_3.4.qml b/styles/LIS_SEB_style_vector_qgis_3.4.qml old mode 100644 new mode 100755 diff --git a/styles/readme.md b/styles/readme.md old mode 100644 new mode 100755 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 301683910c16ebb5f3fae4e6de8f92c4b3c033aa..487b564139b3533e2fe1a5f0d589d2b07bdd4a7d 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -348,13 +348,6 @@ add_test(NAME s2_hysope2 -j ${DATA_TEST}/S2/hysope2/param.json -o ${OUTPUT_TEST}/hysope2 ) - -add_test(NAME s2_without_dem - COMMAND ${PYTHON_EXECUTABLE} - ${CMAKE_BINARY_DIR}/app/let_it_snow_fsc.py - -j ${DATA_TEST}/S2/s2_without_dem/param.json - -o ${OUTPUT_TEST}/s2_without_dem - ) add_test(NAME dem_builder_test COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/python/s2snow/dem_builder.py diff --git a/test/LIS_tests.md b/test/LIS_tests.md old mode 100644 new mode 100755 diff --git a/test/cloud_extraction_test.py b/test/cloud_extraction_test.py old mode 100644 new mode 100755 diff --git a/test/gdal_wrappers_test.py b/test/gdal_wrappers_test.py old mode 100644 new mode 100755 diff --git a/test/histo_utils_snow_fraction_test.cxx b/test/histo_utils_snow_fraction_test.cxx old mode 100644 new mode 100755 diff --git a/test/histo_utils_snowline_internal_test.cxx b/test/histo_utils_snowline_internal_test.cxx old mode 100644 new mode 100755 diff --git a/test/histo_utils_snowline_test.cxx b/test/histo_utils_snowline_test.cxx old mode 100644 new mode 100755 diff --git a/test/itkUnaryCloudMaskImageFilterTest.cxx b/test/itkUnaryCloudMaskImageFilterTest.cxx old mode 100644 new mode 100755 diff --git a/test/otb_wrappers_test.py b/test/otb_wrappers_test.py old mode 100644 new mode 100755 diff --git a/test/resolution_test.py b/test/resolution_test.py old mode 100644 new mode 100755 diff --git a/test/snow_detector_test.py b/test/snow_detector_test.py old mode 100644 new mode 100755 diff --git a/test/snow_synthesis_test.py b/test/snow_synthesis_test.py old mode 100644 new mode 100755