[R-sig-Geo] Problem to retrieve/plot selected bands in a stars proxy object

Loïc Valéry |v@|ery @end|ng |rom out|ook@|r
Tue Sep 14 18:58:42 CEST 2021


Thank you so much Edzer for fixing this so quickly. Everything is working fine now.
Cheers,
Lo�c

________________________________
De : R-sig-Geo <r-sig-geo-bounces using r-project.org> de la part de Edzer Pebesma <edzer.pebesma using uni-muenster.de>
Envoy� : mardi 14 septembre 2021 17:45
� : r-sig-geo using r-project.org <r-sig-geo using r-project.org>
Objet : Re: [R-sig-Geo] Problem to retrieve/plot selected bands in a stars proxy object

Thanks for the clear report, Lo�c; this should now be fixed in the
version on github.

On 14/09/2021 14:55, Lo�c Val�ry wrote:
> Dear list members,
>
> I hope this message finds you well.
> I submit to you a problem with which I have been struggling for several days without finding the beginning of a solution.
>
> I would like to select some bands of a 'stars proxy' object that I have previously created by merging two images with the function read_stars(c(image1, image2), proxy = true, along = "band") in order to plot them.
>
> My problem is that R returns the following error message when trying to plot the selected bands:
> Error in x[[i]][, , 10:12, , drop = FALSE] : subscript out of bounds
>
> Here is a short REPREX:
> library(stars)
> tif_1 <- system.file("tif/L7_ETMs.tif", package = "stars")
> tif_2 <- system.file("tif/L7_ETMs.tif", package = "stars")
>
> tif_merge <- read_stars(c(tif_1,tif_2), proxy = TRUE, along = "band")
>
> plot(tif_merge[,,,10:12], rgb = 1:3)
> #> Error in x[[i]][, , 10:12, , drop = FALSE]: indice hors limites
>
>
>
> I guess the problem is that the "tif_merge" object has different dimensions before and after the promise evaluation:
>
> dim(tif_merge)
> #>    x    y band
> #>  349  352   12
>
> dim(st_as_stars(tif_merge))
> #>       x       y    band new_dim
> #>     349     352       6       2
>
> However, this did not help me to find any solution!
>
> Thank you in advance for your help.
> Cheers,
> Lo�c
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo using r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list