Skip to content

Instantly share code, notes, and snippets.

@jsta
Last active January 10, 2019 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsta/2c82af2399bce2ead477727b3e1e2532 to your computer and use it in GitHub Desktop.
Save jsta/2c82af2399bce2ead477727b3e1e2532 to your computer and use it in GitHub Desktop.
Testing write_nml from glmtools
library(glmtools)
## before PR
## setting a vector of values does not work
glm_nml <- read_nml()
glm_nml <- set_nml(glm_nml, arg_name = 'inflow_fl', arg_val = c("yahara.csv", "yahara2.csv"))
get_nml_value(glm_nml, arg_name = "inflow_fl")
# > "yahara.csv" "yahara2.csv"
write_path <- paste0(tempdir(),'glm2.nml')
write_nml(glm_nml, file = write_path)
get_nml_value(read_nml(write_path), arg_name = "inflow_fl")
# > NA NA
## after PR
## setting a vector of values works
glm_nml <- read_nml()
glm_nml <- set_nml(glm_nml, arg_name = 'inflow_fl', arg_val = c("yahara.csv", "yahara2.csv"))
get_nml_value(glm_nml, arg_name = "inflow_fl")
# > "yahara.csv,yahara2.csv"
write_path <- paste0(tempdir(),'glm2.nml')
write_nml(glm_nml, file = write_path)
get_nml_value(read_nml(write_path), arg_name = "inflow_fl")
# > "yahara.csv,yahara2.csv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment