Skip to content

Commit 7d88f07

Browse files
committed
up
1 parent 8051398 commit 7d88f07

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

R/utils-credentials.R

+13-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ ee_create_credentials_drive <- function(user=NULL, ee_utils, quiet) {
44
# check googledrive R package installation
55
ee_check_packages("ee_Initialize", "googledrive")
66

7+
# Check sanity of earth-engine and return ee_utils.py module
8+
init <- ee_check_init()
9+
ee_utils <- init$ee_utils
10+
11+
712
# setting drive folder
813
if (is.null(user)) {
914
ee_path <- ee_utils_py_to_r(ee_utils$ee_path())
@@ -83,6 +88,10 @@ ee_create_credentials_gcs_ <- function(user, ee_utils) {
8388
# check packages
8489
ee_check_packages("ee_Initialize", "googleCloudStorageR")
8590

91+
# Check sanity of earth-engine and return ee_utils.py module
92+
init <- ee_check_init()
93+
ee_utils <- init$ee_utils
94+
8695
# setting gcs folder
8796
if (is.null(user)) {
8897
ee_path <- suppressWarnings(ee_utils_py_to_r(ee_utils$ee_path()))
@@ -99,8 +108,10 @@ ee_create_credentials_gcs_ <- function(user, ee_utils) {
99108
if (!any(gcs_condition)) {
100109
gcs_text <- paste(
101110
sprintf("Unable to find a service account key (SAK) file in: %s", crayon::bold(ee_path_user)),
102-
"Please, download and validate it using rgee::ee_utils_sak_validate.",
103-
"Then, use rgee::ee_utils_sak_copy to set the Service Account Key.",
111+
"To solve this problem:",
112+
" 1) download it from your Google cloud console",
113+
" 2) validate it using rgee::ee_utils_sak_validate [OPTIONAL].",
114+
" 3) Use rgee::ee_utils_sak_copy to set the SaK in rgee.",
104115
"A tutorial to obtain the SAK file is available at:",
105116
"> https://r-spatial.github.io/rgee/articles/rgee05.html",
106117
crayon::bold("As long as you haven't saved a SKA file, the following functions will not work:"),

man/rgee-package.Rd

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ skip_if_no_credentials <- function() {
1313
ee_path <- ee_get_earthengine_path()
1414
credentials <- list.files(
1515
path = ee_path,
16-
pattern = "@gmail.com|credentials|GCS_AUTH_FILE.json"
16+
pattern = "@gmail.com|credentials|.*.json"
1717
)
1818
if (length(credentials) != 3) {
1919
skip("All google credentials were not found")
@@ -23,7 +23,7 @@ skip_if_no_credentials <- function() {
2323
# Necessary Python packages were loaded?
2424
skip_if_no_pypkg <- function() {
2525
have_ee <- reticulate::py_module_available("ee")
26-
have_numpy <- reticulate::py_module_available("numpy2")
26+
have_numpy <- reticulate::py_module_available("numpy")
2727
if (isFALSE(have_ee)) {
2828
skip("ee not available for testing")
2929
}
@@ -43,7 +43,7 @@ drive_folder_f <- function(){
4343
# intermediate files. ALERT!!: After test finished all the files
4444
# inside the bucket will be deleted.
4545
gcs_bucket_f <- function(){
46-
"rgee_dev"
46+
"rgeedev2"
4747
}
4848

4949
# Define your own GCS bucket with uniform access to save
@@ -56,7 +56,7 @@ gcs_bucket_uniform_f <- function(){
5656
# Initialize credentials
5757
# If you do not count with GCS credentials the test will be skipped
5858
have_ee <- reticulate::py_module_available("ee")
59-
have_numpy <- reticulate::py_module_available("numpy2")
59+
have_numpy <- reticulate::py_module_available("numpy")
6060
if (have_ee & have_numpy) {
6161
ee_Initialize(drive = TRUE, gcs = TRUE)
6262
}

0 commit comments

Comments
 (0)