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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 9 04:51:37 PST 2017


Author: lucadelu
Date: 2017-01-09 04:51:37 -0800 (Mon, 09 Jan 2017)
New Revision: 70323

Modified:
   grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py
   grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py
Log:
r.modis.download: added capabilities to print info about the supported MODIS products

Modified: grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py
===================================================================
--- grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py	2017-01-09 12:05:33 UTC (rev 70322)
+++ grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py	2017-01-09 12:51:37 UTC (rev 70323)
@@ -288,13 +288,22 @@
         else:
             return self.returned()['suff']
 
+    def print_prods(self):
+        oldprod = self.prod
+        for key in self.products.keys():
+            print(key),
+            self.prod = key
+            print(self)
+        self.prod = oldprod
+
     def __str__(self):
         prod = self.returned()
-        string = "url: " + prod['url'] + ", folder: " + prod['folder']
+        string = "product: " + prod['prod'] + ", url: " + prod['url']
         if prod.keys().count('spec') == 1:
-            string += ", spectral subset: " + prod['spec']
+            string += ", spectral_subset: " + prod['spec']
         if prod.keys().count('spec_qa') == 1:
-            string += ", spectral subset qa:" + prod['spec_qa']
+            if prod['spec_qa'] != None:
+                string += ", spectral_subset_qa:" + prod['spec_qa']
         return string
 
 

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 12:05:33 UTC (rev 70322)
+++ grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py	2017-01-09 12:51:37 UTC (rev 70323)
@@ -33,6 +33,10 @@
 #% key: c
 #% description: Does not perform GDAL check on downloaded images
 #%end
+#%flag
+#% key: l
+#% description: List more info about the supported MODIS products
+#%end
 #%option G_OPT_F_INPUT
 #% key: settings
 #% label: Full path to settings file
@@ -159,6 +163,10 @@
     if not gisbase:
         grass.fatal(_('$GISBASE not defined'))
         return 0
+    if flags['l']:
+        prod = product()
+        prod.print_prods()
+        return 0
     # set username, password and folder if settings are insert by stdin
     if options['settings'] == '-':
         if options['folder'] != '':



More information about the grass-commit mailing list