e-sensing / sits

Satellite image time series in R
https://e-sensing.github.io/sitsbook/
GNU General Public License v2.0
467 stars 76 forks source link

Issue with `plot` in Microsoft Planetary Computer #1072

Closed KBodolai closed 6 months ago

KBodolai commented 7 months ago

Describe the bug When trying to run the Landsat 8 example:

```R # Read a ROI that covers part of the Northeastern coast of Brazil roi <- c( lon_min = -43.5526, lat_min = -2.9644, lon_max = -42.5124, lat_max = -2.1671 ) # Select the cube s2_L8_cube_MPC <- sits_cube( source = "MPC", collection = "LANDSAT-C2-L2", bands = c("BLUE", "RED", "GREEN", "NIR08", "SWIR16", "CLOUD"), roi = roi, start_date = "2019-06-01", end_date = "2019-09-01" ) # Plot the tile that covers the Lencois Maranhenses plot(s2_L8_cube_MPC, red = "RED", green = "GREEN", blue = "BLUE", date = "2019-06-30" ) ```

in the planetary computer I get the following error:

``` Error: IRkernel::main: date is not contained in the cube timeline (date %in% sits_timeline(x) is not TRUE) Traceback: 1. plot(s2_L8_cube_MPC, red = "RED", green = "GREEN", blue = "BLUE", . date = "2019-06-30") 2. plot.raster_cube(s2_L8_cube_MPC, red = "RED", green = "GREEN", . blue = "BLUE", date = "2019-06-30") 3. .check_that(date %in% sits_timeline(x), msg = "date is not contained in the cube timeline") 4. stop(sprintf(msg, local_msg), call. = FALSE) ```

It complains about the date not being in the cube timeline, but when I run sits_timeline, the date is in the list.

I suspect it may have something to do with MPC having an older version of sits (1.2.0), is this a bug that you were aware of and has been fixed since?

To Reproduce Start an R environment in the microsoft planetary computer and run the example, it should complain when running the plot() bit.

Thanks very much!

sessionInfo():

R version 4.2.2 (2022-10-31) Platform: x86_64-conda-linux-gnu (64-bit) Running under: Ubuntu 22.04 LTS Matrix products: default BLAS/LAPACK: /srv/conda/envs/notebook/lib/libopenblasp-r0.3.21.so locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] sits_1.2.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.10 pillar_1.8.1 compiler_4.2.2 class_7.3-21 [5] base64enc_0.1-3 tools_4.2.2 digest_0.6.31 uuid_1.1-0 [9] jsonlite_1.8.4 lubridate_1.9.1 evaluate_0.20 lifecycle_1.0.3 [13] tibble_3.1.8 timechange_0.2.0 pkgconfig_2.0.3 rlang_1.0.6 [17] IRdisplay_1.1 cli_3.6.0 DBI_1.1.3 parallel_4.2.2 [21] curl_4.3.3 IRkernel_1.3.2 yaml_2.3.7 warp_0.2.0 [25] fastmap_1.1.0 terra_1.5-21 e1071_1.7-12 withr_2.5.0 [29] httr_1.4.4 repr_1.1.6 dplyr_1.1.0 rstac_0.9.2-1 [33] generics_0.1.3 vctrs_0.5.2 grid_4.2.2 classInt_0.4-8 [37] tidyselect_1.2.0 glue_1.6.2 data.table_1.14.6 geojsonsf_2.0.3 [41] sf_1.0-7 R6_2.5.1 fansi_1.0.4 pbdZMQ_0.3-9 [45] tidyr_1.3.0 slider_0.3.0 purrr_1.0.1 magrittr_2.0.3 [49] codetools_0.2-18 units_0.8-1 htmltools_0.5.4 KernSmooth_2.23-20 [53] utf8_1.2.2 proxy_0.4-27 crayon_1.5.2
KBodolai commented 7 months ago

Just to add to the above, I tested it locally with sits version 1.4.1 and it worked just fine. So perhaps I should raise it directly with the planetary computer team.

gilbertocamara commented 7 months ago

Please ask MPC to update the version of sits and its dependency. Let us know if it works

KBodolai commented 7 months ago

Done, I'll leave this open for now and update you with whatever happens.

KBodolai commented 6 months ago

This seems fixed in the MPC, so closing this issue.