You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by hu...@apache.org on 2016/09/09 16:14:53 UTC

[1/3] climate git commit: CLIMATE-865 - Update dataset_name argument in local.load_multiple_files

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 <hu...@argo.jpl.nasa.gov>
Authored: Wed Sep 7 10:43:54 2016 -0700
Committer: huikyole <hu...@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"""


[3/3] climate git commit: CLIMATE-865 - Update dataset_name argument in local.load_multiple_files

Posted by hu...@apache.org.
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/677173e1
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/677173e1
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/677173e1

Branch: refs/heads/master
Commit: 677173e11c3d9a505d8adcc54cb1bda2bf8a566c
Parents: 3683b86 7d005e8
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Fri Sep 9 09:14:19 2016 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Fri Sep 9 09:14:19 2016 -0700

----------------------------------------------------------------------
 .../cordex-arctic_cloud_fraction_bias_to_SRB.yaml             | 2 +-
 .../cordex-arctic_rlds_bias_to_SRB.yaml                       | 2 +-
 .../cordex-arctic_rlus_bias_to_SRB.yaml                       | 2 +-
 .../cordex-arctic_rsds_bias_to_SRB.yaml                       | 2 +-
 .../configuration_files/ESGF_example/ESGF-Example_local.yaml  | 3 ++-
 .../configuration_files/NARCCAP_examples/Fig14_and_Fig15.yaml | 2 +-
 RCMES/configuration_files/NARCCAP_examples/Fig16_summer.yaml  | 2 +-
 RCMES/configuration_files/NARCCAP_examples/Fig16_winter.yaml  | 2 +-
 .../NASA_downscaling_project_Part1/dscale_prmo-wus_local.yaml | 2 +-
 ocw/data_source/local.py                                      | 7 +++++--
 ocw/tests/test_local.py                                       | 2 +-
 11 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------



[2/3] climate git commit: minor debugging of load_multiple_files and related updates in configuration files

Posted by hu...@apache.org.
minor debugging of load_multiple_files and related updates in configuration files


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

Branch: refs/heads/master
Commit: 7d005e8acd2e1ebbcdf4f85b904c19c5d91a344c
Parents: fcc4785
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Wed Sep 7 13:31:04 2016 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Wed Sep 7 13:31:04 2016 -0700

----------------------------------------------------------------------
 .../cordex-arctic_cloud_fraction_bias_to_SRB.yaml             | 2 +-
 .../cordex-arctic_rlds_bias_to_SRB.yaml                       | 2 +-
 .../cordex-arctic_rlus_bias_to_SRB.yaml                       | 2 +-
 .../cordex-arctic_rsds_bias_to_SRB.yaml                       | 2 +-
 .../configuration_files/ESGF_example/ESGF-Example_local.yaml  | 3 ++-
 .../configuration_files/NARCCAP_examples/Fig14_and_Fig15.yaml | 2 +-
 RCMES/configuration_files/NARCCAP_examples/Fig16_summer.yaml  | 2 +-
 RCMES/configuration_files/NARCCAP_examples/Fig16_winter.yaml  | 2 +-
 .../NASA_downscaling_project_Part1/dscale_prmo-wus_local.yaml | 2 +-
 ocw/data_source/local.py                                      | 7 ++++---
 10 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_cloud_fraction_bias_to_SRB.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_cloud_fraction_bias_to_SRB.yaml b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_cloud_fraction_bias_to_SRB.yaml
index 3549d2b..a33b941 100644
--- a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_cloud_fraction_bias_to_SRB.yaml
+++ b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_cloud_fraction_bias_to_SRB.yaml
@@ -42,7 +42,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: SRB
+          dataset_name: SRB
           file_path: ./data/CORDEX-Arctic_data/srb_rel3.0_shortwave_from_1983_to_2007.nc
           variable_name: cld_frac
           multiplying_factor: 100.0

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlds_bias_to_SRB.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlds_bias_to_SRB.yaml b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlds_bias_to_SRB.yaml
index 534b644..70e62d7 100644
--- a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlds_bias_to_SRB.yaml
+++ b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlds_bias_to_SRB.yaml
@@ -42,7 +42,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: SRB
+          dataset_name: SRB
           file_path: ./data/CORDEX-Arctic_data/srb_rel3.0_longwave_from_1983_to_2007.nc
           variable_name: lw_sfc_dn
           multiplying_factor: 1

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlus_bias_to_SRB.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlus_bias_to_SRB.yaml b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlus_bias_to_SRB.yaml
index 9c4126f..d1bdba9 100644
--- a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlus_bias_to_SRB.yaml
+++ b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rlus_bias_to_SRB.yaml
@@ -42,7 +42,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: SRB
+          dataset_name: SRB
           file_path: ./data/CORDEX-Arctic_data/srb_rel3.0_longwave_from_1983_to_2007.nc
           variable_name: lw_sfc_up
           multiplying_factor: 1

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rsds_bias_to_SRB.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rsds_bias_to_SRB.yaml b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rsds_bias_to_SRB.yaml
index 194894d..28b10aa 100644
--- a/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rsds_bias_to_SRB.yaml
+++ b/RCMES/configuration_files/CORDEX-Arctic_examples/cordex-arctic_rsds_bias_to_SRB.yaml
@@ -42,7 +42,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: SRB
+          dataset_name: SRB
           file_path: ./data/CORDEX-Arctic_data/srb_rel3.0_shortwave_from_1983_to_2007.nc
           variable_name: sw_sfc_dn
           multiplying_factor: 1

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml b/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml
index ae1a7a6..11d936e 100644
--- a/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml
+++ b/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml
@@ -40,12 +40,13 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: AVISO
+          dataset_name: AVISO
           file_path: ./data/ESGF_data/zos_AVISO_L4_199210-201012.nc
           variable_name: zos
 
     targets:
         - loader_name: local
+          dataset_name: MPI-ESM-LR
           file_path: ./data/ESGF_data/zos_Omon_MPI-ESM-LR_decadal1994_r1i1p1_199501-200412.nc
           variable_name: zos
           GCM_data: True

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/NARCCAP_examples/Fig14_and_Fig15.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/NARCCAP_examples/Fig14_and_Fig15.yaml b/RCMES/configuration_files/NARCCAP_examples/Fig14_and_Fig15.yaml
index a514d6d..2ad8dfa 100644
--- a/RCMES/configuration_files/NARCCAP_examples/Fig14_and_Fig15.yaml
+++ b/RCMES/configuration_files/NARCCAP_examples/Fig14_and_Fig15.yaml
@@ -25,7 +25,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: SRB
+          dataset_name: SRB
           file_path: ./data/NARCCAP_data/srb_rel3.0_shortwave_from_1983_to_2007.nc
           variable_name: sw_sfc_dn
 

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/NARCCAP_examples/Fig16_summer.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/NARCCAP_examples/Fig16_summer.yaml b/RCMES/configuration_files/NARCCAP_examples/Fig16_summer.yaml
index 15002b9..0145614 100644
--- a/RCMES/configuration_files/NARCCAP_examples/Fig16_summer.yaml
+++ b/RCMES/configuration_files/NARCCAP_examples/Fig16_summer.yaml
@@ -25,7 +25,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: SRB
+          dataset_name: SRB
           file_path: ./data/NARCCAP_data/srb_rel3.0_shortwave_from_1983_to_2007.nc
           variable_name: sw_sfc_dn
 

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/NARCCAP_examples/Fig16_winter.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/NARCCAP_examples/Fig16_winter.yaml b/RCMES/configuration_files/NARCCAP_examples/Fig16_winter.yaml
index 2226b9f..ac30f53 100644
--- a/RCMES/configuration_files/NARCCAP_examples/Fig16_winter.yaml
+++ b/RCMES/configuration_files/NARCCAP_examples/Fig16_winter.yaml
@@ -25,7 +25,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: SRB
+          dataset_name: SRB
           file_path: ./data/NARCCAP_data/srb_rel3.0_shortwave_from_1983_to_2007.nc
           variable_name: sw_sfc_dn
 

http://git-wip-us.apache.org/repos/asf/climate/blob/7d005e8a/RCMES/configuration_files/NASA_downscaling_project_Part1/dscale_prmo-wus_local.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/NASA_downscaling_project_Part1/dscale_prmo-wus_local.yaml b/RCMES/configuration_files/NASA_downscaling_project_Part1/dscale_prmo-wus_local.yaml
index a6436c6..3578d2f 100644
--- a/RCMES/configuration_files/NASA_downscaling_project_Part1/dscale_prmo-wus_local.yaml
+++ b/RCMES/configuration_files/NASA_downscaling_project_Part1/dscale_prmo-wus_local.yaml
@@ -25,7 +25,7 @@ regrid:
 datasets:
     reference:
         - loader_name: local
-          name: NLDAS
+          dataset_name: NLDAS
           file_path: ./data/dscale/obs/prmo_lds-lds_1999-2010.nc
           variable_name: pr
 

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