Google Cloud SDK is an optional dependency, required to search and download SAFE archives from Google Cloud.

check_gcloud() checks if Google Cloud SDK is externally installed and if a user account is set.

is_gcloud_configured() check if Google Cloud SDK were already configured in sen2r using check_gcloud().

check_gcloud_connection() check if internet connection is available and Sentinel-2 bucket is accessible on Google Cloud.

check_gcloud(
  gsutil_dir,
  force = FALSE,
  full_scan = FALSE,
  abort = TRUE,
  check_creds = TRUE
)

is_gcloud_configured()

check_gcloud_connection()

Arguments

gsutil_dir

(optional) Character: the path of the gsutil executable, or the directory in which it is installed. If not provided, gsutil is searched in the system path.

force

(optional) Logical: if TRUE, check even if it is already configured (default is FALSE).

full_scan

(optional) Logical: in Linux and MacOS, if gsutil_dir was not manually defined, gsutil is searched within the system path in case this argument is left to default value FALSE; instead, if TRUE, a full search is performed. In Windows, if the folder Google\Cloud SDK exist in C:\Program Files (x86), C:\Program Files or C:\Users\<username>\AppData\Local, then gsutil is searched there, otherwise in the main directory C:\; setting full_scan = TRUE, is is always searched in the whole C:\. This argument takes no effect if gsutil_dir was defined, since, in that case, a full search is always performed in gsutil_dir.

abort

(optional) Logical: if TRUE (default), the function aborts in case no Google Cloud SDK installation is found; if FALSE, a warning is shown and FALSE is returned.

check_creds

(optional) Logical: if TRUE, check also if a user account (required to search and download products) was set.

Value

check_gcloud() returns TRUE (invisible) in case Google Cloud SDK was correctly set, FALSE if it was not found, not configured (if check_creds = TRUE) and abort = FALSE (otherwise, the function stops).

is_gcloud_configured() returns TRUE if Google Cloud SDK is installed and an account is configured, FALSE if not.

check_gcloud_connection() returns TRUE if connection is available, FALSE otherwise.

Note

License: GPL 3.0

References

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. doi: 10.1016/j.cageo.2020.104473 , URL: https://sen2r.ranghetti.info/.

Author

Luigi Ranghetti, phD (2021) luigi@ranghetti.info

Examples

if (FALSE) { check_gcloud() check_gcloud_connection() } # \donttest{ is_gcloud_configured()
#> [1] TRUE
# }