DOI-USGS / DOI-USGS/streamMetabolizer
flattened call to metab()?
- Dominant language
- Stan
- Stars
- 47
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
it's obnoxious to always call metab(specs(mm_name(...), ...), data, ...). thanks to `geoknife` conversation with @jread-usgs just now (https://github.com/USGS-R/geoknife/issues/269), i think i could make just one set of parentheses work reasonably. would look like this:
old way (which should & will stick around):
``` r
metab(specs(mm_name(...), ...), data, ...)
# or
mm_name() %>% specs() %>% metab()
```
new, complementary way?:
``` r
metab('bayes', ode_method='Euler', pool_K600=TRUE, split_dates=FALSE,
engine='stan', K600_daily_beta_num=7, n_chains=3)
```
where `engine` would get sent to `mm_name()`, then `mm_name()` output would get passed to `specs()`; all the other arguments are largely unique or intentionally redundant.
```
> intersect(names(formals(mm_name)), names(formals(streamMetabolizer::specs)))
[1] "engine"
> intersect(names(formals(metab)), names(formals(streamMetabolizer::specs)))
character(0)
> intersect(names(formals(metab)), names(formals(mm_name)))
character(0)
> names(formals(mm_name))
[1] "type" "pool_K600" "err_obs_iid" "err_proc_acor"
[5] "err_proc_iid" "ode_method" "deficit_src" "engine"
[9] "check_validity"
> names(formals(streamMetabolizer::specs))
[1] "model_name" "engine"
[3] "day_start" "day_end"
[5] "day_tests" "GPP_init"
[7] "ER_init" "K600_init"
[9] "calc_DO_fun" "ODE_method"
[11] "split_dates" "keep_mcmcs"
[13] "GPP_daily_mu" "GPP_daily_sigma"
[15] "ER_daily_mu" "ER_daily_sigma"
[17] "K600_daily_mu" "K600_daily_sigma"
[19] "K600_daily_mu_mu" "K600_daily_mu_sigma"
[21] "K600_daily_beta_mu" "K600_daily_beta_sigma"
[23] "K600_daily_beta_num" "K600_daily_beta_cuts"
[25] "K600_daily_sigma_shape" "K600_daily_sigma_rate"
[27] "err_obs_iid_sigma_shape" "err_obs_iid_sigma_rate"
[29] "err_proc_acor_phi_shape" "err_proc_acor_phi_rate"
[31] "err_proc_acor_sigma_shape" "err_proc_acor_sigma_rate"
[33] "err_proc_iid_sigma_shape" "err_proc_iid_sigma_rate"
[35] "priors" "params_out"
[37] "n_chains" "n_cores"
[39] "adapt_steps" "burnin_steps"
[41] "saved_steps" "thin_steps"
[43] "verbose" "weights"
[45] "filters" "predictors"
[47] "transforms" "other_args"
[49] "err.obs.sigma" "err.obs.phi"
[51] "err.proc.sigma" "err.proc.phi"
[53] "sim.seed"
> names(formals(metab))
[1] "specs" "data" "data_daily" "info"
```
it could work. it's not immediately essential but could improve the user experience. will ask for input from Bob & Mark & OWIDS team in next few weeks.
Contributor guide
Assessment
This issue has not been assessed yet.