From 46dd10cf13cf73be6773004a49ea8ebe9c3836fb Mon Sep 17 00:00:00 2001
From: pty <pierre.tysebaert@thalesgroup.com>
Date: Mon, 4 Jul 2022 10:01:00 +0200
Subject: [PATCH] DOI_URL added as a lis_constant

---
 python/s2snow/lis_constant.py   | 3 +++
 python/s2snow/snow_detector.py  | 4 ++--
 python/s2snow/snow_synthesis.py | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/python/s2snow/lis_constant.py b/python/s2snow/lis_constant.py
index 6491a590..79aa8470 100755
--- a/python/s2snow/lis_constant.py
+++ b/python/s2snow/lis_constant.py
@@ -121,3 +121,6 @@ OUTPUT_UNDEFINED = 9
 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"
+
+# DOI
+DOI_URL = "https://doi.org/10.24400/329360/F7Q52MNK"
diff --git a/python/s2snow/snow_detector.py b/python/s2snow/snow_detector.py
index b5b48a50..5079230c 100755
--- a/python/s2snow/snow_detector.py
+++ b/python/s2snow/snow_detector.py
@@ -40,7 +40,7 @@ from s2snow.lis_constant import N_GREEN, N_SWIR, N_RED, GDAL_OPT, LABEL_NO_DATA,
     NO_DATA_MASK, DEM_RESAMPLED, CLOUD_PASS1, HISTOGRAM, \
     SLOPE_MASK, GREEN, RED, SWIR, SNOW_PASS2, SNOW_PASS2_VEC, \
     SNOW_PASS3, SNOW_PASS3_VEC, SNOW_MASK, SNOW_ALL, NDSI, FSCTOC, SNOW_VEC, METADATA, SNOW_PASS1, TMP_DIR, \
-    MODE_SENTINEL2, MISSION_S2
+    MODE_SENTINEL2, MISSION_S2, DOI_URL
 
 from s2snow.qc_flags import edit_lis_fsc_qc_layers
 from s2snow.resolution import define_band_resolution, adapt_to_target_resolution
@@ -821,7 +821,7 @@ def create_metadata(final_mask_file, output_dir, product_id, zs):
 
     root = etree.Element("Source_Product")
     etree.SubElement(root, "PRODUCT_ID").text = product_id
-    etree.SubElement(root, "DOI").text = "https://doi.org/10.24400/329360/F7Q52MNK"
+    etree.SubElement(root, "DOI").text = DOI_URL
     egil = etree.SubElement(root, "Global_Index_List")
     etree.SubElement(egil, "QUALITY_INDEX", name='ZS').text = str(zs)
     etree.SubElement(
diff --git a/python/s2snow/snow_synthesis.py b/python/s2snow/snow_synthesis.py
index 6e4e89ac..805423d3 100755
--- a/python/s2snow/snow_synthesis.py
+++ b/python/s2snow/snow_synthesis.py
@@ -35,7 +35,7 @@ from otbApplication import ImagePixelType_uint8, ImagePixelType_uint16
 # Import python decorators for the different needed OTB applications
 from s2snow.compute_NOBS import compute_NOBS
 from s2snow.compute_SOD_SMOD import compute_SOD_SMOD
-from s2snow.lis_constant import TMP_DIR, OUTPUT_DATES_FILE
+from s2snow.lis_constant import TMP_DIR, OUTPUT_DATES_FILE, DOI_URL
 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 SnowProduct
@@ -200,7 +200,7 @@ def create_snow_annual_map_metadata(product_list, output_dir):
     metadata_path = op.join(output_dir, "LIS_METADATA.XML")
     logging.info("Metadata file: %s", metadata_path)
     root = etree.Element("INPUTS_LIST")
-    etree.SubElement(root, "DOI").text = "https://doi.org/10.24400/329360/F7Q52MNK"
+    etree.SubElement(root, "DOI").text = DOI_URL
     for product_path in product_list:
         logging.debug("Product path: {}".format(product_path))
         product_name = op.basename(str(product_path))
-- 
GitLab