8000 111 new function get wekeo layer by SanderDevisscher · Pull Request #113 · inbo/fistools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

SanderDevisscher
Copy link
Collaborator

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 functies earthkit_download() & setup_hda_credentials()

@SanderDevisscher SanderDevisscher self-assigned this Jun 26, 2025
@SanderDevisscher SanderDevisscher added Function Issue related to a function New Nieuwe functie/data labels Jun 26, 2025
@SanderDevisscher SanderDevisscher linked an issue Jun 26, 2025 that may be closed by this pull request
18 tasks
Copy link
@Copilot Copilot AI left a 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 reference get_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, and enddate 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 and setup_hda_credentials have .Rd documentation but are not exported here. If these are intended for public use, add export(earthkit_download) and export(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('{
Copy link
Preview
Copilot AI Jun 26, 2025

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.

SanderDevisscher and others added 2 commits June 26, 2025 18:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor
@martijn-bollen martijn-bollen left a 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(
Copy link
Contributor

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()

@martijn-bollen martijn-bollen self-requested a review June 26, 2025 18:45
#'
#' # 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
Copy link
Contributor

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)
} 

Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

werkt dat met renviron ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Function Issue related to a function New Nieuwe functie/data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NEW function] get_wekeo_layer
2 participants
0