climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huiky...@apache.org
Subject [1/3] climate git commit: CLIMATE-865 - Update dataset_name argument in local.load_multiple_files
Date Fri, 09 Sep 2016 16:14:53 GMT
Repository: climate
Updated Branches:
  refs/heads/master 3683b8686 -> 677173e11


CLIMATE-865 - Update dataset_name argument in local.load_multiple_files

- ocw.local.load_multiple_files has been updated.


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

Branch: refs/heads/master
Commit: fcc4785cc8ed8dba80f90c8ad0e20c674fa6053c
Parents: d47fe2e
Author: huikyole <huikyole@argo.jpl.nasa.gov>
Authored: Wed Sep 7 10:43:54 2016 -0700
Committer: huikyole <huikyole@argo.jpl.nasa.gov>
Committed: Wed Sep 7 10:43:54 2016 -0700

----------------------------------------------------------------------
 ocw/data_source/local.py | 6 ++++--
 ocw/tests/test_local.py  | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/fcc4785c/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index d32cf1b..50de3a1 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -293,7 +293,7 @@ def load_file(file_path,
 
 def load_multiple_files(file_path,
                         variable_name,
-                        dataset_name='model',
+                        dataset_name='data',
                         variable_unit=None,
                         lat_name=None,
                         lon_name=None,
@@ -333,8 +333,10 @@ def load_multiple_files(file_path,
 
     # number of files
     ndata = len(data_filenames)
-    if ndata == 1:
+    if type(dataset_name) is str:
         data_name = [dataset_name]
+    elif dataset_name.__name__ == 'list' and len(dataset_name) == ndata:
+        data_name = [name for name in dataset_name]
     else:
         data_name = []
         data_filenames_reversed = []

http://git-wip-us.apache.org/repos/asf/climate/blob/fcc4785c/ocw/tests/test_local.py
----------------------------------------------------------------------
diff --git a/ocw/tests/test_local.py b/ocw/tests/test_local.py
index 5f40466..dffe212 100644
--- a/ocw/tests/test_local.py
+++ b/ocw/tests/test_local.py
@@ -118,7 +118,7 @@ class TestLoadMultipleFiles(unittest.TestCase):
 
     def test_function_load_multiple_files_data_name(self):
         dataset = local.load_multiple_files(self.file_path, "value")
-        self.assertEqual([dataset[0].name], ['model'])
+        self.assertEqual([dataset[0].name], ['data'])
 
     def test_function_load_multiple_files_lons(self):
         """To test load_multiple_file function for longitudes"""


Mime
View raw message