Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
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
  • Loading branch information
huikyole committed Apr 19, 2016
1 parent 1240ee2 commit 72193317a59cea34cc78609a9b40883db7c459a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
@@ -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
@@ -35,6 +35,7 @@
from datetime import datetime
import os
import sys
from getpass import getpass

from metrics_and_plots import *

@@ -59,8 +60,13 @@
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 @@
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 @@
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 @@
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 @@
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,

0 comments on commit 7219331

Please sign in to comment.