From 75f8df695a17e0e13d40c1d1d8870ff6cf0a1ea2 Mon Sep 17 00:00:00 2001 From: Michael Joyce Date: Mon, 16 Mar 2015 13:40:24 -0700 Subject: [PATCH] CLIMATE-603 - Default example download to /tmp --- examples/simple_model_to_model_bias.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/examples/simple_model_to_model_bias.py b/examples/simple_model_to_model_bias.py index 32ecf15e..635e8729 100644 --- a/examples/simple_model_to_model_bias.py +++ b/examples/simple_model_to_model_bias.py @@ -35,24 +35,21 @@ # 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 """