The climate models in the CMIP5 data set use a variety of different grid resolutions, which can have regular or irregular spaced latitudes.  To calculate countrywide averages thus requires a method to standardize the model grids.  The example below for Brazil illustrates the method we developed to regrid and calculate the averages.

Step 1) The raw data (here the anomaly between future and present air temperature) on the native global climate model grid that enclose the country of interest were extracted for each model, experiment and country.  If the country is smaller than a single model grid cell, the nearest grid cell is used (based on the latitude and longitude of the grid center).

Step 2) The raw data for each model were regridded (overlaid) to a 0.1° x 0.1° grid without interpolation.  The fine grid boxes within the country were retained (based on grid center) and grid boxes outside the country polygon were removed.  Because the fine grid is 0.1° x 0.1°, the edges of the country are slightly aliased.  The fine grid was primarily used to minimize aliasing; using the native grids with coarse resolution would produce heavy aliasing.  If a country did not contain any fine grid cells, the nearest grid cell was used.

Step 3) Many countries are represented by multiple polygons in GIS shape files, which need to be averaged individually to obtain an aggregated value for the country.  In the example of Brazil, there are 13 separate polygons: the main body makes up 99.5% of the total area and small islands contribute the remaining 0.5%.  The area-weighted average was calculated from the fine grid for each polygon within the country and the aggregated average for the country was calculated from a combined area-weighted average of all the polygons.