bioRad
bioRad copied to clipboard
Use 5 letter radar codes and drop "country" argument in download_vpfiles() and select_vpfiles()
download_vpfiles()
currently requires both the argument radar
and country
to be provided. But it combines them in a way that leads to non-existing radars and thus files that cannot be downloaded:
download_vpfiles(
date_min = "2016-10-01",
date_max = "2016-12-31",
country = c("be", "se"),
radar = c("jab", "wid", "ang"),
directory = "my_data"
)
Will search for:
bejab: ok
sejab: error
bewid: ok
sewid: error
beang: error
seang: ok
Given that both arguments are required anyway (radar without country does not work and vice versa) and to avoid against creating radar codes that do not exist, I would argue to drop the country
parameter, and let the user explicitly provide 5 letter radar codes in radar
:
download_vpfiles(
date_min = "2016-10-01",
date_max = "2016-12-31",
radar = c("bejab", "bewid", "seang"),
directory = "my_data"
)
For the parallel function select_vpfiles()
select_vpfiles(
date_min = "2016-10-01",
date_max = "2016-12-31",
# country = c("be"),
radar = c("wid"),
directory = "my_data"
)
The radar and country ARE optional, i.e. one can correctly search for dates, dates + radars, dates + countries or all 3. Still, I would opt here too to drop the country parameter and ask for 5 letter radar codes, because:
- 3 letter radar codes can be shared between countries, leading to unexpected results. Better if the user is explicit
- I think most analyses want to be explicit about the radars they select
- That way we can keep
download_vpfiles()
andselect_vpfiles()
similar (e.g. you can reuse a radar code list to download and select)
I don't think this will break current functionality. @adokter @stijnvanhoey @CeciliaNilsson709 comments?
I think this makes a lot of sense, especially since not all countries follow the country+radar ODIM code properly anyway, and, as you say, the three letter radar code is not unique between countries which has caused confusion in the past.
I agree, should indeed not break anything (just taing care of backward compatibility).
@stijnvanhoey question about arguments and positions:
Currently:
download_vpfiles(date_min, date_max, country, radar, directory = ".")
select_vpfiles(directory, date_min, date_max, country = NULL, radar = NULL)
Is it OK to reorder and rename (for radars) these arguments to:
download_vpfiles(directory = ".", date_min, date_max, radars, overwrite = FALSE)
select_vpfiles(directory, date_min, date_max, radars)
Or would you do this differently?
@stijnvanhoey see #176: I opted to move directory
to last parameter in select_vpfiles()
(all parameters are optional there), so non-optional arguments for download_vpfiles()
can remain at the beginning.
This was implemented in #176 in 2018 and was included in bioRad 0.4.0.