What is the best method of calculating the number of model grid cells (e.g. of climate models) covering a specific country? For example, if I wanted to know how many 2 degree grid cells are in the United Kingdom, how would I go about it? At present I use the mapping toolbox in matlab and add a 2 degree grid and calculate manually. Is there a better way of doing this? Any advice is appreciated.
1$\begingroup$ I assume you have land mask and borders of the grids. From the whole grid loop over a rectangular shape compassing UK but no other countries and for each cell check the land mask. $\endgroup$– CommunistyJan 29, 2018 at 12:17
3$\begingroup$ Be aware that some models use non-equirectangular grids. $\endgroup$– gerrit ♦Jan 29, 2018 at 14:51
$\begingroup$ Do you have the countries outlines in matlab as a vector? Or an image? $\endgroup$– Camilo RadaJan 29, 2018 at 21:58
$\begingroup$ I would do it in a geographic information system and this question might be better answered in gis.stackexchange.com $\endgroup$– haresfurJan 30, 2018 at 22:36
Here is a simple 'back of the napkin' idea for Python:
- Get a shapefile of the borders and use Python to create a polygon of the borders.
- Use mpl_toolkits to convert the climate model to X and Y coordinates
- Check to see if the model grid points are within the Polygon