Skip to content
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

Patch sanitize request #148

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ecmwfr
Title: Interface to 'ECMWF' and 'CDS' Data Web Services
Version: 2.0.1
Version: 2.0.2
Authors@R: c(person(
family = "Hufkens",
given = "Koen",
Expand All @@ -27,9 +27,9 @@ Description: Programmatic interface to the European Centre for Medium-Range
Weather Forecasts dataset web services (ECMWF; <https://www.ecmwf.int/>)
and Copernicus's Data Stores. Allows for easy downloads of weather
forecasts and climate reanalysis data in R. Data stores covered include the Climate Data Store (CDS;
<https://cds-beta.climate.copernicus.eu>), Atmosphere Data Store (ADS;
<https://ads-beta.atmosphere.copernicus.eu>) and Early Warning Data Store (CEMS;
<https://ewds-beta.climate.copernicus.eu>).
<https://cds.climate.copernicus.eu>), Atmosphere Data Store (ADS;
<https://ads.atmosphere.copernicus.eu>) and Early Warning Data Store (CEMS;
<https://ewds.climate.copernicus.eu>).
URL: https://github.com/bluegreen-labs/ecmwfr
BugReports: https://github.com/bluegreen-labs/ecmwfr/issues
Depends:
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ecmwfr 2.0.2

* bug fix, sanitizing data requests which would fail on certain (CAMS) products

# ecmwfr 2.0.1

* fixing bug in batch processing, which stops the process after one download
Expand Down
10 changes: 9 additions & 1 deletion R/service-ds.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,22 @@ ds_service <- R6::R6Class("ecmwfr_ds",
user = private$user
)

# sanizite request before submission
# some product requests can't handle the
# presence of extra fields (e.g. target
# dataset_short_name)
request <- private$request
request$dataset_short_name <- NULL
request$target <- NULL

# get the response for the query provided
response <- httr::VERB(
private$http_verb,
private$request_url(),
httr::add_headers(
"PRIVATE-TOKEN" = key
),
body = list(inputs = private$request),
body = list(inputs = request),
encode = "json"
)

Expand Down
6 changes: 3 additions & 3 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
wf_server <- function(id, service = "cds") {

# set base urls
cds_url <- "https://cds-beta.climate.copernicus.eu/api"
ads_url <- "https://ads-beta.atmosphere.copernicus.eu/api"
cems_url <- "https://ewds-beta.climate.copernicus.eu/api"
cds_url <- "https://cds.climate.copernicus.eu/api"
ads_url <- "https://ads.atmosphere.copernicus.eu/api"
cems_url <- "https://ewds.climate.copernicus.eu/api"

# return url depending on service or id
switch(
Expand Down
14 changes: 4 additions & 10 deletions contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
To report bugs, issues, and/or feature requests please use the
[github](https://github.com) repository:

- [ecmwfr github repository](https://github.com/khufkens/ecmwfr/issues)
- [ecmwfr github repository](https://github.com/bluegreen-labs/ecmwfr/issues)

## Other resources

Expand All @@ -14,14 +14,8 @@ To report bugs, issues, and/or feature requests please use the
- <https://apps.ecmwf.int/datasets/>
Public data sets of the European Centre for Medium-Range Weather Forecasts (ECMWF)

## Authors
## Main author and maintainer

- Koen Hufkens (author and maintainer)
<a href="https://khufkens.com/" target="_new"><span class="fa fa-user"></span></a>
<a href="https://github.com/khufkens/"><span class="fa fa-github"></span></a>
- Koen Hufkens
<a href="https://github.com/bluegreen-labs/"><span class="fa fa-github"></span></a>
<a href="http://orcid.org/0000-0002-5070-8109" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID" height="16"></a>
- Reto Stauffer (contributor)
<a href="https://orcid.org/0000-0002-3798-5507" target="orcid.widget"><img src="https://members.orcid.org/sites/default/files/vector_iD_icon.svg" class="orcid" alt="ORCID" height="16"></a>
<a href="http://retostauffer.org/"><span class="fa fa-user"></span></a>
<a href="https://github.com/retostauffer/"><span class="fa fa-github"></span></a>
<a href="https://twitter.com/RetoStauffer2"><span class="fa fa-twitter-square"></span></a>
15 changes: 9 additions & 6 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
## New release v2.0.1
## New release v2.0.2

Dear CRAN team,

This is a bugfix to the package which would halt the batch downloading
after one donwload completed (due to updates to the argument structure
after the recent API migration). This updates addresses this issue.
No further changes were made.
This is a bugfix to the package which would fail downloads of certain
products due to the handling of unknown query fields. I now sanitize
the requests further.

This updates addresses this issue. No further changes were made.
Given the final migration to the new API at ECMWF you may expect many
more small bug fixes as the API is poorly documented.

Stats on code coverage and test routines remain the same as per pervious
v2.0.0 release.
v2.0.1 release.

Kind regards,
Koen Hufkens
Expand Down
Loading