Merge branch 'CLIMATE-965'
diff --git a/RCMES/CORDEX/templates/CORDEX.yaml.template b/RCMES/CORDEX/templates/CORDEX.yaml.template
index c0a1994..a7fd492 100644
--- a/RCMES/CORDEX/templates/CORDEX.yaml.template
+++ b/RCMES/CORDEX/templates/CORDEX.yaml.template
@@ -10,6 +10,7 @@
 time:
     maximum_overlap_period: True
     temporal_resolution: monthly
+    adjust_model_years_for_climatology_calculation: True  
 {% if season == "winter" %}
     month_start: 12
     month_end: 2
diff --git a/RCMES/CORDEX/templates/CORDEX_evaluation_run.yaml.template b/RCMES/CORDEX/templates/CORDEX_evaluation_run.yaml.template
new file mode 100644
index 0000000..a823804
--- /dev/null
+++ b/RCMES/CORDEX/templates/CORDEX_evaluation_run.yaml.template
@@ -0,0 +1,58 @@
+{% set domain = models_info[0].domain %}
+{% set instrument = obs_info.instrument %}
+{% set variable = models_info[0].variable %}
+{% set basename = [variable, instrument, domain, season]|join('_') %}
+workdir: {{ [output_dir, domain, instrument, variable, season]|join('/') }}
+output_netcdf_filename: {{ basename }}.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: True
+    temporal_resolution: monthly
+    adjust_model_years_for_climatology_calculation: False 
+{% if season == "winter" %}
+    month_start: 12
+    month_end: 2
+{% elif season == "summer" %}
+    month_start: 6
+    month_end: 8
+{% else %}
+    month_start: 1
+    month_end: 12
+{% endif %}
+    average_each_year: True
+
+space:
+    boundary_type: CORDEX {{ domain[:3] }}
+
+regrid:
+    regrid_on_reference: True
+
+datasets:
+  - loader_name: local_split
+    name: {{ instrument }}
+    file_path: {{ obs_info.filename }}
+    variable_name: {{ obs_info.variable }}
+{% for model_info in models_info %}
+  - loader_name: local_split
+    name: {{ model_info.model }}
+    file_path: {{ model_info.filename }}
+    variable_name: {{ model_info.variable }}
+    lat_name: lat
+    lon_name: lon
+{% endfor %}
+
+number_of_metrics_and_plots: 2
+
+metrics1: Map_plot_bias_of_multiyear_climatology
+
+plots1:
+    file_name: {{ basename }}_bias
+
+metrics2: Taylor_diagram_spatial_pattern_of_multiyear_climatology
+
+plots2:
+    file_name: {{ basename }}_taylor
+
+use_subregions: False
diff --git a/RCMES/run_RCMES.py b/RCMES/run_RCMES.py
index 3c7291e..8965412 100644
--- a/RCMES/run_RCMES.py
+++ b/RCMES/run_RCMES.py
@@ -125,6 +125,9 @@
 
 """ Step 2: Subset the data for temporal and spatial domain """
 # Create a Bounds object to use for subsetting
+if 'adjust_model_years_for_climatology_calculation' in time_info:
+    if time_info['adjust_model_years_for_climatology_calculation']:
+        datasets = utils.adjust_model_years_for_climatology_calculation(datasets) 
 if maximum_overlap_period:
     start_time, end_time = utils.get_temporal_overlap(datasets)
     print('Maximum overlap period')
diff --git a/ocw/utils.py b/ocw/utils.py
index 455c26d..64050fe 100755
--- a/ocw/utils.py
+++ b/ocw/utils.py
@@ -383,8 +383,6 @@
     ''' Find the maximum temporal overlap across the observation and model datasets
 
     :param dataset_array: an array of OCW datasets
-    :param idx: start and end indices to denote subset of months used.
-    :type idx: class:`tuple`
     '''
     start_times = []
     end_times = []
@@ -397,6 +395,19 @@
 
     return np.max(start_times), np.min(end_times)
 
+def adjust_model_years_for_climatology_calculation(dataset_array):
+    ''' Using the time length of the first element in the input dataset_array, 
+        adjust years in the rest ofi the dataset_array so that every dataset ends in the same year.
+    :param dataset_array: an array of OCW datasets
+    '''
+    slc = trim_dataset(dataset_array[0])
+    obs_times = dataset_array[0].times[slc]
+    for idata, dataset in enumerate(dataset_array[1:]):
+        year_diff = obs_times[-1].year - dataset.times[-1].year    
+        nt = dataset.times.size
+        for it in np.arange(nt):
+            dataset.times[it] = dataset.times[it].replace(year = dataset.times[it].year + year_diff)
+    return dataset_array                              
 
 def trim_dataset(dataset):
     ''' Trim datasets such that first and last year of data have all 12 months