Enhance ERA5 Download Function: Direct NetCDF, Flexible Parameters, and Improved Docs - #3547
Conversation
dlebauer
left a comment
There was a problem hiding this comment.
Looks great - thanks for these tests.
I'm running one of the examples, and it has been running for ~20 minutes. How long do you expect the examples to take? This seems long for an example / proof of concept.
I've made a few minor suggestions, including one that generally applies to your work - please add your name to the author field when you have made non-trivial changes to functions!
| #' @export | ||
| #' | ||
| #' @importFrom purrr %>% | ||
| #' @author Dongchen Zhang |
There was a problem hiding this comment.
| #' @author Dongchen Zhang | |
| #' @author Dongchen Zhang, Akash BV |
There was a problem hiding this comment.
As commented elsewhere, we use pkg::fn notation which makes @importFrom not necessary
dlebauer
left a comment
There was a problem hiding this comment.
Hi @divine7022 thanks again for this major update to the ERA5 code, it looks great - and is very close!
Mostly there are just a few minor changes to implement, including a number of suggested changes that you 👍🏻 but were not committed. These are now marked 'outdated' but not 'resolved'.
| #' @export | ||
| #' | ||
| #' @importFrom purrr %>% | ||
| #' @author Dongchen Zhang |
There was a problem hiding this comment.
As commented elsewhere, we use pkg::fn notation which makes @importFrom not necessary
| download.ERA5_cds <- function(outfolder, start_date, end_date, | ||
| extent, variables, time = NULL, dataset = "reanalysis-era5-single-levels", | ||
| product_type = "ensemble_members", user = NULL, key = NULL, timeout = 36000) { |
There was a problem hiding this comment.
this is the current function signature;
auto.create.key = TRUE argument is outdated -- it was used when the function relied on Python via reticulate.
Now that we’ve switched to using ecmwfr.
There was a problem hiding this comment.
Are user and key optional or required here? A NULL default typically means more or less "the function will figure this out if not provided", which would be aligned with the previous getnetrc approach. But on a quick skim below I see an error if user or key are null and didn't see anything that would fill them in before that -- if they're now required arguments that's fine but might as well remove the default value to make that clearer.
There was a problem hiding this comment.
thanks! @infotroph now removed NULL defaults for user/key parameters
@dlebauer thanks! for the catch - now uses base R pipe |
Thank you for that change! Note that this means the package now requires a version of R new enough to contain the base pipe, but I don't think the package checks detect this yet. Can you please add |
|
thanks @infotroph now |
dlebauer
left a comment
There was a problem hiding this comment.
Thanks for making these changes - looks like all requested changes have been made.
Apologies some of my earlier requests were based outdated code.
|
Thanks for approving @dlebauer |
42bbe7a
Description
This PR refactors the
download.ERA5_cdsfunction to:netcdfformat (removesgrib_to_netcdfconversion dependency).product type,dataset, andtime steps(no longer hardcoded).extentargument to ensure correct spatial subsetting as required by the API.cdsapiviareticulate) and migrating to the native Recmwfrpackagetest.download.ERA5_cds.R)Motivation and Context
Review Time Estimate
Types of changes
Checklist: