[GRASS-SVN] r46726 - grass-addons/grass7/raster/r.modis/libmodis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 16 19:46:32 EDT 2011


Author: lucadelu
Date: 2011-06-16 16:46:32 -0700 (Thu, 16 Jun 2011)
New Revision: 46726

Modified:
   grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py
Log:
add function to rmodislib.product function to return a product from a MODIS code (e.g. MOD11A1)

Modified: grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py
===================================================================
--- grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py	2011-06-16 13:58:43 UTC (rev 46725)
+++ grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py	2011-06-16 23:46:32 UTC (rev 46726)
@@ -19,7 +19,7 @@
 class product:
     """Definition of modis product with url and path in the ftp server
     """
-    def __init__(self,value):
+    def __init__(self,value = None):
         urlbase = 'e4ftl01u.ecs.nasa.gov'
         usrsnow = 'n4ftl01u.ecs.nasa.gov'
 	self.prod = value
@@ -37,6 +37,14 @@
     def returned(self):
 	return self.products[self.prod]
 
+    def fromcode(self,code):
+        import string
+        for k,v in self.products.iteritems():
+          if string.find(v['folder'],code) != -1:
+            return self.products[k]
+        return "The code insert is not supported yet. Can you ask to the dev "\
+               + "mailing list for a support in the future"
+
     def __str__(self):
 	prod = self.returned()
 	string = "url: " + prod['url'] + ", folder: " + prod['folder'] + \



More information about the grass-commit mailing list