Repository: climate
Updated Branches:
  refs/heads/master 1240ee2d5 -> 45357f7eb


CLIMATE-781 - Fix the ESGF example in run_RCMES.py

- Few more keywords have been added to ESGF-Example.yaml
- run_RCMES.py has been updated to handle datasets from ESGF


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

Branch: refs/heads/master
Commit: 72193317a59cea34cc78609a9b40883db7c459a6
Parents: 1240ee2
Author: huikyole <[email protected]>
Authored: Tue Apr 19 16:46:50 2016 -0700
Committer: huikyole <[email protected]>
Committed: Tue Apr 19 16:46:50 2016 -0700

----------------------------------------------------------------------
 .../ESGF_example/ESGF-Example.yaml              | 26 ++++++++++----------
 RCMES/run_RCMES.py                              | 18 +++++++++-----
 2 files changed, 25 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/72193317/RCMES/configuration_files/ESGF_example/ESGF-Example.yaml
----------------------------------------------------------------------
diff --git a/RCMES/configuration_files/ESGF_example/ESGF-Example.yaml 
b/RCMES/configuration_files/ESGF_example/ESGF-Example.yaml
index a5369d9..03edcf5 100644
--- a/RCMES/configuration_files/ESGF_example/ESGF-Example.yaml
+++ b/RCMES/configuration_files/ESGF_example/ESGF-Example.yaml
@@ -14,23 +14,23 @@
 # limitations under the License.
 
 workdir: ./results/ESGF_example                                   
-output_netcdf_filename: narccap_zos_annual_mean_1993-2002.nc
+output_netcdf_filename: zos_annual_mean.nc
 
 # (RCMES will temporally subset data between month_start and month_end. If 
average_each_year is True (False), seasonal mean in each year is (not) 
calculated and used for metrics calculation.)
 time:
-    maximum_overlap_period: False
+    maximum_overlap_period: False 
     start_time: 1995-01-01
-    end_time: 2003-12-31
+    end_time: 2004-12-31
     temporal_resolution: monthly
-    month_start: 3
-    month_end: 9
+    month_start: 1
+    month_end: 12
     average_each_year: False  
 
 space:
-    min_lat: 10
-    max_lat: 30
-    min_lon: -100
-    max_lon: -60
+    min_lat: -70
+    max_lat: 70
+    min_lon: -178.5
+    max_lon: 178.5 
 
 regrid:
     regrid_on_reference: True
@@ -40,13 +40,14 @@ regrid:
 datasets:
     reference:
         data_source: ESGF
-        data_name: obs4MIPS
+        data_name: AVISO    
         dataset_id: 
obs4MIPs.CNES.AVISO.zos.mon.v20110829|esgf-data.jpl.nasa.gov                    
      
         variable: zos
 
     targets:
         data_source: ESGF
-        dataset_id: 
cmip5.output1.MPI-M.MPI-ESM-LR.decadal1994.mon.ocean.Omon.r1i1p1.v20120529|esgf1.dkrz.de
                                                 
+        data_name: MPI-ESM
+        dataset_id: 
cmip5.output1.MPI-M.MPI-ESM-LR.decadal1994.mon.ocean.Omon.r1i1p1.v20120529|esgf1.dkrz.de
 
         variable: zos
         GCM_data: True
 
@@ -55,8 +56,7 @@ number_of_metrics_and_plots: 1
 metrics1: Map_plot_bias_of_multiyear_climatology
 
 plots1:
-    file_name: BIAS_aviso-NARCCAP_1993-2002_ESGF
+    file_name: BIAS_zos_MPI-AVISO_1995-2004
     subplots_array: !!python/tuple [2,2]
 
-
 use_subregions: False

http://git-wip-us.apache.org/repos/asf/climate/blob/72193317/RCMES/run_RCMES.py
----------------------------------------------------------------------
diff --git a/RCMES/run_RCMES.py b/RCMES/run_RCMES.py
index a06d681..ed48458 100644
--- a/RCMES/run_RCMES.py
+++ b/RCMES/run_RCMES.py
@@ -35,6 +35,7 @@ from dateutil import parser
 from datetime import datetime
 import os
 import sys
+from getpass import getpass
 
 from metrics_and_plots import *
 
@@ -59,8 +60,13 @@ max_lat = space_info['max_lat']
 min_lon = space_info['min_lon']
 max_lon = space_info['max_lon']
 
-""" Step 1: Load the reference data """
 ref_data_info = config['datasets']['reference']
+model_data_info = config['datasets']['targets']
+if ref_data_info['data_source'] == 'ESGF' or model_data_info['data_source'] == 
'ESGF':
+    username=raw_input('Enter your ESGF OpenID:\n')
+    password=getpass(prompt='Enter your ESGF password:\n')
+
+""" Step 1: Load the reference data """
 ref_lat_name = None
 ref_lon_name = None
 if 'latitude_name' in ref_data_info.keys():
@@ -79,8 +85,6 @@ elif ref_data_info['data_source'] == 'rcmed':
                                             min_lat, max_lat, min_lon, max_lon,
                                             start_time, end_time)
 elif ref_data_info['data_source'] == 'ESGF':
-      username=raw_input('Enter your ESGF OpenID:\n')
-      password=raw_input('Enter your ESGF password:\n')
       ds = esgf.load_dataset(dataset_id = ref_data_info['dataset_id'],
                              variable = ref_data_info['variable'],
                              esgf_username=username,
@@ -94,7 +98,6 @@ if 'multiplying_factor' in ref_data_info.keys():
     ref_dataset.values = ref_dataset.values*ref_data_info['multiplying_factor']
 
 """ Step 2: Load model NetCDF Files into OCW Dataset Objects """
-model_data_info = config['datasets']['targets']
 model_lat_name = None
 model_lon_name = None
 if 'latitude_name' in model_data_info.keys():
@@ -115,7 +118,10 @@ elif model_data_info['data_source'] == 'ESGF':
                              variable=model_data_info['variable'],
                              esgf_username=username,
                              esgf_password=password)
-      model_datasets, model_names = md[0]
+      model_datasets = []
+      model_names = []
+      model_datasets.append(md[0])
+      model_names.append(model_data_info['data_name'])
 else:
     print ' '
     # TO DO: support RCMED
@@ -220,7 +226,7 @@ if workdir[-1] != '/':
     workdir = workdir+'/'
 print 'Writing a netcdf file: ',workdir+config['output_netcdf_filename']
 if not os.path.exists(workdir):
-    os.system("mkdir "+workdir)
+    os.system("mkdir -p "+workdir)
 
 if config['use_subregions']:
     dsp.write_netcdf_multiple_datasets_with_subregions(ref_dataset, ref_name, 
model_datasets, model_names,

Reply via email to