climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [03/21] climate git commit: CLIMATE-372 - Add custom names to dap data source
Date Wed, 19 Nov 2014 16:53:18 GMT
CLIMATE-372 - Add custom names to dap data source


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

Branch: refs/heads/master
Commit: 79fa8a60d0770bb2dcada6974b9ed5806fdbfbdc
Parents: f6f1dd6
Author: Michael Joyce <joyce@apache.org>
Authored: Mon Nov 17 09:21:44 2014 -0800
Committer: Michael Joyce <joyce@apache.org>
Committed: Mon Nov 17 09:21:44 2014 -0800

----------------------------------------------------------------------
 ocw/data_source/dap.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/79fa8a60/ocw/data_source/dap.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/dap.py b/ocw/data_source/dap.py
index a4c413b..b188cb5 100644
--- a/ocw/data_source/dap.py
+++ b/ocw/data_source/dap.py
@@ -21,13 +21,15 @@ import requests
 import numpy as np
 from ocw.dataset import Dataset
 
-def load(url, variable):
+def load(url, variable, name=''):
     '''Load a Dataset from an OpenDAP URL
 
     :param url: The OpenDAP URL for the dataset of interest.
     :type url: String
     :param variable: The name of the variable to read from the dataset.
     :type variable: String
+    :param name: (Optional) A name for the loaded dataset.
+    :type name: String
 
     :returns: A Dataset object containing the dataset pointed to by the 
         OpenDAP URL.
@@ -55,7 +57,7 @@ def load(url, variable):
     lons = np.array(dataset[lon][:])
     values = np.array(dataset[:])
 
-    return Dataset(lats, lons, times, values, variable)
+    return Dataset(lats, lons, times, values, variable, name=name)
 
 def _convert_times_to_datetime(time):
     '''Convert the OpenDAP time object's values to datetime objects


Mime
View raw message