Commit de62db64 authored by Clement Brizard's avatar Clement Brizard

Put results figures in specific folders

parent 5f62d86a
......@@ -2,7 +2,6 @@
.ipynb_checkpoints
.DS_Store
._*
*.png
*.pyc
......
......@@ -95,9 +95,10 @@ def cluster_by_period(start, end):
plt.plot(x, y, 'bx-')
plt.vlines(kn.knee, plt.ylim()[0], plt.ylim()[1], linestyles='dashed')
if os.path.isfile('elbow.png'):
os.remove('elbow.png')
plt.savefig('elbow.png')
filename = 'results/cluster_by_period/{}_{}_elbow.png'.format(start, end)
if os.path.isfile(filename):
os.remove(filename)
plt.savefig(filename)
plt.clf()
# Then we cluster with the computed optimal k
......@@ -128,11 +129,12 @@ def cluster_by_period(start, end):
plt.title('Clustering des stations entre {} et {}'.format(start, end), fontsize = 10)
if os.path.isfile('clusters_map.png'):
os.remove('clusters_map.png')
plt.savefig('clusters_map.png')
filename = 'results/cluster_by_period/{}_{}.png'.format(start, end)
if os.path.isfile(filename):
os.remove(filename)
plt.savefig(filename)
logging.info('Success : update your files and check \'clusters_map.png\' !')
logging.info('Success : update your files and check the result in \'results/cluster_by_period\' !')
logging.info('NB : you can also check \'elbow.png\' to see how we chose the clusters number.')
plt.clf()
......
......@@ -83,11 +83,12 @@ def map_by_indicator_and_time(indicator, date, hour):
plt.title('{} in Finland the {} at {}H'.format(indicator, date, hour))
if os.path.isfile('indicator_map.png'):
os.remove('indicator_map.png')
plt.savefig('indicator_map.png')
filename = 'results/map_by_indicator/{}_{}_{}'.format(indicator, date, hour)
if os.path.isfile(filename):
os.remove(filename)
plt.savefig(filename)
logging.info('Success : update your files and check \'indicator_map.png\' !')
logging.info('Success : update your files and check the result in \'results/map_by_indicator\' !')
plt.clf()
map_by_indicator_and_time(sys.argv[1], sys.argv[2], sys.argv[3])
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment