-
Notifications
You must be signed in to change notification settings - Fork 5
Adopt API of tar_options_set
for geotargets_options_set
#34
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
Comments
I really like this idea, I have already been bitten by typos and mistakes with these. Being able to use autocomplete and documentation of function parameters/usage would make it much clearer. I also like the idea to get the options in the function argument defaults. This could remove most usages, except in the internal functions we pass to |
- substitute in options, read/write functions following ropensci#43 - add support for reading netCDF via `stars::read_ncdf()` using ropensci#43 - consolidate option getter usage for ropensci#34
I also think we might want to switch the precedence of env variables and options() to have So, something like geotargets_option_get <- function(gdal_raster_creation_options = NULL) {
geotargets_gdal_raster_creation_options <- gdal_raster_creation_options %||%
getOption("geotargets.gdal.raster.creation_options",
default = Sys.getenv("GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS",
unset = "ENCODING=UTF-8"))
...
} |
I asked for some opinions of how to do this in rOpenSci Slack and got two options that both seem good.
I think either of these is compatible with a options_set function, but I'm beginning to think that when run with defaults (i.e. |
Asked for help and got some feedback from Will here: ropensci/targets#1263 (comment) |
targets::tar_options_set()
just uses named args with NULL as default and it might be nice for users to have a similar experience withgeotargets_options_set()
. E.g.And because we are setting these options with defaults on package load, we can do arguments to
tar_*()
functions similar totargets
like so:And remove
geotargets_options_get()
from the body of these functions.The text was updated successfully, but these errors were encountered: