bluegreen-labs/ecmwfr

Using request string in `wf_request()`

eliocamp opened this issue · 4 comments

I was wondering if it would be a good idea to support using copy-pasted request string as ' request' parameter. Something like:

wf_request("
c.retrieve(
    'sis-water-level-change-timeseries',
    {
        'format': 'tgz',
        'variable': 'mean_sea_level',
        'experiment': 'rcp4_5',
        'year': '2072',
    },
    'download.tar.gz')")

The string would be passed to the python to list functionality already used for the addin.

My motivation is that perhaps if users can skip the formatting step, then you would get fewer issues related to badly-formatted requests.

Good idea.

We already check for the service which is running, which determines which code to call if doing conversions on the fly.

wf_check <- wf_check[[correct]]

Normal requests are lists, so if we convert any string that is passed it should be OK.

Only concern is trapping errors with respect to the use of ' and ". Guaranteed that the first bug report will be of someone using ' instead of ". Not sure you can actually trap this as it will just mess up argument parsing with the commas thrown in the mix.

btw. do you need this soon for your demo? Roughly implementing this shouldn't take too long, but before things are on CRAN I'm probably looking at 2 weeks on as I need to cover some other stuff as well.

The tutorial is for useR!2021 so, if chosen, it will be on July. There's plenty of time :)

I'm closing this for now. Doesn't seem a priority. I also am worried about the issue with trapping errors and people copying too much or too little. Although fast and convenient it can also be a support nightmare. Outside translations are visible, hence are the errors if doing so.