Repository: climate Updated Branches: refs/heads/master 360b5728f -> f4e7bd61c
CLIMATE-696 - Examples to evaluate CORDEX-ARCTIC RCMs - run_RCMES.py and metrics_and_plots have been updated. Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/a94d3b1e Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/a94d3b1e Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/a94d3b1e Branch: refs/heads/master Commit: a94d3b1ec3d4cce49817f2fdab831cef7c39aeb9 Parents: a38724e Author: huikyole <[email protected]> Authored: Sat Oct 17 16:37:42 2015 -0700 Committer: huikyole <[email protected]> Committed: Sat Oct 17 16:37:42 2015 -0700 ---------------------------------------------------------------------- .../configuration_file_examples/metrics_and_plots.py | 14 +++++++++++--- examples/configuration_file_examples/run_RCMES.py | 11 +++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/a94d3b1e/examples/configuration_file_examples/metrics_and_plots.py ---------------------------------------------------------------------- diff --git a/examples/configuration_file_examples/metrics_and_plots.py b/examples/configuration_file_examples/metrics_and_plots.py index f32446c..41e0d14 100644 --- a/examples/configuration_file_examples/metrics_and_plots.py +++ b/examples/configuration_file_examples/metrics_and_plots.py @@ -15,7 +15,7 @@ from matplotlib.patches import Polygon import string def Map_plot_bias_of_multiyear_climatology(obs_dataset, obs_name, model_datasets, model_names, - file_name, row, column): + file_name, row, column, map_projection=None): '''Draw maps of observed multi-year climatology and biases of models"''' # calculate climatology of observation data @@ -42,7 +42,11 @@ def Map_plot_bias_of_multiyear_climatology(obs_dataset, obs_name, model_datasets string_list = list(string.ascii_lowercase) ax = fig.add_subplot(row,column,1) - m = Basemap(ax=ax, projection ='cyl', llcrnrlat = lat_min, urcrnrlat = lat_max, + if map_projection == 'npstere': + m = Basemap(ax=ax, projection ='npstere', boundinglat=lat_min, lon_0=0, + resolution = 'l', fix_aspect=False) + else: + m = Basemap(ax=ax, projection ='cyl', llcrnrlat = lat_min, urcrnrlat = lat_max, llcrnrlon = lon_min, urcrnrlon = lon_max, resolution = 'l', fix_aspect=False) lons, lats = np.meshgrid(obs_dataset.lons, obs_dataset.lats) @@ -58,7 +62,11 @@ def Map_plot_bias_of_multiyear_climatology(obs_dataset, obs_name, model_datasets clevs = plotter._nice_intervals(rcm_bias, 11) for imodel in np.arange(len(model_datasets)): ax = fig.add_subplot(row, column,2+imodel) - m = Basemap(ax=ax, projection ='cyl', llcrnrlat = lat_min, urcrnrlat = lat_max, + if map_projection == 'npstere': + m = Basemap(ax=ax, projection ='npstere', boundinglat=lat_min, lon_0=0, + resolution = 'l', fix_aspect=False) + else: + m = Basemap(ax=ax, projection ='cyl', llcrnrlat = lat_min, urcrnrlat = lat_max, llcrnrlon = lon_min, urcrnrlon = lon_max, resolution = 'l', fix_aspect=False) m.drawcoastlines(linewidth=1) m.drawcountries(linewidth=1) http://git-wip-us.apache.org/repos/asf/climate/blob/a94d3b1e/examples/configuration_file_examples/run_RCMES.py ---------------------------------------------------------------------- diff --git a/examples/configuration_file_examples/run_RCMES.py b/examples/configuration_file_examples/run_RCMES.py index d32c7af..5f15dfe 100644 --- a/examples/configuration_file_examples/run_RCMES.py +++ b/examples/configuration_file_examples/run_RCMES.py @@ -8,6 +8,7 @@ from ocw.dataset import Bounds import matplotlib.pyplot as plt from matplotlib import rcParams +from mpl_toolkits.basemap import shiftgrid import numpy as np import numpy.ma as ma import yaml @@ -57,6 +58,8 @@ else: # TO DO: support ESGF ref_dataset = dsp.normalize_dataset_datetimes(ref_dataset, temporal_resolution) +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'] @@ -191,8 +194,12 @@ if nmetrics > 0: print 'metrics '+str(imetric)+'/'+str(nmetrics)+': ', metrics_name if metrics_name == 'Map_plot_bias_of_multiyear_climatology': row, column = plot_info['subplots_array'] - Map_plot_bias_of_multiyear_climatology(ref_dataset, ref_name, model_datasets, model_names, - file_name, row, column) + if 'map_projection' in plot_info.keys(): + Map_plot_bias_of_multiyear_climatology(ref_dataset, ref_name, model_datasets, model_names, + file_name, row, column, map_projection=plot_info['map_projection']) + else: + Map_plot_bias_of_multiyear_climatology(ref_dataset, ref_name, model_datasets, model_names, + file_name, row, column) elif metrics_name == 'Taylor_diagram_spatial_pattern_of_multiyear_climatology': Taylor_diagram_spatial_pattern_of_multiyear_climatology(ref_dataset, ref_name, model_datasets, model_names, file_name)
