Skip to content

Commit

Permalink
file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
squoilin committed Apr 15, 2020
1 parent 9f37409 commit 62f8717
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion dispaset/preprocessing/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,5 +728,13 @@ def build_single_run(config, profiles=None):
with open(os.path.join(sim, 'Inputs.p'), 'wb') as pfile:
pickle.dump(SimData, pfile, protocol=pickle.HIGHEST_PROTOCOL)
logging.info('Build finished')


# Remove previously-created debug files:
debugfile = os.path.join(sim, 'debug.gdx')
if os.path.isfile(debugfile):
try:
os.remove(debugfile)
except OSError:
print ('Could not erase previous debug file ' + debugfile)

return SimData
2 changes: 1 addition & 1 deletion dispaset/preprocessing/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ def mid_term_scheduling(config, TimeStep=None, mts_plot=None):
# Re-index to the main simulation time step:
if config['SimulationTimeStep'] != temp_config['SimulationTimeStep']:
profiles = profiles.reindex(idx_orig, method='nearest')
pickle.dump(profiles, open("temp_profiles.p", "wb"))
pickle.dump(profiles, open(os.path.join(config['SimulationDirectory'],"temp_profiles.p"), "wb"))
return profiles

0 comments on commit 62f8717

Please sign in to comment.