Skip to content

Commit

Permalink
i.sentinel.import: added extent parameter
Browse files Browse the repository at this point in the history
With extent=region the import can be reduced to the current region rather than full scene import.
  • Loading branch information
neteler committed Dec 18, 2019
1 parent 45256e0 commit 452845c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Expand Up @@ -10,6 +10,10 @@ <h2>DESCRIPTION</h2>
reduced by the <b>pattern_file</b> option. In this option, a regular expression
for filtering the file names should be given, e.g. "MSIL2A.*T32VNR_2019" for
importing only level 2A products for tile T32VNR from 2019.
<p>
By default <em>i.sentinel.import</em> imports the full scene. Optionally, the
import can be reduced to the computational region extent with
<b>extent=region</b>.

<p>
Note that in the case that spatial reference system of input data differs
Expand Down
17 changes: 17 additions & 0 deletions grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.py
Expand Up @@ -42,6 +42,17 @@
#% guisection: Filter
#%end
#%option
#% key: extent
#% type: string
#% required: no
#% multiple: no
#% options: input,region
#% answer: input
#% description: Output raster map extent
#% descriptions: region;extent of current region;input;extent of input map
#% guisection: Filter
#%end
#%option
#% key: memory
#% type: integer
#% required: no
Expand Down Expand Up @@ -215,9 +226,15 @@ def import_products(self, reproject=False, link=False, override=False):
module = 'r.import'
args['resample'] = 'bilinear'
args['resolution'] = 'value'
args['extent'] = options['extent']
else:
module = 'r.in.gdal'
args['flags'] = 'o' if override else None
if options['extent'] == 'region':
if args['flags']:
args['flags'] += 'r'
else:
args['flags'] = 'r'

for f in self.files:
if not override and (link or (not link and not reproject)):
Expand Down

0 comments on commit 452845c

Please sign in to comment.