[GRASS-SVN] r70311 - in grass-addons/grass7/raster/r.modis: r.modis.download r.modis.import

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 9 02:40:12 PST 2017


Author: lucadelu
Date: 2017-01-09 02:40:12 -0800 (Mon, 09 Jan 2017)
New Revision: 70311

Modified:
   grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py
   grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py
Log:
r.modis: try to fix error in compilation

Modified: grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py
===================================================================
--- grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py	2017-01-09 09:42:35 UTC (rev 70310)
+++ grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py	2017-01-09 10:40:12 UTC (rev 70311)
@@ -91,10 +91,7 @@
     grass.fatal("Not able to find the modis library directory.")
 sys.path.append(path)
 
-from rmodislib import product
-from downmodis import downModis
 
-
 def check(home):
     """ Check if a folder it is writable by the user that launch the process
     """
@@ -152,6 +149,11 @@
 
 # main function
 def main():
+    try:
+        from rmodislib import product
+        from downmodis import downModis
+    except:
+        grass.fatal("r.modis library is not installed")
     # check if you are in GRASS
     gisbase = os.getenv('GISBASE')
     if not gisbase:

Modified: grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py
===================================================================
--- grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py	2017-01-09 09:42:35 UTC (rev 70310)
+++ grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py	2017-01-09 10:40:12 UTC (rev 70311)
@@ -96,11 +96,6 @@
     grass.fatal("Not able to find the modis library directory.")
 sys.path.append(path)
 
-# try to import pymodis (modis) and some classes for r.modis.download
-from rmodislib import resampling, product, projection, get_proj
-from convertmodis import convertModis, createMosaic
-from convertmodis_gdal import createMosaicGDAL, convertModisGDAL
-from parsemodis import parseModis
 
 class grassParseModis:
     """Class to reproduce parseModis class when VRT is used for mosaic
@@ -439,6 +434,15 @@
 
 
 def main():
+
+    try:
+        # try to import pymodis (modis) and some classes for r.modis.download
+        from rmodislib import resampling, product, projection, get_proj
+        from convertmodis import convertModis, createMosaic
+        from convertmodis_gdal import createMosaicGDAL, convertModisGDAL
+        from parsemodis import parseModis
+    except:
+        grass.fatal("r.modis library is not installed")
     # check if you are in GRASS
     gisbase = os.getenv('GISBASE')
     if not gisbase:



More information about the grass-commit mailing list