climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From good...@apache.org
Subject [1/4] git commit: Fix model to model script to prevent re-downloading
Date Mon, 02 Jun 2014 21:16:40 GMT
Repository: climate
Updated Branches:
  refs/heads/master 0fba21fdd -> e9437d04e


Fix model to model script to prevent re-downloading


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

Branch: refs/heads/master
Commit: 6713d723ffea1ae28179a6b55b1078ea70cdd56a
Parents: 0fba21f
Author: cgoodale <sigep311@gmail.com>
Authored: Mon Jun 2 13:34:52 2014 -0700
Committer: cgoodale <sigep311@gmail.com>
Committed: Mon Jun 2 13:34:52 2014 -0700

----------------------------------------------------------------------
 examples/simple_model_to_model_bias.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/6713d723/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 8b9dcea..59e42a5 100644
--- a/examples/simple_model_to_model_bias.py
+++ b/examples/simple_model_to_model_bias.py
@@ -1,7 +1,8 @@
 import datetime
+from os import path
+import urllib
 
 import numpy as np
-import urllib
 
 import ocw.data_source.local as local
 import ocw.dataset_processor as dsp
@@ -17,9 +18,16 @@ 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
-urllib.urlretrieve(FILE_LEADER + FILE_1, FILE_1)
-urllib.urlretrieve(FILE_LEADER + FILE_2, FILE_2)
+# Download necessary NetCDF files if not present
+if path.exists(FILE_1):
+    pass
+else:
+    urllib.urlretrieve(FILE_LEADER + FILE_1, FILE_1)
+
+if path.exists(FILE_2):
+    pass
+else:
+    urllib.urlretrieve(FILE_LEADER + FILE_2, FILE_2)
 
 """ Step 1: Load Local NetCDF Files into OCW Dataset Objects """
 print("Loading %s into an OCW Dataset Object" % (FILE_1,))


Mime
View raw message