bluegreen-labs / ecmwfr

Interface to the public ECMWF API Web Services
https://bluegreen-labs.github.io/ecmwfr/
Other
106 stars 30 forks source link

Adds support for run_workflow #108

Closed eliocamp closed 1 year ago

eliocamp commented 1 year ago

This adds support for the run_workflow endpoint allowing the user to perform potentially arbitrary computations in the CDS service. (Would Close #107 and more)

It should work with something like this:

code <- readLines("analysis/clim") |>
  paste0(collapse = "\n")

request = list(
  code = code,
  kwargs = list(
    "dataset" = "reanalysis-era5-single-levels",
    "product_type" = "reanalysis",
    "variable" = "2m_temperature",
    "statistic" = "daily_mean",
    "year" = "2020",
    "month" = "01",
    "time_zone" = "UTC+00:0",
    "frequency" = "1-hourly",
    "grid" = "0.25/0.25",
    "area" = list(
      lat = list(40, 45),
      lon = list(-0,20)
    )
  ),
  workflow_name = "application",
  target = "test.nc"
)

file <- wf_request(request)
eliocamp commented 1 year ago

This works now. I love that the R6 refactor is finally paying off since I had to modify very little to incorporate this new service :tada:.

@khufkens You might to play around and kick the tires a bit.

Still missing:

That last is kind of tricky because I'm not sure where to document this. Perhaps in a vignette?

khufkens commented 1 year ago

@eliocamp I'll fix the last little bits on my commute tomorrow. Thanks for the quick turnaround.