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 23:16:42 UTC

[3/4] 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/00ff21bc
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/00ff21bc
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/00ff21bc

Branch: refs/heads/master
Commit: 00ff21bc8ff2a691075aea4447f568edb4641dc9
Parents: 50cee81
Author: cgoodale <si...@gmail.com>
Authored: Mon Jun 2 13:41:36 2014 -0700
Committer: cgoodale <si...@gmail.com>
Committed: Mon Jun 2 13:41:36 2014 -0700

----------------------------------------------------------------------
 examples/simple_model_tstd.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/00ff21bc/examples/simple_model_tstd.py
----------------------------------------------------------------------
diff --git a/examples/simple_model_tstd.py b/examples/simple_model_tstd.py
index 46ff7ae..3420f9b 100644
--- a/examples/simple_model_tstd.py
+++ b/examples/simple_model_tstd.py
@@ -16,6 +16,7 @@
 # under the License.
 
 
+from os import path
 import urllib
 
 import ocw.data_source.local as local
@@ -31,8 +32,11 @@ FILE_1 = "AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc"
 # Filename for the output image/plot (without file extension)
 OUTPUT_PLOT = "knmi_temporal_std"
 
-# Download necessary NetCDF file
-urllib.urlretrieve(FILE_LEADER + FILE_1, FILE_1)
+# Download necessary NetCDF file if needed
+if path.exists(FILE_1):
+    pass
+else:
+    urllib.urlretrieve(FILE_LEADER + FILE_1, FILE_1)
 
 """ Step 1: Load Local NetCDF File into OCW Dataset Objects """
 print "Loading %s into an OCW Dataset Object" % (FILE_1,)