From 06a09dcdea6c4db330c50431e08e83722d5ec7ff Mon Sep 17 00:00:00 2001
From: Lozac'h Loic <loic.lozach@irstea.fr>
Date: Tue, 21 Nov 2023 12:17:32 +0100
Subject: [PATCH] Update Dataspace Copernicus Download

---
 apply-conf.sh                                 |  6 +---
 config.ini                                    |  6 +---
 readme.md                                     | 30 +++++++++----------
 theiacesprodapp/backend/service/download.py   |  6 ++--
 .../service/resources/user_conf.yml.model     |  6 ----
 5 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/apply-conf.sh b/apply-conf.sh
index 9632d64..b79e73b 100755
--- a/apply-conf.sh
+++ b/apply-conf.sh
@@ -13,9 +13,5 @@ source <(cat ${CONF}  | sed -e '/^#/d;/^\s*$/d' -e "s/'/'\\\''/g" -e "s/=\(.*\)/
 
 sed -i "s|SCIHUB_LOGIN|${SCIHUB_LOGIN}|" ${EOYML}
 sed -i "s|SCIHUB_PASSWD|${SCIHUB_PASSWD}|" ${EOYML}
-sed -i "s|PEPS_LOGIN|${PEPS_LOGIN}|" ${EOYML}
-sed -i "s|PEPS_PASSWD|${PEPS_PASSWD}|" ${EOYML}
 sed -i "s|THEIA_LOGIN|${THEIA_LOGIN}|" ${EOYML}
-sed -i "s|THEIA_PASSWD|${THEIA_PASSWD}|" ${EOYML}
-# sed -i "sµUSGS_LOGINµ${USGS_LOGIN}µ" ${EOYML}
-# sed -i "sµUSGS_PASSWDµ${USGS_PASSWD}µ" ${EOYML}
\ No newline at end of file
+sed -i "s|THEIA_PASSWD|${THEIA_PASSWD}|" ${EOYML}
\ No newline at end of file
diff --git a/config.ini b/config.ini
index 6a9061b..a7395e9 100644
--- a/config.ini
+++ b/config.ini
@@ -3,14 +3,10 @@ DATAPATH=
 #directory to save database
 DBPATH=
 
-#SCIHUB credentials
+#Copernicus Dataspace credentials
 SCIHUB_LOGIN=
 SCIHUB_PASSWD=
 
-#PEPS credentials
-PEPS_LOGIN=
-PEPS_PASSWD=
-
 #THEIA credentials
 THEIA_LOGIN=
 THEIA_PASSWD=
diff --git a/readme.md b/readme.md
index a04962d..f7144f5 100644
--- a/readme.md
+++ b/readme.md
@@ -29,8 +29,7 @@ user@machine:~/theiacesprod$ git clone https://gitlab.irstea.fr/loic.lozach/thei
 user@machine:~/theiacesprod$ gedit config.ini
 ```
 Dans le dossier projet, ouvrir le fichier config.ini et modifier les valeurs des variables DATAPATH et DBPATH, pour le dossier d'accès à vos données et le dossier de sauvegarde de la base de données, ainsi que les logins et mots de passe de vos comptes sur les sites distributeurs des images SENTINEL: 
-- SCIHUB : [Copernicus Open Access Hub](https://scihub.copernicus.eu/dhus/#/home)
-- PEPS : [Plateforme d'Exploitation des Produits Sentinel](https://peps.cnes.fr/rocket/#/home)
+- SCIHUB : [The Copernicus Data Space ](https://dataspace.copernicus.eu/)
 - THEIA : [Produits à valeur ajoutée et algorithmes pour les surfaces continentales](https://theia.cnes.fr/atdistrib/rocket/#/home)
 
 A l’intérieur de l’image docker, votre répertoire de données DATAPATH sera accessible dans /data.
@@ -196,37 +195,36 @@ usage: download_service.py [-h] {eodag,cds} ...
 Download services
 
 positional arguments:
-  {eodag,cds}  Choose server
-    eodag      Download Sentinel 1 and 2 through Eodag API
-    cds        Download ERA5 temperature image file according to S1 dates
+  {eodag,dataspace}  Choose server
+    eodag            Download Sentinel2-L3A (over FRANCE) through Eodag API with Theia provider
+    dataspace        Download Sentinel1-GRD and Sentinel2-L2A with Copernicus Dataspace SentinelHub
 ```
 
 Eodag is an API to wrap multiple imagery provider.
 ```
 otbuser@39a616d684e8:/data$ download_service.py eodag -h
-usage: download_service.py eodag [-h] -downdir DOWNDIR [-prod {0,1,2}] -tile TILE -sd SD -ed ED
+usage: download_service.py eodag [-h] -downdir DOWNDIR -tile TILE -sd SD -ed ED
 
 optional arguments:
   -h, --help        show this help message and exit
   -downdir DOWNDIR  Download directory
-  -prod {0,1,2}     Product type to download, choices 0=S1-GRD,1=S2-L2A,2=S2-L3A (FRANCE)
   -tile TILE        S2 Tile name, ex. T30UVU
   -sd SD            Starting date S1, ex. 2020-08-31
   -ed ED            Ending date S1, ex. 2020-09-31
 ```
 
-CDS (Climate Data Store) is used for Freeze Detection processes
+Copernicus Dataspace 
 ```
-otbuser@39a616d684e8:/data$ download_service.py cds -h
-usage: download_service.py cds [-h] -s1orthodir S1ORTHODIR [-gap {3m,6d}] -outdir OUTDIR
+otbuser@39a616d684e8:/data$ download_service.py dataspace -h
+usage: download_service.py dataspace [-h] -downdir DOWNDIR [-prod {s1,s2}] -tile TILE -sd SD -ed ED
 
 optional arguments:
-  -h, --help            show this help message and exit
-  -s1orthodir S1ORTHODIR
-                        Orthorectified Sentinel1 directory
-  -gap {3m,6d}          [Optional] Query ERA5-Land reanalysis collection with 3 month gap (default
-                        '3m') OR ERA5 basic reanalysis collection with 6 days gap ('6d')
-  -outdir OUTDIR        Output directory
+  -h, --help        show this help message and exit
+  -downdir DOWNDIR  Download directory
+  -prod {s1,s2}     Product type to download, choices s1=S1-GRD, s2=S2-L2A
+  -tile TILE        S2 Tile name, ex. T30UVU
+  -sd SD            Starting date S1, ex. 2020-08-31
+  -ed ED            Ending date S1, ex. 2020-09-31
 ```
 
 ## Calibration Service
diff --git a/theiacesprodapp/backend/service/download.py b/theiacesprodapp/backend/service/download.py
index 556c715..84b2876 100755
--- a/theiacesprodapp/backend/service/download.py
+++ b/theiacesprodapp/backend/service/download.py
@@ -41,9 +41,9 @@ class SentinelEodag():
             if yaml_content["scihub"]["api"]["credentials"]["username"] == "":
                 logger.error(f"Credentials not set for scihub provider in resources/user_conf.yml")
                 raise
-            if yaml_content["peps"]["auth"]["credentials"]["username"] == "":
-                logger.error(f"Credentials not set for peps provider in resources/user_conf.yml")
-                raise
+            # if yaml_content["peps"]["auth"]["credentials"]["username"] == "":
+            #     logger.error(f"Credentials not set for peps provider in resources/user_conf.yml")
+            #     raise
             if yaml_content["theia"]["auth"]["credentials"]["ident"] == "":
                 logger.error(f"Credentials not set for theia provider in resources/user_conf.yml")
                 raise
diff --git a/theiacesprodapp/backend/service/resources/user_conf.yml.model b/theiacesprodapp/backend/service/resources/user_conf.yml.model
index cb8c427..da83090 100644
--- a/theiacesprodapp/backend/service/resources/user_conf.yml.model
+++ b/theiacesprodapp/backend/service/resources/user_conf.yml.model
@@ -23,12 +23,6 @@ scihub:
             password: 'SCIHUB_PASSWD'
         endpoint: https://apihub.copernicus.eu/apihub/
         extract: False
-peps:
-    priority: 1
-    auth:
-        credentials:
-            username: PEPS_LOGIN
-            password: 'PEPS_PASSWD'
 theia:
     priority: 1
     auth:
-- 
GitLab