You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by le...@apache.org on 2017/08/05 16:33:21 UTC

[1/2] climate git commit: optimizing code

Repository: climate
Updated Branches:
  refs/heads/master 800b924d9 -> 6540643a0


optimizing code

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

Branch: refs/heads/master
Commit: 60ec96ad92a9b9284d03370a715644f03e1a337c
Parents: cb93fce
Author: 象道 <w....@gmail.com>
Authored: Tue May 30 10:13:01 2017 -0400
Committer: GitHub <no...@github.com>
Committed: Tue May 30 10:13:01 2017 -0400

----------------------------------------------------------------------
 .../run_statistical_downscaling.py                 | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/60ec96ad/RCMES/statistical_downscaling/run_statistical_downscaling.py
----------------------------------------------------------------------
diff --git a/RCMES/statistical_downscaling/run_statistical_downscaling.py b/RCMES/statistical_downscaling/run_statistical_downscaling.py
index 9aae618..62bc1a4 100644
--- a/RCMES/statistical_downscaling/run_statistical_downscaling.py
+++ b/RCMES/statistical_downscaling/run_statistical_downscaling.py
@@ -76,9 +76,9 @@ def extract_data_at_nearest_grid_point(target_dataset, longitude, latitude):
     :rtype: Open Climate Workbench Dataset Object
     """
 
-    if target_dataset.lons.ndim == 1 and target_dataset.lats.ndim == 1:
+    if target_dataset.lons.ndim == target_dataset.lats.ndim == 1:
         new_lon, new_lat = np.meshgrid(target_dataset.lons, target_dataset.lats)
-    elif target_dataset.lons.ndim == 2 and target_dataset.lats.ndim == 2:
+    elif target_dataset.lons.ndim == target_dataset.lats.ndim == 2:
         new_lon = target_datasets.lons
         new_lat = target_datasets.lats
     distance = (new_lon - longitude)**2. + (new_lat - latitude)**2.
@@ -155,16 +155,9 @@ downscale = down.Downscaling(ref_subset, model_subset_present, model_subset_futu
 
 print(downscale_option_names[DOWNSCALE_OPTION]+": Downscaling model output")
 
-if DOWNSCALE_OPTION == 1:
-    downscaled_model_present, downscaled_model_future = downscale.Delta_addition()
-elif DOWNSCALE_OPTION == 2:
-    downscaled_model_present, downscaled_model_future = downscale.Delta_correction()
-elif DOWNSCALE_OPTION == 3:
-    downscaled_model_present, downscaled_model_future = downscale.Quantile_mapping()
-elif DOWNSCALE_OPTION == 4:
-    downscaled_model_present, downscaled_model_future = downscale.Asynchronous_regression()
-else:
-    sys.exit("DOWNSCALE_OPTION must be an integer between 1 and 4")
+xdownscale = [downscale.Delta_addition, downscale.Delta_correction, downscale.Quantile_mapping, downscale.Asynchronous_regression]
+if 0 < DOWNSCALE_OPTION <= len(xdownscale): xdownscale[DOWNSCALE_OPTION - 1]()
+else: sys.exit("DOWNSCALE_OPTION must be an integer between 1 and " + len(xdownscale))
 
 
 """ Step 5: Create plots and spreadsheet """


[2/2] climate git commit: Merge branch 'patch-1' of https://github.com/Kejia/climate

Posted by le...@apache.org.
Merge branch 'patch-1' of https://github.com/Kejia/climate


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

Branch: refs/heads/master
Commit: 6540643a0a29cc773c07141e210ed0d34c77ea3b
Parents: 800b924 60ec96a
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Sat Aug 5 09:33:17 2017 -0700
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Sat Aug 5 09:33:17 2017 -0700

----------------------------------------------------------------------
 .../run_statistical_downscaling.py                 | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------