Reputation: 45
I have multiple raster stacks containing temperature data from CRU TS 3.23
I have read in the files as follows:
nc = stack("cru_ts3.23.1951.1960.pre.dat.nc", varname = "pre")
nc2 = stack("cru_ts3.23.1961.1970.pre.dat.nc", varname = "pre")
...
nc7 = stack("cru_ts3.23.2011.2014.pre.dat.nc", varname = "pre")
Is there any way I can combine all these rasters to create one big one? I am looking at precipitation trends, so much easier to do when they're all in one object! Thanks
Upvotes: 4
Views: 5342
Reputation: 5308
raster::stack(nc, nc2, nc3, nc4, nc5, nc6, nc7)
should do the trick. A very similar approach has been described e.g. here.
However, be aware that the objects you would like to stack
are required to have an identical coordinate references system (CRS
), resolution (res
), and extent
. Otherwise, stack
will most likely fail. You could deploy raster::projectRaster
and raster::resample
to create objects with uniform spatial properties if one (or several) of the above criteria is different.
Upvotes: 4