If a Z dimension is present, the stat function is calculated
for all combinations of these. No status bar is printed when processing in parallel,
but progress is logged to a file (call with verbose=T) that can be monitored.This function is more complicated than the other makeXxxStat functions, because
it provides explicit support for area-weighted functions. We expect that
weighted.mean and a weighted sum will be the most frequent
calculations needed. The former is built into R, and the latter can generally
be calculated as weighted.mean * sum(area). A user-supplied stat function must
follow the weighted.mean syntax, in particular
accepting parameters 'x' (data) and 'w' (weights) of equal size.
If the user requests parallel processing (via parallel=T) makeGlobalStat
(i) attempts to load the doParallel package, and (ii) registers it as a
parallel backend unless the user has already done this (e.g. set up a
virtual cluster with particular, desired characteristics). In that case,
makeGlobalStat respects the existing cluster.