[GRASS-SVN] r73919 - grass-addons/grass7/imagery/i.sentinel/i.sentinel.import

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 6 14:00:04 PST 2019


Author: neteler
Date: 2019-01-06 14:00:04 -0800 (Sun, 06 Jan 2019)
New Revision: 73919

Modified:
   grass-addons/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.py
Log:
i.sentinel.import addon: memory parameter added for speedup

Modified: grass-addons/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.py
===================================================================
--- grass-addons/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.py	2019-01-06 19:28:21 UTC (rev 73918)
+++ grass-addons/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.py	2019-01-06 22:00:04 UTC (rev 73919)
@@ -31,6 +31,15 @@
 #% description: File name pattern to import
 #% guisection: Filter
 #%end
+#%option
+#% key: memory
+#% type: integer
+#% required: no
+#% multiple: no
+#% label: Maximum memory to be used (in MB)
+#% description: Cache size for raster rows
+#% answer: 300
+#%end
 #%flag
 #% key: r
 #% description: Reproject raster data using r.import if needed
@@ -138,6 +147,7 @@
         if link:
             module = 'r.external'
         else:
+            memory = options['memory']
             if reproject:
                 module = 'r.import'
                 args['resample'] = 'bilinear'
@@ -151,7 +161,7 @@
                     gs.fatal(_('Projection of dataset does not appear to match current location. '
                                'Force reprojecting dataset by -r flag.'))
 
-            self._import_file(f, module, args)
+            self._import_file(f, module, memory, args)
 
     def _check_projection(self, filename):
         try:
@@ -191,13 +201,13 @@
 
         return ret
         
-    def _import_file(self, filename, module, args):
+    def _import_file(self, filename, module, memory, args):
         mapname = os.path.splitext(os.path.basename(filename))[0]
         gs.message(_('Processing <{}>...').format(mapname))
         if module == 'r.import':
             args['resolution_value'] = self._raster_resolution(filename)
         try:
-            gs.run_command(module, input=filename, output=mapname, **args)
+            gs.run_command(module, input=filename, output=mapname, memory=memory, **args)
             gs.raster_history(mapname)
         except CalledModuleError as e:
             pass # error already printed



More information about the grass-commit mailing list