You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by go...@apache.org on 2014/06/02 22:43:26 UTC

[2/3] git commit: Prevent re-downloading the model file

Prevent re-downloading the model file


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

Branch: refs/heads/CLIMATE-450
Commit: 50cee8126f7e4a0b57570da5eb4cf120d02de03b
Parents: 6713d72
Author: cgoodale <si...@gmail.com>
Authored: Mon Jun 2 13:38:35 2014 -0700
Committer: cgoodale <si...@gmail.com>
Committed: Mon Jun 2 13:38:35 2014 -0700

----------------------------------------------------------------------
 examples/knmi_to_cru31_full_bias.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/50cee812/examples/knmi_to_cru31_full_bias.py
----------------------------------------------------------------------
diff --git a/examples/knmi_to_cru31_full_bias.py b/examples/knmi_to_cru31_full_bias.py
index 50b9f96..7440ea7 100644
--- a/examples/knmi_to_cru31_full_bias.py
+++ b/examples/knmi_to_cru31_full_bias.py
@@ -1,7 +1,8 @@
 import datetime
+import urllib
+from os import path
 
 import numpy as np
-import urllib
 
 import ocw.data_source.local as local
 import ocw.data_source.rcmed as rcmed
@@ -20,8 +21,11 @@ MODEL = "AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc"
 # Filename for the output image/plot (without file extension)
 OUTPUT_PLOT = "cru_31_tmax_knmi_africa_bias_full"
 
-# Download necessary NetCDF file
-urllib.urlretrieve(FILE_LEADER + MODEL, MODEL)
+# Download necessary NetCDF file if not present
+if path.exists(MODEL):
+    pass
+else:
+    urllib.urlretrieve(FILE_LEADER + MODEL, MODEL)
 
 """ Step 1: Load Local NetCDF File into OCW Dataset Objects """
 print("Loading %s into an OCW Dataset Object" % (MODEL,))