From 9b4684beef2fc7cfc8e01e76897b8a7003870e9a Mon Sep 17 00:00:00 2001
From: "(no author)" <(no author)@8a9318a1-56ba-4d59-b755-99d26321be01>
Date: Fri, 13 Jan 2012 22:33:55 +0000
Subject: [PATCH] updates to the io module

git-svn-id: https://svn.ssec.wisc.edu/repos/glance/trunk@158 8a9318a1-56ba-4d59-b755-99d26321be01
---
 pyglance/glance/io.py | 51 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/pyglance/glance/io.py b/pyglance/glance/io.py
index 8f35d59..4f24b82 100644
--- a/pyglance/glance/io.py
+++ b/pyglance/glance/io.py
@@ -103,6 +103,7 @@ class hdf(SD):
         # get the variable object and use it to
         # get our raw data and scaling info
         variable_object = self.get_variable_object(name)
+        #print ("****** variable object gotten")
         raw_data_copy = variable_object[:]
         #print ("****** raw data loaded")
         try :
@@ -210,6 +211,18 @@ class hdf(SD):
             toReturn = temp_attributes[attributeName]
         
         return toReturn
+    
+    def get_global_attribute(self, attributeName) :
+        """
+        returns the value of a global attribute if it is available or None
+        """
+        
+        toReturn = None
+        
+        if attributeName in self.attributes() :
+            toReturn = self.attributes()[attributeName]
+        
+        return toReturn
 
 class nc(CDF):
     """wrapper for NetCDF3/4/opendap dataset for comparison
@@ -390,8 +403,6 @@ class nc(CDF):
         
         return toReturn
     
-    # Note: this function is not yet fully supported by the io module
-    # TODO, add this function to other io classes
     def get_global_attribute(self, attributeName) :
         """
         returns the value of a global attribute if it is available or None
@@ -555,6 +566,18 @@ class h5(object):
             toReturn = temp_attrs[attributeName]
         
         return toReturn
+    
+    def get_global_attribute(self, attributeName) :
+        """
+        returns the value of a global attribute if it is available or None
+        """
+        
+        toReturn = None
+        
+        if attributeName in self._h5.attrs :
+            toReturn = self._h5.attrs[attributeName]
+        
+        return toReturn
 
 
 
@@ -665,6 +688,18 @@ class aeri(object):
         LOG.warn('Glance does not yet support attribute retrieval in AERI files. None will be used.')
         
         return toReturn
+    
+    def get_global_attribute(self, attributeName) :
+        """
+        returns the value of a global attribute if it is available or None
+        """
+        
+        toReturn = None
+        
+        # TODO
+        LOG.warn('Glance does not yet support attribute retrieval in AERI files. None will be used.')
+        
+        return toReturn
 
 # handle the variety of file suffixes by building aliases to aeri class
 cxs = rnc = cxv = csv = spc = sum = uvs = aeri
@@ -768,6 +803,18 @@ class jpss_adl(object):
         LOG.warn('Glance does not yet support attribute retrieval in JPSS ADL files. None will be used.')
         
         return toReturn
+    
+    def get_global_attribute(self, attributeName) :
+        """
+        returns the value of a global attribute if it is available or None
+        """
+        
+        toReturn = None
+        
+        # TODO
+        LOG.warn('Glance does not yet support attribute retrieval in JPSS ADL files. None will be used.')
+        
+        return toReturn
 
 
 
-- 
GitLab