From ff44cfbe8fb5c1f86441be027971021b89beaae1 Mon Sep 17 00:00:00 2001 From: Hamed Elgizery Date: Wed, 28 Aug 2024 02:12:45 +0300 Subject: [PATCH 1/5] Use title instead of identifier as the eodag migration --- .../i.sentinel.coverage.py | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) mode change 100644 => 100755 src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py diff --git a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py old mode 100644 new mode 100755 index 41a2c45ec9..e9f4ae89ce --- a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py +++ b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py @@ -258,6 +258,7 @@ def main(): if resp[0] != b"": s_list = resp[0].decode("utf-8").strip().splitlines() else: + # Experimental version warning needs to be removed from i.eodag if set(resp) == {b""}: grass.fatal(_("No products found")) else: @@ -265,7 +266,7 @@ def main(): for i in range(0, len(resp)): error_msg += resp[i].decode("utf-8") grass.fatal(_("Error using i.sentinel.download: {}").format(error_msg)) - name_list_tmp = [x.split(" ")[1] for x in s_list] + name_list_tmp = [x.split(" ")[0] for x in s_list] else: name_list_tmp = options["names"].split(",") name_list = [] @@ -279,13 +280,10 @@ def main(): grass.run_command( "i.sentinel.download", settings=settings, - map=area, - start=start_day, - end=end_day, footprints=fpi, producttype=producttype, - query="identifier=%s" % name, - flags="lb", + id=name, + flags="l", quiet=True, ) name_list.append(name) @@ -310,30 +308,31 @@ def main(): grass.run_command( "v.db.update", map=temp_overlay, - column="a_identifier", - query_column='a_identifier || "+" ' + "|| b_identifier", - where="a_identifier NOT NULL AND " + "b_identifier NOT NULL", + column="a_title", + query_column='a_title || "+" ' + "|| b_title", + where="a_title NOT NULL AND " + "b_title NOT NULL", quiet=True, ) grass.run_command( "v.db.update", map=temp_overlay, - column="a_identifier", - query_column="b_identifier", - where="a_identifier IS NULL", + column="a_title", + query_column="b_title", + where="a_title IS NULL", quiet=True, ) grass.run_command( "v.db.renamecolumn", map=temp_overlay, - column="a_identifier,identifier", + column="a_title,title", quiet=True, ) columns_dict = grass.parse_command("v.info", map=temp_overlay, flags="c") drop_columns = [ col.split("|")[1] for col in columns_dict - if col.split("|")[1] not in ["cat", "identifier"] + if col.split("|")[1] + not in ["cat", "title"] # What does cat refer to here? ] grass.run_command( "v.db.dropcolumn", map=temp_overlay, columns=drop_columns, quiet=True @@ -366,7 +365,7 @@ def main(): # list of scenes that actually intersect with bbox name_list_updated_tmp = list( grass.parse_command( - "v.db.select", map=fps_in_area, column="a_identifier", flags="c" + "v.db.select", map=fps_in_area, column="a_title", flags="c" ).keys() ) From 838fd9244ec2c9de1823e145d95943066c3be145 Mon Sep 17 00:00:00 2001 From: Hamed Elgizery Date: Wed, 28 Aug 2024 02:13:33 +0300 Subject: [PATCH 2/5] Fix manual example and remove exclusion between names and producttype options --- .../i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html | 2 +- .../i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html index 524a7d9978..7c85a74bc7 100644 --- a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html +++ b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html @@ -51,7 +51,7 @@

Check Sentinel-2 scenes by names

 i.sentinel.coverage settings=credentials.txt output=s2names.txt \
   names=S2A_MSIL2A_20200104T024111_N0213_R089_T49MGU_20200104T061337,S2B_MSIL2A_20200129T023939_N0213_R089_T49MGU_20200201T153252 \
-  producttype=S2MSI2A clouds=20 minpercent=95 area=mangkawuk
+  producttype=S2MSI2A minpercent=95 area=mangkawuk
 

Use retrieved Sentinel-2 scene names for import

diff --git a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py index e9f4ae89ce..acc30482ad 100755 --- a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py +++ b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py @@ -96,7 +96,7 @@ # %rules # % collective: start,end -# % excludes: names,start,end,clouds,producttype +# % excludes: names,start,end,clouds # %end From d12ecfcf39486613e9abc4ce60bed143abe377fe Mon Sep 17 00:00:00 2001 From: Hamed Elgizery Date: Sat, 12 Oct 2024 17:40:45 +0300 Subject: [PATCH 3/5] Update manual --- .../i.sentinel.coverage/i.sentinel.coverage.html | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html index 7c85a74bc7..fce3a1b8a4 100644 --- a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html +++ b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html @@ -10,16 +10,13 @@

