[GRASS-SVN] r68466 - grass/trunk/scripts/r.import

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 19 08:12:29 PDT 2016


Author: annakrat
Date: 2016-05-19 08:12:29 -0700 (Thu, 19 May 2016)
New Revision: 68466

Modified:
   grass/trunk/scripts/r.import/r.import.py
Log:
r.import: do not require output for estimating resolution

Modified: grass/trunk/scripts/r.import/r.import.py
===================================================================
--- grass/trunk/scripts/r.import/r.import.py	2016-05-19 12:33:31 UTC (rev 68465)
+++ grass/trunk/scripts/r.import/r.import.py	2016-05-19 15:12:29 UTC (rev 68466)
@@ -46,6 +46,7 @@
 #%end
 #%option G_OPT_R_OUTPUT
 #% description: Name for output raster map
+#% required: no
 #% guisection: Output
 #%end
 #%option
@@ -116,6 +117,9 @@
 #% label: Override projection check (use current location's projection)
 #% description: Assume that the dataset has the same projection as the current location
 #%end
+#%rules
+#% required: output,-e
+#%end
 
 import sys
 import os
@@ -139,7 +143,8 @@
         grass.try_rmdir(os.path.join(GISDBASE, TMPLOC))
     if SRCGISRC:
         grass.try_remove(SRCGISRC)
-    if TMP_REG_NAME:
+    if TMP_REG_NAME and grass.find_file(name=TMP_REG_NAME, element='vector',
+                                        mapset=grass.gisenv()['MAPSET'])['fullname']:
         grass.run_command('g.remove', type='vector', name=TMP_REG_NAME,
                           flags='f', quiet=True)
 
@@ -154,6 +159,8 @@
     bands = options['band']
     tgtres = options['resolution']
     title = options["title"]
+    if flags['e'] and not output:
+        output = 'rimport_tmp'  # will be removed with the entire tmp location
     if options['resolution_value']:
         if tgtres != 'value':
             grass.fatal(_("To set custom resolution value, select 'value' in resolution option"))



More information about the grass-commit mailing list