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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 22 15:05:27 PDT 2017


Author: lucadelu
Date: 2017-05-22 15:05:27 -0700 (Mon, 22 May 2017)
New Revision: 71110

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.download: added new product; fixed library import error messages

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-05-22 22:04:16 UTC (rev 71109)
+++ grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py	2017-05-22 22:05:27 UTC (rev 71110)
@@ -50,7 +50,7 @@
 #% label: Name of MODIS product(s)
 #% multiple: yes
 #% required: no
-#% options: lst_terra_daily_1000, lst_aqua_daily_1000, lst_terra_eight_1000, lst_aqua_eight_1000, lst_terra_daily_6000, lst_aqua_daily_6000, ndvi_terra_sixteen_250, ndvi_aqua_sixteen_250, ndvi_terra_sixteen_500, ndvi_aqua_sixteen_500, ndvi_terra_sixteen_1000, ndvi_aqua_sixteen_1000, ndvi_terra_sixteen_5600, ndvi_aqua_sixteen_5600, snow_terra_daily_500, snow_aqua_daily_500, snow_terra_eight_500, snow_aqua_eight_500, surfreflec_terra_daily_500, surfreflec_aqua_daily_500, surfreflec_terra_eight_500, surfreflec_aqua_eight_500, water_terra_250
+#% options: lst_terra_daily_1000, lst_aqua_daily_1000, lst_terra_eight_1000, lst_aqua_eight_1000, lst_terra_daily_5600, lst_aqua_daily_5600, lst_terra_monthly_5600, lst_aqua_monthly_5600, ndvi_terra_sixteen_250, ndvi_aqua_sixteen_250, ndvi_terra_sixteen_500, ndvi_aqua_sixteen_500, ndvi_terra_sixteen_1000, ndvi_aqua_sixteen_1000, ndvi_terra_sixteen_5600, ndvi_aqua_sixteen_5600, snow_terra_daily_500, snow_aqua_daily_500, snow_terra_eight_500, snow_aqua_eight_500, surfreflec_terra_daily_500, surfreflec_aqua_daily_500, surfreflec_terra_eight_500, surfreflec_aqua_eight_500, water_terra_250
 #% answer: lst_terra_daily_1000
 #%end
 #%option
@@ -156,9 +156,12 @@
 def main():
     try:
         from rmodislib import product
+    except:
+        grass.fatal("r.modis library is not installed")
+    try:
         from pymodis.downmodis import downModis
     except:
-        grass.fatal("r.modis library is not installed")
+        grass.fatal("pymodis 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-05-22 22:04:16 UTC (rev 71109)
+++ grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py	2017-05-22 22:05:27 UTC (rev 71110)
@@ -301,7 +301,10 @@
             if target != basedir:
                 shutil.move(name, target)
         if listfile:
-            fdata = data + timedelta(prod['days'])
+            days = prod['days']
+            fdata = data + timedelta(days)
+            if days == 31:
+                fdata = datetime(fdata.year, fdata.month, 1)
             listfile.write("{name}|{sd}|{fd}\n".format(name=basename,
                                                        sd=data.strftime("%Y-%m-%d"),
                                                        fd=fdata.strftime("%Y-%m-%d")))



More information about the grass-commit mailing list