EXAMPLES

Check Sentinel-1 scenes by region, start and end time

-Note that only the last 12 months of Sentinel data are online available -ESA Hub, older scenes are stored in the Long Term Archive (LTA) and -cannot be retrieved immediately. The example is based on the North Carolina -dataset: +The example is based on the North Carolina dataset:
 # extract Durham (NC) county
 v.extract input=boundary_county output=county_durham where="NAME = 'DURHAM'"
 
-# simplify geometry (needed for ESA Hub)
+# simplify geometry
 v.generalize input=county_durham output=county_durham_dp1000 method=douglas threshold=1000
 
 # search for SLC scenes in certain period of time
@@ -29,16 +26,13 @@ 

Check Sentinel-1 scenes by region, start and end time

Check Sentinel-2 scenes by region, cloud coverage, start and end time

-Note that only the last 12 months of Sentinel data are online available -ESA Hub, older scenes are stored in the Long Term Archive (LTA) and -cannot be retrieved immediately. The example is based on the North Carolina -dataset: +The example is based on the North Carolina dataset:
 # extract Durham (NC) county
 v.extract input=boundary_county output=county_durham where="NAME = 'DURHAM'"
 
-# simplify geometry (needed for ESA Hub)
+# simplify geometry
 v.generalize input=county_durham output=county_durham_dp1000 method=douglas threshold=1000
 
 # search for L2A scenes with minimal clouds in certain period of time

From 2b10932298b7ad46ba61583a04a44382b878b5fc Mon Sep 17 00:00:00 2001
From: Hamed Elgizery 
Date: Sat, 12 Oct 2024 17:41:37 +0300
Subject: [PATCH 4/5] Update producttype options

---
 .../i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py
index acc30482ad..b65cf474bb 100755
--- a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py
+++ b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py
@@ -56,7 +56,7 @@
 # % type: string
 # % description: Sentinel product type to filter
 # % required: no
-# % options: SLC,GRD,OCN,S2MSI1C,S2MSI2A,S2MSI2Ap
+# % options: SLC,GRD,OCN,S2MSI1C,S2MSI2A
 # % answer: S2MSI2A
 # % guisection: Filter
 # %end
@@ -218,7 +218,7 @@ def main():
         grass.fatal(_("Vector map <{}> not found").format(area))
     producttype = options["producttype"]
 
-    grass.message(_("Retrieving Sentinel footprints from ESA hub ..."))
+    grass.message(_("Retrieving Sentinel footprints from CDSE ..."))
     fps = "tmp_fps_%s" % str(os.getpid())
     rm_vectors.append(fps)
 
@@ -331,8 +331,7 @@ def main():
             drop_columns = [
                 col.split("|")[1]
                 for col in columns_dict
-                if col.split("|")[1]
-                not in ["cat", "title"]  # What does cat refer to here?
+                if col.split("|")[1] not in ["cat", "title"]
             ]
             grass.run_command(
                 "v.db.dropcolumn", map=temp_overlay, columns=drop_columns, quiet=True

From 75e0f92921caeecf75e4e99a3687f463df412d1c Mon Sep 17 00:00:00 2001
From: Hamed Elgizery 
Date: Sat, 12 Oct 2024 17:51:58 +0300
Subject: [PATCH 5/5] Add clouds to third example

---
 .../i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html     | 2 +-
 .../i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py       | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html
index fce3a1b8a4..1f39acd6f1 100644
--- a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html
+++ b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.html
@@ -45,7 +45,7 @@ 

Check Sentinel-2 scenes by names

 i.sentinel.coverage settings=credentials.txt output=s2names.txt \
   names=S2A_MSIL2A_20200104T024111_N0213_R089_T49MGU_20200104T061337,S2B_MSIL2A_20200129T023939_N0213_R089_T49MGU_20200201T153252 \
-  producttype=S2MSI2A minpercent=95 area=mangkawuk
+  producttype=S2MSI2A clouds=20 minpercent=95 area=mangkawuk
 

Use retrieved Sentinel-2 scene names for import

diff --git a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py index b65cf474bb..f6f8e6c01c 100755 --- a/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py +++ b/src/imagery/i.sentinel/i.sentinel.coverage/i.sentinel.coverage.py @@ -258,7 +258,6 @@ def main(): if resp[0] != b"": s_list = resp[0].decode("utf-8").strip().splitlines() else: - # Experimental version warning needs to be removed from i.eodag if set(resp) == {b""}: grass.fatal(_("No products found")) else: