Is there a way to merge different stacks?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a way to merge different stacks?

Pereira
Hello everybody,
I am having a problem to merge several stacks. My stacks have different
extensions ... It is a problem.

If possible, I want to merge several (5 stacks) asc grids into in a "global
grid/stack"
How can I do it? "Merging", "joining" ...?
Any sugestion?

Thanks,

Lara Silva

My outputs:

1st stack

> grids_climatic_SMP <- list.files(pattern='asc', full.names=T)# All "asc"
files in folder
> climatic_SMP<- stack(grids_climatic_SMP)# Make a "stack" of EGV #Install
"stack"
> climatic_SMP
class       : RasterStack
dimensions  : 901, 901, 811801, 20  (nrow, ncol, ncell, nlayers)
resolution  : 100, 100  (x, y)
extent      : 586974, 677074, 4140847, 4230947  (xmin, xmax, ymin, ymax)
coord. ref. : NA
names       : bio1_SMP, bio10_SMP, bio11_SMP, bio12_SMP, bio13_SMP,
bio14_SMP, bio15_SMP, bio16_SMP, bio17_SMP, bio18_SMP, bio19_SMP, bio2_SMP,
bio3_SMP, bio4_SMP, bio4a_SMP, ...

2nd stack

> grids_climatic_PP <- list.files(pattern='asc', full.names=T)# All "asc"
files in folder
> climatic_PP<- stack(grids_climatic_PP)# Make a "stack" of EGV #Install
"stack"
> climatic_PP
class       : RasterStack
dimensions  : 601, 601, 361201, 20  (nrow, ncol, ncell, nlayers)
resolution  : 100, 100  (x, y)
extent      : 358603, 418703, 4229376, 4289476  (xmin, xmax, ymin, ymax)
coord. ref. : NA
names       : bio1_PP, bio10_PP, bio11_PP, bio12_PP, bio13_PP, bio14_PP,
bio15_PP, bio16_PP, bio17_PP, bio18_PP, bio19_PP, bio2_PP, bio3_PP,
bio4_PP, bio4a_PP, ...

3rd stack

> grids_climatic_TP <- list.files(pattern='asc', full.names=T)# All "asc"
files in folder
> climatic_TP<- stack(grids_climatic_TP)# Make a "stack" of EGV #Install
"stack"
> climatic_TP
class       : RasterStack
dimensions  : 277, 412, 114124, 20  (nrow, ncol, ncell, nlayers)
resolution  : 100, 100  (x, y)
extent      : 461214, 502414, 4272892, 4300592  (xmin, xmax, ymin, ymax)
coord. ref. : NA
names       : bio1_TP, bio10_TP, bio11_TP, bio12_TP, bio13_TP, bio14_TP,
bio15_TP, bio16_TP, bio17_TP, bio18_TP, bio19_TP, bio2_TP, bio3_TP,
bio4_TP, bio4a_TP, ...


4th stack

> grids_climatic_FP <- list.files(pattern='asc', full.names=T)# All "asc"
files in folder
> climatic_FP<- stack(grids_climatic_FP)# Make a "stack" of EGV #Install
"stack"
> climatic_FP
class       : RasterStack
dimensions  : 301, 301, 90601, 20  (nrow, ncol, ncell, nlayers)
resolution  : 100, 100  (x, y)
extent      : 336088, 366188, 4256440, 4286540  (xmin, xmax, ymin, ymax)
coord. ref. : NA
names       : bio1_FP, bio10_FP, bio11_FP, bio12_FP, bio13_FP, bio14_FP,
bio15_FP, bio16_FP, bio17_FP, bio18_FP, bio19_FP, bio2_FP, bio3_FP,
bio4_FP, bio4a_FP, ...


5th stack

> grids_climatic_SJP <- list.files(pattern='asc', full.names=T)# All "asc"
files in folder
> climatic_SJP<- stack(grids_climatic_SJP)# Make a "stack" of EGV #Install
"stack"
> climatic_SJP
class       : RasterStack
dimensions  : 602, 602, 362404, 20  (nrow, ncol, ncell, nlayers)
resolution  : 100, 100  (x, y)
extent      : 381100, 441300, 4249487, 4309687  (xmin, xmax, ymin, ymax)
coord. ref. : NA
names       : bio1_SJP, bio10_SJP, bio11_SJP, bio12_SJP, bio13_SJP,
bio14_SJP, bio15_SJP, bio16_SJP, bio17_SJP, bio18_SJP, bio19_SJP, bio2_SJP,
bio3_SJP, bio4_SJP, bio4a_SJP, ...

>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to merge different stacks?

Hugo Costa
You are possibly looking for function mosaic (raster package).
Hugo

Lara Silva <[hidden email]> escreveu no dia quarta, 13/02/2019
à(s) 14:47:

> Hello everybody,
> I am having a problem to merge several stacks. My stacks have different
> extensions ... It is a problem.
>
> If possible, I want to merge several (5 stacks) asc grids into in a "global
> grid/stack"
> How can I do it? "Merging", "joining" ...?
> Any sugestion?
>
> Thanks,
>
> Lara Silva
>
> My outputs:
>
> 1st stack
>
> > grids_climatic_SMP <- list.files(pattern='asc', full.names=T)# All "asc"
> files in folder
> > climatic_SMP<- stack(grids_climatic_SMP)# Make a "stack" of EGV #Install
> "stack"
> > climatic_SMP
> class       : RasterStack
> dimensions  : 901, 901, 811801, 20  (nrow, ncol, ncell, nlayers)
> resolution  : 100, 100  (x, y)
> extent      : 586974, 677074, 4140847, 4230947  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> names       : bio1_SMP, bio10_SMP, bio11_SMP, bio12_SMP, bio13_SMP,
> bio14_SMP, bio15_SMP, bio16_SMP, bio17_SMP, bio18_SMP, bio19_SMP, bio2_SMP,
> bio3_SMP, bio4_SMP, bio4a_SMP, ...
>
> 2nd stack
>
> > grids_climatic_PP <- list.files(pattern='asc', full.names=T)# All "asc"
> files in folder
> > climatic_PP<- stack(grids_climatic_PP)# Make a "stack" of EGV #Install
> "stack"
> > climatic_PP
> class       : RasterStack
> dimensions  : 601, 601, 361201, 20  (nrow, ncol, ncell, nlayers)
> resolution  : 100, 100  (x, y)
> extent      : 358603, 418703, 4229376, 4289476  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> names       : bio1_PP, bio10_PP, bio11_PP, bio12_PP, bio13_PP, bio14_PP,
> bio15_PP, bio16_PP, bio17_PP, bio18_PP, bio19_PP, bio2_PP, bio3_PP,
> bio4_PP, bio4a_PP, ...
>
> 3rd stack
>
> > grids_climatic_TP <- list.files(pattern='asc', full.names=T)# All "asc"
> files in folder
> > climatic_TP<- stack(grids_climatic_TP)# Make a "stack" of EGV #Install
> "stack"
> > climatic_TP
> class       : RasterStack
> dimensions  : 277, 412, 114124, 20  (nrow, ncol, ncell, nlayers)
> resolution  : 100, 100  (x, y)
> extent      : 461214, 502414, 4272892, 4300592  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> names       : bio1_TP, bio10_TP, bio11_TP, bio12_TP, bio13_TP, bio14_TP,
> bio15_TP, bio16_TP, bio17_TP, bio18_TP, bio19_TP, bio2_TP, bio3_TP,
> bio4_TP, bio4a_TP, ...
>
>
> 4th stack
>
> > grids_climatic_FP <- list.files(pattern='asc', full.names=T)# All "asc"
> files in folder
> > climatic_FP<- stack(grids_climatic_FP)# Make a "stack" of EGV #Install
> "stack"
> > climatic_FP
> class       : RasterStack
> dimensions  : 301, 301, 90601, 20  (nrow, ncol, ncell, nlayers)
> resolution  : 100, 100  (x, y)
> extent      : 336088, 366188, 4256440, 4286540  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> names       : bio1_FP, bio10_FP, bio11_FP, bio12_FP, bio13_FP, bio14_FP,
> bio15_FP, bio16_FP, bio17_FP, bio18_FP, bio19_FP, bio2_FP, bio3_FP,
> bio4_FP, bio4a_FP, ...
>
>
> 5th stack
>
> > grids_climatic_SJP <- list.files(pattern='asc', full.names=T)# All "asc"
> files in folder
> > climatic_SJP<- stack(grids_climatic_SJP)# Make a "stack" of EGV #Install
> "stack"
> > climatic_SJP
> class       : RasterStack
> dimensions  : 602, 602, 362404, 20  (nrow, ncol, ncell, nlayers)
> resolution  : 100, 100  (x, y)
> extent      : 381100, 441300, 4249487, 4309687  (xmin, xmax, ymin, ymax)
> coord. ref. : NA
> names       : bio1_SJP, bio10_SJP, bio11_SJP, bio12_SJP, bio13_SJP,
> bio14_SJP, bio15_SJP, bio16_SJP, bio17_SJP, bio18_SJP, bio19_SJP, bio2_SJP,
> bio3_SJP, bio4_SJP, bio4a_SJP, ...
>
> >
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to merge different stacks?

Pereira
Thank you for your answer.

Lara

Hugo Costa <[hidden email]> escreveu no dia quarta, 13/02/2019 à(s)
14:21:

> You are possibly looking for function mosaic (raster package).
> Hugo
>
> Lara Silva <[hidden email]> escreveu no dia quarta, 13/02/2019
> à(s) 14:47:
>
>> Hello everybody,
>> I am having a problem to merge several stacks. My stacks have different
>> extensions ... It is a problem.
>>
>> If possible, I want to merge several (5 stacks) asc grids into in a
>> "global
>> grid/stack"
>> How can I do it? "Merging", "joining" ...?
>> Any sugestion?
>>
>> Thanks,
>>
>> Lara Silva
>>
>> My outputs:
>>
>> 1st stack
>>
>> > grids_climatic_SMP <- list.files(pattern='asc', full.names=T)# All "asc"
>> files in folder
>> > climatic_SMP<- stack(grids_climatic_SMP)# Make a "stack" of EGV #Install
>> "stack"
>> > climatic_SMP
>> class       : RasterStack
>> dimensions  : 901, 901, 811801, 20  (nrow, ncol, ncell, nlayers)
>> resolution  : 100, 100  (x, y)
>> extent      : 586974, 677074, 4140847, 4230947  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> names       : bio1_SMP, bio10_SMP, bio11_SMP, bio12_SMP, bio13_SMP,
>> bio14_SMP, bio15_SMP, bio16_SMP, bio17_SMP, bio18_SMP, bio19_SMP,
>> bio2_SMP,
>> bio3_SMP, bio4_SMP, bio4a_SMP, ...
>>
>> 2nd stack
>>
>> > grids_climatic_PP <- list.files(pattern='asc', full.names=T)# All "asc"
>> files in folder
>> > climatic_PP<- stack(grids_climatic_PP)# Make a "stack" of EGV #Install
>> "stack"
>> > climatic_PP
>> class       : RasterStack
>> dimensions  : 601, 601, 361201, 20  (nrow, ncol, ncell, nlayers)
>> resolution  : 100, 100  (x, y)
>> extent      : 358603, 418703, 4229376, 4289476  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> names       : bio1_PP, bio10_PP, bio11_PP, bio12_PP, bio13_PP, bio14_PP,
>> bio15_PP, bio16_PP, bio17_PP, bio18_PP, bio19_PP, bio2_PP, bio3_PP,
>> bio4_PP, bio4a_PP, ...
>>
>> 3rd stack
>>
>> > grids_climatic_TP <- list.files(pattern='asc', full.names=T)# All "asc"
>> files in folder
>> > climatic_TP<- stack(grids_climatic_TP)# Make a "stack" of EGV #Install
>> "stack"
>> > climatic_TP
>> class       : RasterStack
>> dimensions  : 277, 412, 114124, 20  (nrow, ncol, ncell, nlayers)
>> resolution  : 100, 100  (x, y)
>> extent      : 461214, 502414, 4272892, 4300592  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> names       : bio1_TP, bio10_TP, bio11_TP, bio12_TP, bio13_TP, bio14_TP,
>> bio15_TP, bio16_TP, bio17_TP, bio18_TP, bio19_TP, bio2_TP, bio3_TP,
>> bio4_TP, bio4a_TP, ...
>>
>>
>> 4th stack
>>
>> > grids_climatic_FP <- list.files(pattern='asc', full.names=T)# All "asc"
>> files in folder
>> > climatic_FP<- stack(grids_climatic_FP)# Make a "stack" of EGV #Install
>> "stack"
>> > climatic_FP
>> class       : RasterStack
>> dimensions  : 301, 301, 90601, 20  (nrow, ncol, ncell, nlayers)
>> resolution  : 100, 100  (x, y)
>> extent      : 336088, 366188, 4256440, 4286540  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> names       : bio1_FP, bio10_FP, bio11_FP, bio12_FP, bio13_FP, bio14_FP,
>> bio15_FP, bio16_FP, bio17_FP, bio18_FP, bio19_FP, bio2_FP, bio3_FP,
>> bio4_FP, bio4a_FP, ...
>>
>>
>> 5th stack
>>
>> > grids_climatic_SJP <- list.files(pattern='asc', full.names=T)# All "asc"
>> files in folder
>> > climatic_SJP<- stack(grids_climatic_SJP)# Make a "stack" of EGV #Install
>> "stack"
>> > climatic_SJP
>> class       : RasterStack
>> dimensions  : 602, 602, 362404, 20  (nrow, ncol, ncell, nlayers)
>> resolution  : 100, 100  (x, y)
>> extent      : 381100, 441300, 4249487, 4309687  (xmin, xmax, ymin, ymax)
>> coord. ref. : NA
>> names       : bio1_SJP, bio10_SJP, bio11_SJP, bio12_SJP, bio13_SJP,
>> bio14_SJP, bio15_SJP, bio16_SJP, bio17_SJP, bio18_SJP, bio19_SJP,
>> bio2_SJP,
>> bio3_SJP, bio4_SJP, bio4a_SJP, ...
>>
>> >
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo