Read the SciHub login information (read_scihub_login()
),
save new username and password (write_scihub_login()
)
or check their validity (check_scihub_login()
).
Login information is stored in a file apihub.txt
inside the
".sen2r" subfolder of the home directory. This functions allow to read
or write this file, and to edit them from inside the GUI.
read_scihub_login(apihub_path = NA)check_scihub_login(username, password)
check_scihub_connection()
write_scihub_login(
username,
password,
apihub_path = NA,
check = TRUE,
append = FALSE
)
Path of the file in which login information is saved. If NA (default) it is automatically read from the package default location.
SciHub username.
SciHub password.
Logical: if TRUE (default), new credentials are checked
before writing them on apihub_path
(if they are invalid, an error
is provided);
if FALSE, they are directly written.
Logical: if TRUE, new credentials are added
to the ones existing within apihub_path
;
if FALSE (default), apihub_path
is replaced with the new ones.
read_scihub_login
returns a matrix of credentials,
in which username
is in the first column, password
in the second.
check_scihub_login
returns TRUE if credentials are valid,
FALSE elsewhere.
check_scihub_connection
returns TRUE if internet connection
is available and SciHub is accessible, FALSE otherwise.
write_scihub_login
returns NULL.
Notice that new/recently updated SciHub credentials are recognised by API Hub with a delay of about one week (see https://scihub.copernicus.eu/twiki/do/view/SciHubWebPortal/APIHubDescription for details).
For this reason, newly created credentials can not immediately be used by sen2r
,
and password edits on old credentials are not immediately recognised.
# NOT RUN {
check_scihub_login("user", "user")
write_scihub_login("user", "user")
read_scihub_login()
check_scihub_connection()
# }
Run the code above in your browser using DataLab