[R-sig-Geo] Aggregation to

Miluji Sb milujisb at gmail.com
Thu Aug 31 21:22:33 CEST 2017


I have a set of coordinates:

temp <- dput(head(gcp,10))
structure(list(lon = c(-180, -180, -179, -179, -178, -178, -177,
-176, -176, -175), lat = c(67, 68, 67, 68, 67, 68, 67, 66, 67,
66)), datalabel = "", time.stamp = "11 Aug 2017 16:10", .Names = c("lon",
"lat"), formats = c("%9.0g", "%9.0g"), types = c(255L, 255L), val.labels =
c("",
""), var.labels = c("lon", "lat"), version = 12L, row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10"), class = "data.frame")

These are at 1 degree, I would like to aggregate them to 2.5 degree to use
them to extract data from a netcdf file (which is at 2.5 degree). This is
what I have done:

rasterDF <- rasterFromXYZ(gcp)
gcp2_5 <- aggregate(rasterDF,fact=2.5, fun=sum)

However, this seems to return aggregated coordinates at 2 degree.

class       : RasterLayer
dimensions  : 67, 180, 12060  (nrow, ncol, ncell)
resolution  : 2, 2  (x, y)
extent      : -180.5, 179.5, -54.5, 79.5  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0

What am I doing wrong? Is there another way? Thank you.

Sincerely,

Milu

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list