Skip to content
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

exception handling and making plotting routines more compact #16

Open
cchrisgong opened this issue Nov 30, 2021 · 0 comments
Open

exception handling and making plotting routines more compact #16

cchrisgong opened this issue Nov 30, 2021 · 0 comments

Comments

@cchrisgong
Copy link
Owner

cchrisgong commented Nov 30, 2021

  1. exception handling when DTcoup is uncoupled, and no dieter datas are present

read.gdx(gdx, 'qm_budget', 'm') %>% 
  rename('t' = 1, 'regi' = 2)

can generalize functions reading tall or ttot

  vm_cesIO <- read.gdx(gdxName, 'vm_cesIO', factors = FALSE,
                     colNames = c('t', 'regi', 'pf', 'value'))

this would allow other performance type improvement (combine entities of the same unit, etc)

  1. a third alternative besides explicit function and loops
   lapply(iterations, 
       function(iteration) {
            read.gdx(paste0('/tmp/input_', iteration, '.gdx'), 'vm_cesIO', 
                     colNames = c('t', 'regi', 'pf', 'value'), 
                     factors = FALSE) %>% 
                mutate(iteration = iteration) %>% 
                slice_sample(n = 3)
        }) %>% 
     bind_rows()

In summary,

loops:
pro: a bit more readable than functions,
con: if used in another script, need to be imported somehow (true? if so how)

functions:
pro: can be reused for multiple variables and parameters (esp of the same units, can be processed similarly)
con: can have a centralized script, where all var and par are read in, then in plotting scripts they can be adjusted and plotted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant