Hi there,I am currently trying to calculate "weighted" spatial annual "global"
values for precipitation using the object "Prec20". I need to do this for each
of the 140 years (i.e. 140 layers) of global precipitation data that I have.
The idea would be to somehow apply weights to each grid cell value for each
year by using the cosine of its latitude (which means grid cells at the equator
would have a weight of 1 (i.e. the cosine of 0 degrees is 1), and the poles
would have a value of 1 (as the cosine of 90 is 1)). The idea would also then
be to make a time series of these values, from Year 1 to Year 140, after all
newly derived grid cell values are averaged for each year, creating 140
(weighted) averages)). The object "Prec20" looks like this:class :
RasterBrick
dimensions : 64, 128, 8192, 140 (nrow, ncol, ncell, nlayers)
resolution : 2.8125, 2.789327 (x, y)
extent : -181.4062, 178.5938, -89.25846, 89.25846 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : C:/Users/Travis/Documents/Other documents/All netCDF
files/netcdffiles/MaxPrecIPSLIPSL-CM5B-LR1pctCO2.nc
names : X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15,
...
z-value : 1, 140 (min, max)
varname : onedaymax
Here is what I have done so far:ncfname20 <-
"MaxPrecIPSLIPSL-CM5B-LR1pctCO2.nc"Prec20 <-
brick(ncfname20,var="onedaymax")w20 <- cos(Prec20*(pi/180))
Would this approach apply the weights appropriately?
I would greatly appreciate any help with this!!!!Thanks,
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo