You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2015/03/18 17:46:38 UTC

[2/4] climate git commit: CLIMATE-603 - Default example download to /tmp

CLIMATE-603 - Default example download to /tmp


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

Branch: refs/heads/master
Commit: 75f8df695a17e0e13d40c1d1d8870ff6cf0a1ea2
Parents: a0f0615
Author: Michael Joyce <jo...@apache.org>
Authored: Mon Mar 16 13:40:24 2015 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Mon Mar 16 13:40:24 2015 -0700

----------------------------------------------------------------------
 examples/simple_model_to_model_bias.py | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/75f8df69/examples/simple_model_to_model_bias.py
----------------------------------------------------------------------
diff --git a/examples/simple_model_to_model_bias.py b/examples/simple_model_to_model_bias.py
index 32ecf15..635e872 100644
--- a/examples/simple_model_to_model_bias.py
+++ b/examples/simple_model_to_model_bias.py
@@ -35,24 +35,21 @@ FILE_2 = "AFRICA_UC-WRF311_CTL_ERAINT_MM_50km-rg_1989-2008_tasmax.nc"
 # Filename for the output image/plot (without file extension)
 OUTPUT_PLOT = "wrf_bias_compared_to_knmi"
 
-# Download necessary NetCDF files if not present
-if path.exists(FILE_1):
-    pass
-else:
-    urllib.urlretrieve(FILE_LEADER + FILE_1, FILE_1)
+FILE_1_PATH = path.join('/tmp', FILE_1)
+FILE_2_PATH = path.join('/tmp', FILE_2)
 
-if path.exists(FILE_2):
-    pass
-else:
-    urllib.urlretrieve(FILE_LEADER + FILE_2, FILE_2)
+if not path.exists(FILE_1_PATH):
+    urllib.urlretrieve(FILE_LEADER + FILE_1, FILE_1_PATH)
+if not path.exists(FILE_2_PATH):
+    urllib.urlretrieve(FILE_LEADER + FILE_2, FILE_2_PATH)
 
 """ Step 1: Load Local NetCDF Files into OCW Dataset Objects """
-print("Loading %s into an OCW Dataset Object" % (FILE_1,))
-knmi_dataset = local.load_file(FILE_1, "tasmax")
+print("Loading %s into an OCW Dataset Object" % (FILE_1_PATH,))
+knmi_dataset = local.load_file(FILE_1_PATH, "tasmax")
 print("KNMI_Dataset.values shape: (times, lats, lons) - %s \n" % (knmi_dataset.values.shape,))
 
-print("Loading %s into an OCW Dataset Object" % (FILE_2,))
-wrf_dataset = local.load_file(FILE_2, "tasmax")
+print("Loading %s into an OCW Dataset Object" % (FILE_2_PATH,))
+wrf_dataset = local.load_file(FILE_2_PATH, "tasmax")
 print("WRF_Dataset.values shape: (times, lats, lons) - %s \n" % (wrf_dataset.values.shape,))
 
 """ Step 2: Temporally Rebin the Data into an Annual Timestep """