Skip to content

Commit

Permalink
Merge pull request #151 from maledo/runme-copy-main
Browse files Browse the repository at this point in the history
Adjustments to runme.py with fix #144
  • Loading branch information
KSchoenleber authored Sep 7, 2017
2 parents c846e58 + ef4b69a commit 96a8df8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions runme.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def scenario_stock_prices(data):

def scenario_co2_limit(data):
# change global CO2 limit
glob = data['global']
glob.loc['CO2 limit', 'value'] *= 0.05
global_prop = data['global_prop']
global_prop.loc['CO2 limit', 'value'] *= 0.05
return data


Expand Down Expand Up @@ -124,9 +124,6 @@ def run_scenario(input_file, timesteps, scenario, result_dir,
optim = setup_solver(optim, logfile=log_filename)
result = optim.solve(prob, tee=True)

# copy input file to result directory
shutil.copyfile(input_file, os.path.join(result_dir, input_file))

# save problem solution (and input data) to HDF5 file
urbs.save(prob, os.path.join(result_dir, '{}.h5'.format(sce)))

Expand All @@ -151,8 +148,13 @@ def run_scenario(input_file, timesteps, scenario, result_dir,
result_name = os.path.splitext(input_file)[0] # cut away file extension
result_dir = prepare_result_directory(result_name) # name + time stamp

# copy input file to result directory
shutil.copyfile(input_file, os.path.join(result_dir, input_file))
# copy runme.py to result directory
shutil.copyfile(__file__, os.path.join(result_dir, __file__))

# simulation timesteps
(offset, length) = (3500, 168) # time step selection
(offset, length) = (3500, 168) # time step selection
timesteps = range(offset, offset+length+1)

# plotting commodities/sites
Expand Down

0 comments on commit 96a8df8

Please sign in to comment.