climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huiky...@apache.org
Subject [2/5] climate git commit: CLIMATE-687 - A new loader to read GPM precipitation data with a file list
Date Fri, 09 Oct 2015 00:15:03 GMT
CLIMATE-687 - A new loader to read GPM precipitation data with a file list

- ocw.data_source.local.load_GPM_IMERG_files is added


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/491c78ba
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/491c78ba
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/491c78ba

Branch: refs/heads/master
Commit: 491c78ba884493c7e7200dd80101d261e9883e5f
Parents: 32b184d
Author: huikyole <huikyole@argo.jpl.nasa.gov>
Authored: Wed Oct 7 18:09:57 2015 -0700
Committer: huikyole <huikyole@argo.jpl.nasa.gov>
Committed: Wed Oct 7 18:09:57 2015 -0700

----------------------------------------------------------------------
 ocw/data_source/local.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/491c78ba/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index 97e482b..766eb8f 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -367,7 +367,9 @@ def load_GPM_IMERG_files(file_path=None,
     lats = file_object_first['Grid']['lat'][:]
     lons = file_object_first['Grid']['lon'][:]
 
-    lons, lats = np.meshgrid(lons, lats)
+    lons, lats = numpy.meshgrid(lons, lats)
+            
+    variable_unit = "mm/hr"
 
     times = []
     nfile = len(GPM_files)
@@ -375,12 +377,11 @@ def load_GPM_IMERG_files(file_path=None,
         print 'Reading file '+str(ifile+1)+'/'+str(nfile), file
         file_object = h5py.File(file)        
         time_struct_parsed = strptime(file[-39:-23],"%Y%m%d-S%H%M%S")     
-        for ihour in numpy.arange(24):
-            times.append(datetime(*time_struct_parsed[:6]))
-        values0= ma.masked_less(file_object['Grid'][variable_name][:], 0.)
+        times.append(datetime(*time_struct_parsed[:6]))
+        values0= numpy.transpose(ma.masked_less(file_object['Grid'][variable_name][:], 0.))
+        values0= numpy.expand_dims(values0, axis=0)
         if ifile == 0:
-            values = values0                                 
-            variable_unit = file_object.variables[variable_name].units
+            values = values0                                                            
         else:
             values = numpy.concatenate((values, values0)) 
         file_object.close()


Mime
View raw message