[R-sig-Geo] Combining different RasterBricks maintaining z-values (dates)
J Rojo
jru85yebe @end|ng |rom hotm@||@com
Sat Nov 30 00:04:33 CET 2019
Hi everyone
I am trying to combine different RasterBricks into one and if use the function ‘brick’ does not work, and with ‘stack’ remove the z-values as RasterStack does not include it.
The objective is to do a loop for reading and processing one nc file for each iterative step, and include each Brick into a big general Brick
One example with two RasterBricks
> a <- brick("tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM/tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM_2020.nc”); a
class : RasterBrick
dimensions : 720, 1440, 1036800, 366 (nrow, ncol, ncell, nlayers)
resolution : 0.25, 0.25 (x, y)
extent : 0, 360, -90, 90 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
source : /Volumes/Copy/NASA/tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM/tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM_2020.nc
names : X2020.01.01, X2020.01.02, X2020.01.03, X2020.01.04, X2020.01.05, X2020.01.06, X2020.01.07, X2020.01.08, X2020.01.09, X2020.01.10, X2020.01.11, X2020.01.12, X2020.01.13, X2020.01.14, X2020.01.15, ...
Date : 2020-01-01, 2020-12-31 (min, max)
varname : tasmax
> b <- brick("tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM/tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM_2021.nc”); b
class : RasterBrick
dimensions : 720, 1440, 1036800, 365 (nrow, ncol, ncell, nlayers)
resolution : 0.25, 0.25 (x, y)
extent : 0, 360, -90, 90 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
source : /Volumes/Copy/NASA/tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM/tasmax_day_BCSD_rcp45_r1i1p1_MIROC-ESM-CHEM_2021.nc
names : X2021.01.01, X2021.01.02, X2021.01.03, X2021.01.04, X2021.01.05, X2021.01.06, X2021.01.07, X2021.01.08, X2021.01.09, X2021.01.10, X2021.01.11, X2021.01.12, X2021.01.13, X2021.01.14, X2021.01.15, ...
Date : 2021-01-01, 2021-12-31 (min, max)
varname : tasmax
## Now I would like to combine both RasterBrick into one big RasterBrick with 731 layer, maintaining the Date as z-value
> c <- stack(a, b) # If I do a ‘stack’ z-value is not considered
> c <- brick(a, b) # If I do a ‘brick’ does not work and the file when saved is very weighted, and any case z-value is not maintained
Any idea about how I can combine in easy way the layers for multiple bricks according to the z-value
I am grateful any help, thank you so much
Jesús Rojo
More information about the R-sig-Geo
mailing list