-
Notifications
You must be signed in to change notification settings - Fork 0
111 new function get wekeo layer #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 66c34db.
#111 @martijn-bollen het is blijkbaar best practice om deze setup buiten de functie te doen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new function get_wekeo_data()
(with helpers earthkit_download()
and setup_hda_credentials()
) to download raster layers from Copernicus Wekeo via Python Earthkit integration.
- Adds R functions to wrap Earthkit data access and HDA credential setup
- Provides documentation (.Rd) for the new functions and updates existing
download_*
docs to referenceget_wekeo_data
- Updates NAMESPACE to export
get_wekeo_data
and adds necessary dependencies to DESCRIPTION
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
man/setup_hda_credentials.Rd | Documentation for HDA credential setup function |
man/get_wekeo_data.Rd | Documentation for get_wekeo_data() |
man/earthkit_download.Rd | Documentation for earthkit_download() |
man/download_seq_media.Rd | Added SEEALSO link to get_wekeo_data() |
man/download_gdrive_if_missing.Rd | Added SEEALSO link to get_wekeo_data() |
man/download_dep_media.Rd | Added SEEALSO link to get_wekeo_data() |
R/get_wekeo_data.R | Implementation of get_wekeo_data() , earthkit_download() , and setup_hda_credentials() |
NAMESPACE | Exported get_wekeo_data() |
DESCRIPTION | Added reticulate, terra, getPass dependencies |
Comments suppressed due to low confidence (3)
R/get_wekeo_data.R:88
- Parameters
productType
,resolution
,startdate
, andenddate
lack default values, making them required despite being documented as optional. Consider providing defaults (e.g., NULL) to align the signature with the documentation.
startIndex = 0){
NAMESPACE:16
- Functions
earthkit_download
andsetup_hda_credentials
have .Rd documentation but are not exported here. If these are intended for public use, addexport(earthkit_download)
andexport(setup_hda_credentials)
.
export(get_wekeo_data)
man/get_wekeo_data.Rd:51
- [nitpick] Grammar could be improved for clarity. For example: 'To install the toolkit, please contact the ICT helpdesk at \email{ict.helpdesk@inbo.be}'.
To install the toolkit please place ict helpdesk call at \code{ict.helpdesk@inbo.be}
# productType, resolution, startdate, enddate and bbox are optional | ||
# itemsPerPage and startIndex are used for pagination | ||
# The base API request exists of dataset_id | ||
api_request <- paste0('{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building JSON via string concatenation is fragile and error-prone. Consider using jsonlite::toJSON()
to construct the request object accurately.
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SanderDevisscher ik krijg volgende error:
error in evaluating the argument 'x' in selecting a method for function 'rast': C:/Users/martijn_bollen/AppData/Local/r-miniconda/python313.dll - The specified module could not be found. ```
> het lijkt mis to lopen dus mis bij de laatste
} | ||
|
||
# Download the data using the earthkit_download function | ||
r <- earthkit_download( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voorstel: earthkit_download(x)
als output ipv. earthkit_download(x) |> terra::rast()
.
Stel dat een gebruiker een andere package wilt gebruiken om de kaartlaag in te laden.
Dan zou je de functie dus als volgt gebruiken: get_wekeo_data(dataset_id, api_request) |> terra::rast()
R/get_wekeo_data.R
Outdated
#' | ||
#' # Set up the virtual environment and install required python packages | ||
#' py_env <- "myenv" # Change this to your desired virtual environment name | ||
#' # 0. Create the virtualenv if needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanneer er nog geen versie van Python geïnstalleerd is kan er geen virtualenv gecreëerd worden.
Best volgende code toevoegen:
# 0. Install python and create the virtualenv if needed
if(!reticulate::py_available()) {
reticulate::install_python()
}
if (!py_env %in% reticulate::virtualenv_list()) {
reticulate::virtualenv_create(py_env)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventueel ook nog toevoegen hoe je de authenticatie autmatisch laat verlopen cfr. ~Renviron
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
werkt dat met renviron ?
fixes #111 door het maken van een functie
get_wekeo_data()
om raster lagen van Copernicus.eu te downloaden. Deze functie maakt gebruik van python dus wat setup is benodigd om de functie te gebruiken, lees dus zeker de details grondig en volg de stappen van het voorbeeld.Naast
get_wekeo_data()
bevat deze PR ook de volgende helper functiesearthkit_download()
&setup_hda_credentials()