Raster used available here: https://www.dropbox.com/s/xn7hdll2op5zcc9/MAP_global.tif?dl=0.
INTRODUCTION: The resolution of a raster is commonly related in degrees, e.g.:
library(raster) r <- raster("/CALL/IN/RASTER/FILE") print(r) class : RasterLayer dimensions : 720, 1440, 1036800 (nrow, ncol, ncell) *resolution : 0.25, 0.25 (x, y)* extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax) crs : +proj=longlat +datum=WGS84 +no_defs source : MAP_global.tif names : MAP_global values : 2.561833, 10341.26 (min, max) At the equator, x = 0.25 degrees is ~27.75km, so, a 0.25 x 0.25 cell would have a horizontal area of ~770.06km^2. While the resolution (in units of degree) will remain constant as a function of latitude, the grid cell's area will shrink with distance from the equator.
QUESTION:
Can the area of a 0.25 x 0.25 degree grid cell be calculated as a function of latitude, and then be stored as a variable in that raster? If so, could someone please provide that script? Or provide me the information needed to proceed with coding it myself?