e-sensing / sits

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

Cannot access BDC and AWS from Windows 10 OS #271

Closed rolfsimoes closed 3 years ago

rolfsimoes commented 3 years ago

Cannot get access to BDC or AWS data cube from Windows operating system.

The following command returns an error: "Error: sits_cube: BDC is not accessible"

# Provide your BDC credentials as environment variables
Sys.setenv(
    "BDC_ACCESS_KEY" = "<TOKEN>"
)

# create a raster cube file based on the information in the BDC
cbers_tile <- sits::sits_cube(
    source = "BDC",
    collection = "CB4_64_16D_STK-1",
    name = "cbers_022024",
    bands = c("NDVI", "EVI"),
    tiles = "022024",
    start_date = "2018-09-01",
    end_date = "2019-08-28"
)

Session info

R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tibble_3.1.2 dplyr_1.0.6 

loaded via a namespace (and not attached):
 [1] httr_1.4.2           jsonlite_1.7.2       splines_4.1.0        foreach_1.5.1       
 [5] warp_0.2.0           prodlim_2019.11.13   assertthat_0.2.1     sp_1.4-5            
 [9] stats4_4.1.0         yaml_2.2.1           globals_0.14.0       rstac_0.9.1         
[13] ipred_0.9-11         pillar_1.6.1         lattice_0.20-44      glue_1.4.2          
[17] pROC_1.17.0.1        digest_0.6.27        colorspace_2.0-1     recipes_0.1.16      
[21] Matrix_1.3-3         plyr_1.8.6           timeDate_3043.102    gdalUtilities_1.1.2 
[25] pkgconfig_2.0.3      raster_3.4-10        listenv_0.8.0        caret_6.0-88        
[29] config_0.3.1         purrr_0.3.4          scales_1.1.1         slider_0.2.1        
[33] terra_1.2-10         gower_0.2.2          lava_1.6.9           proxy_0.4-26        
[37] aws.s3_0.3.21        generics_0.1.0       ggplot2_3.3.3        ellipsis_0.3.2      
[41] withr_2.4.2          furrr_0.2.2          sits_0.11.2          nnet_7.3-16         
[45] cli_2.5.0            survival_3.2-11      magrittr_2.0.1       crayon_1.4.1        
[49] fansi_0.5.0          future_1.21.0        parallelly_1.25.0    nlme_3.1-152        
[53] MASS_7.3-54          xml2_1.3.2           class_7.3-19         tools_4.1.0         
[57] data.table_1.14.0    lifecycle_1.0.0      stringr_1.4.0        munsell_0.5.0       
[61] compiler_4.1.0       e1071_1.7-7          rlang_0.4.11         classInt_0.4-3      
[65] units_0.7-2          grid_4.1.0           RCurl_1.98-1.3       iterators_1.0.13    
[69] rstudioapi_0.13      aws.signature_0.6.0  base64enc_0.1-3      bitops_1.0-7        
[73] gtable_0.3.0         ModelMetrics_1.2.2.2 codetools_0.2-18     curl_4.3.1          
[77] DBI_1.1.1            reshape2_1.4.4       R6_2.5.0             lubridate_1.7.10    
[81] rgdal_1.5-23         utf8_1.2.1           KernSmooth_2.23-20   stringi_1.6.2       
[85] parallel_4.1.0       Rcpp_1.0.6           vctrs_0.3.8          sf_0.9-8            
[89] rpart_4.1-15         tidyselect_1.1.1    
rolfsimoes commented 3 years ago

It seems that the error is related with curl version installed in SO.

# try with curl
RCurl::httpGET("https://brazildatacube.dpi.inpe.br/stac/")

# try using native R url() function
readLines(url("https://brazildatacube.dpi.inpe.br/stac/"))

The first command generates the error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

The second works finely.

sits uses RCurl package to test if an url is working. I think that the error can be avoided by using httr package instead RCurl.