[GRASS-SVN] r74460 - grass-addons/grass7/raster/r.in.usgs

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 3 11:02:31 PDT 2019


Author: annakrat
Date: 2019-05-03 11:02:31 -0700 (Fri, 03 May 2019)
New Revision: 74460

Modified:
   grass-addons/grass7/raster/r.in.usgs/r.in.usgs.py
Log:
r.in.usgs: when import fails, continue with the rest

Modified: grass-addons/grass7/raster/r.in.usgs/r.in.usgs.py
===================================================================
--- grass-addons/grass7/raster/r.in.usgs/r.in.usgs.py	2019-05-03 12:19:33 UTC (rev 74459)
+++ grass-addons/grass7/raster/r.in.usgs/r.in.usgs.py	2019-05-03 18:02:31 UTC (rev 74460)
@@ -562,7 +562,6 @@
         # create variables for use in GRASS GIS import process
         LT_file_name = os.path.basename(t)
         LT_layer_name = os.path.splitext(LT_file_name)[0]
-        patch_names.append(LT_layer_name)
         in_info = ("Importing and reprojecting {0}...").format(LT_file_name)
         gscript.info(in_info)
         # import to GRASS GIS
@@ -570,12 +569,14 @@
             gscript.run_command('r.import', input=t, output=LT_layer_name,
                                 resolution='value', resolution_value=product_resolution,
                                 extent="region", resample=product_interpolation)
-            # do not remove by default with NAIP, there are no zip files
-            if gui_product != 'naip' or not gui_k_flag:
-                cleanup_list.append(t)
         except CalledModuleError:
             in_error = ("Unable to import '{0}'").format(LT_file_name)
-            gscript.fatal(in_error)
+            gscript.warning(in_error)
+        else:
+            patch_names.append(LT_layer_name)
+        # do not remove by default with NAIP, there are no zip files
+        if gui_product != 'naip' or not gui_k_flag:
+            cleanup_list.append(t)
 
     # if control variables match and multiple files need to be patched,
     # check product resolution, run r.patch
@@ -583,7 +584,7 @@
     # Check that downloaded files match expected count
     completed_tiles_count = len(local_tile_path_list)
     if completed_tiles_count == tiles_needed_count:
-        if completed_tiles_count > 1:
+        if len(patch_names) > 1:
             try:
                 gscript.use_temp_region()
                 # set the resolution
@@ -612,7 +613,7 @@
                                             name=patch_names, flags='f')
             except CalledModuleError:
                 gscript.fatal("Unable to patch tiles.")
-        elif completed_tiles_count == 1:
+        elif len(patch_names) == 1:
             if gui_product == 'naip':
                 for i in ('1', '2', '3', '4'):
                     gscript.run_command('g.rename', raster=(patch_names[0] + '.' + i, gui_output_layer + '.' + i))



More information about the grass-commit mailing list