[GRASS-SVN] r74359 - grass-addons/grass7/imagery/i.sentinel/i.sentinel.download
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 9 11:10:24 PDT 2019
Author: martinl
Date: 2019-04-09 11:10:24 -0700 (Tue, 09 Apr 2019)
New Revision: 74359
Modified:
grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.html
grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py
Log:
i.sentinel.download: implement query option (thanks to MarkusN for initial patch)
Modified: grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.html
===================================================================
--- grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.html 2019-04-09 09:07:30 UTC (rev 74358)
+++ grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.html 2019-04-09 18:10:24 UTC (rev 74359)
@@ -79,6 +79,13 @@
Sentinel-2 data, maximum <b>clouds</b> cover percentage.
<p>
+Extra search keywords can be specified with <b>query</b>. Multiple keywords
+can be listed separated with comma (e.g. 'polarisationmode=HH,orbitdirection=Ascending').
+Note that ESA maintains a
+<a href="https://scihub.copernicus.eu/twiki/do/view/SciHubUserGuide/FullTextSearch">list of valid search keywords</a>
+that can be used with <b>query</b>.
+
+<p>
In case a Sentinel data download was interrupted, <em>i.sentinel.download</em>
will continue to download once the command is restarted and the partially
downloaded file (with <tt>.incomplete</tt> file extention) still present.
Modified: grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py
===================================================================
--- grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py 2019-04-09 09:07:30 UTC (rev 74358)
+++ grass-addons/grass7/imagery/i.sentinel/i.sentinel.download/i.sentinel.download.py 2019-04-09 18:10:24 UTC (rev 74359)
@@ -89,6 +89,12 @@
#% guisection: Filter
#%end
#%option
+#% key: query
+#% type: string
+#% description: Extra search keywords to use in the query
+#% guisection: Filter
+#%end
+#%option
#% key: uuid
#% type: string
#% multiple: yes
@@ -117,7 +123,7 @@
#%end
#%rules
#% required: output,-l
-#% excludes: uuid,map,area_relation,clouds,producttype,start,end,limit,sort,order
+#% excludes: uuid,map,area_relation,clouds,producttype,start,end,limit,query,sort,order
#%end
import os
@@ -176,7 +182,7 @@
self._products_df_sorted = None
def filter(self, area, area_relation,
- clouds=None, producttype=None, limit=None,
+ clouds=None, producttype=None, limit=None, query={},
start=None, end=None, sortby=[], asc=True):
args = {}
if clouds:
@@ -195,9 +201,18 @@
end = 'NOW'
else:
end = end.replace('-', '')
+ if query:
+ redefined = [value for value in args.keys() if value in query.keys()]
+ if redefined:
+ gs.warning("Query overwrites defined options ({})".format(
+ ','.join(redefined)
+ ))
+ args.update(query)
+ gs.debug("Query: area={} area_relation={} date=({}, {}) args={}".format(
+ area, area_relation, start, end, args
+ ), debug=1)
products = self._api.query(
area=area, area_relation=area_relation,
-
date=(start, end),
**args
)
@@ -388,11 +403,17 @@
if options['uuid']:
downloader.set_uuid(options['uuid'].split(','))
else:
+ query = {}
+ if options['query']:
+ for item in options['query'].split(','):
+ k, v = item.split('=')
+ query[k] = v
downloader.filter(area=map_box,
area_relation=options['area_relation'],
clouds=options['clouds'],
producttype=options['producttype'],
limit=options['limit'],
+ query=query,
start=options['start'],
end=options['end'],
sortby=sortby,
More information about the grass-commit
mailing list