Closed huard closed 3 years ago
Indeed, I can't see any indication of how edge cells are handled in the regional means code (though I'm a non-fluent R reader!). It'd be good to document and explain how the regional averaging is done at the edges of regions, justifying choices regarding exclusion/partial inclusion of cells, and if partial cell areas are used, need to clearly document how this is implemented as it can substantially affect results.
Thank you for the thorough review. The code has been cleaned up and reorganized to avoid repetition and use functions to improve reusability and readability (see c1628dd). Grid cell area weighting was already applied since this is the default for aggregateGrid (https://rdrr.io/github/SantanderMetGroup/transformeR/man/aggregateGrid.html), but we made it explicit now: https://github.com/IPCC-WG1/Atlas/blob/c1628ddf8fcbbf6662d8555a166d2b1e800e6ca9/datasets-aggregated-regionally/scripts/calculate_regional_means.R#L84 Regarding partial cell areas at the edges of the regions, this was not considered. Grid cells were considered either land or sea according to a 50% land fraction threshold. https://github.com/IPCC-WG1/Atlas/blob/c1628ddf8fcbbf6662d8555a166d2b1e800e6ca9/datasets-aggregated-regionally/scripts/calculate_regional_means.R#L63