Index: TOOLS/ConsoGENCI/trunk/bin/init_alloc_tbl.py
===================================================================
--- TOOLS/ConsoGENCI/trunk/bin/init_alloc_tbl.py	(revision 2775)
+++ TOOLS/ConsoGENCI/trunk/bin/init_alloc_tbl.py	(revision 2776)
@@ -21,5 +21,4 @@
 
 # standard library imports
-# from pprint import pprint
 
 # Application library imports
@@ -115,11 +114,4 @@
   ]
 
-  # Connection info
-  # db_host = "134.157.170.104"
-  # # db_port = "5432"
-  # db_name = "prodiguer"
-  # db_user = "prodiguer_db_user"
-  # # db_pwd = "secret"
-
   conn, cursor = cdb.connect_db(
     db_data.db_host,
Index: TOOLS/ConsoGENCI/trunk/bin/init_conso_tbl.py
===================================================================
--- TOOLS/ConsoGENCI/trunk/bin/init_conso_tbl.py	(revision 2775)
+++ TOOLS/ConsoGENCI/trunk/bin/init_conso_tbl.py	(revision 2776)
@@ -16,5 +16,4 @@
 import os
 import math
-# import datetime as dt
 from argparse import ArgumentParser
 import pprint
@@ -42,16 +41,4 @@
   parser.add_argument("-r", "--range", action="store", nargs=2,
                       help="date range: ssaammjj ssaammjj")
-
-  # parser.add_argument("-f", "--full", action="store_true",
-  #                     help="plot the whole period")
-  # parser.add_argument("-i", "--increment", action="store",
-  #                     type=int, default=1, dest="inc",
-  #                     help="sampling increment")
-  # parser.add_argument("-m", "--max", action="store_true",
-  #                     help="plot with y_max = allocation")
-  # parser.add_argument("-s", "--show", action="store_true",
-  #                     help="interactive mode")
-  # parser.add_argument("-d", "--dods", action="store_true",
-  #                     help="copy output on dods")
 
   return parser.parse_args()
@@ -87,9 +74,4 @@
   if args.verbose:
     print("Connection to database")
-  # db_host = "134.157.170.104"
-  # # db_port = "5432"
-  # db_name = "prodiguer"
-  # db_user = "prodiguer_db_user"
-  # # db_pwd = "secret"
   conn, cursor = cdb.connect_db(
     db_data.db_host,
@@ -102,11 +84,8 @@
   table_name = "conso.tbl_allocation"
   request = (
-    # "SELECT id "
     "SELECT * "
     "FROM " + table_name + " "
     "WHERE project = '" + args.project + "'"
     "  AND centre = '" + args.center + "'"
-    # "  AND start_date < '" + dt.datetime.strftime(date, "%Y-%m-%d") + "'"
-    # "  AND end_date > '" + dt.datetime.strftime(date, "%Y-%m-%d") + "'"
     "ORDER BY start_date"
     ";"
@@ -163,8 +142,4 @@
     ]
 
-    # print(lines_req)
-
-    # exit()
-
     # ... Create full request ...
     # ---------------------------
Index: TOOLS/ConsoGENCI/trunk/bin/insert_conso_tbl.py
===================================================================
--- TOOLS/ConsoGENCI/trunk/bin/insert_conso_tbl.py	(revision 2775)
+++ TOOLS/ConsoGENCI/trunk/bin/insert_conso_tbl.py	(revision 2776)
@@ -16,5 +16,4 @@
 import os
 import math
-# import datetime as dt
 from argparse import ArgumentParser
 import shutil
@@ -43,17 +42,4 @@
   parser.add_argument("-r", "--range", action="store", nargs=2,
                       help="date range: ssaammjj ssaammjj")
-
-  # parser.add_argument("-f", "--full", action="store_true",
-  #                     help="plot the whole period")
-  # parser.add_argument("-i", "--increment", action="store",
-  #                     type=int, default=1, dest="inc",
-  #                     help="sampling increment")
-  # parser.add_argument("-m", "--max", action="store_true",
-  #                     help="plot with y_max = allocation")
-  # parser.add_argument("-s", "--show", action="store_true",
-  #                     help="interactive mode")
-  # parser.add_argument("-d", "--dods", action="store_true",
-  #                     help="copy output on dods")
-
   return parser.parse_args()
 
@@ -94,9 +80,4 @@
   if args.verbose:
     print("Connection to database")
-  # db_host = "134.157.170.104"
-  # # db_port = "5432"
-  # db_name = "prodiguer"
-  # db_user = "prodiguer_db_user"
-  # # db_pwd = "secret"
   conn, cursor = cdb.connect_db(
     db_data.db_host,
@@ -109,11 +90,8 @@
   table_name = "conso.tbl_allocation"
   request = (
-    # "SELECT id "
     "SELECT * "
     "FROM " + table_name + " "
     "WHERE project = '" + args.project + "'"
     "  AND centre = '" + args.center + "'"
-    # "  AND start_date < '" + dt.datetime.strftime(date, "%Y-%m-%d") + "'"
-    # "  AND end_date > '" + dt.datetime.strftime(date, "%Y-%m-%d") + "'"
     "ORDER BY start_date"
     ";"
@@ -128,7 +106,24 @@
     allocs.append(ccpt.AllocRow(row))
 
-  # .. Build dictionary from files ..
-  # =================================
+  # .. Process files ..
+  # ===================
   for filename in filelist:
+
+    fileout = os.path.join(dirout, os.path.basename(filename))
+    if os.path.isfile(fileout):
+      print(
+        "file {} already processed, remove file".format(
+          os.path.basename(filename)
+        )
+      )
+      if not args.dryrun:
+        try:
+          os.remove(filename)
+        except Exception as rc:
+          print("Could not move {}:\n{}".format(filename, rc))
+      break
+
+    # .. Build dictionary from files ..
+    # =================================
     conso_per_alloc = {}
 
Index: TOOLS/ConsoGENCI/trunk/bin/libconso.py
===================================================================
--- TOOLS/ConsoGENCI/trunk/bin/libconso.py	(revision 2775)
+++ TOOLS/ConsoGENCI/trunk/bin/libconso.py	(revision 2776)
@@ -18,5 +18,4 @@
 import os.path
 import glob
-import shutil
 import subprocess
 import datetime as dt
@@ -39,4 +38,5 @@
   command = [
     "scp",
+    "-v",
     img_out,
     "{}@{}:{}".format(
@@ -46,4 +46,5 @@
     )
   ]
+  print(command)
   try :
     subprocess.call(command)
@@ -56,8 +57,9 @@
   command = ["convert", "-density", "200", img_out, img_png]
 
+  print(command)
   try :
     subprocess.call(command)
   except Exception as rc :
-    print("Error in convert for {}:\n{}".format(fileout, rc))
+    print("Error in convert for {}:\n{}".format(img_out, rc))
 
   # .. Copy png file to dods server ..
@@ -65,4 +67,5 @@
   command = [
     "scp",
+    "-v",
     img_png,
     "{}@{}:{}".format(
@@ -72,4 +75,6 @@
     )
   ]
+
+  print(command)
   try :
     subprocess.call(command)
@@ -79,22 +84,8 @@
   # .. Delete temporary png file ..
   # ===============================
-
-  return
-
-  basefile = os.path.basename(filein)
-
-  fileout = os.path.join(DIR["DODS"], basefile)
-  filepng = os.path.join(DIR["DODS"], "img", basefile.split(".")[0] + ".png")
-
-  #Â Copy file
-  shutil.copy(filein, fileout)
-
-  # Convert it to png for web page
-  command = ["convert", "-density", "200", fileout, filepng]
-
-  try :
-    subprocess.call(command)
-  except Exception as rc :
-    print("Error in convert for {}:\n{}".format(fileout, rc))
+  try:
+    os.remove(img_png)
+  except Exception as rc:
+    print("Could not remove {}:\n{}".format(img_png, rc))
 
   return
@@ -120,5 +111,5 @@
   section = "projet"
   option  = "name"
-  project_name = config.get(section, option)
+  # project_name = config.get(section, option)
 
   # ... Common directories ...
@@ -179,8 +170,8 @@
     try:
       res = dt.datetime.strptime(ssaammjj, fmt)
-    except Exception as rc:
+    except Exception:
       pass
     else:
-      break 
+      break
 
   return res.date()
@@ -304,5 +295,5 @@
     self.days = delta.days + 1
 
-    self.daily_conso = self.alloc / self.days 
+    self.daily_conso = self.alloc / self.days
 
   #---------------------------------------------------------------------
@@ -369,5 +360,4 @@
     )
 
-
     self.days = sum(
       [item.days for item in self.alloc_items]
@@ -379,5 +369,5 @@
   def get_theo_eq(self, dates):
 
-    x0 = 0
+    # x0 = 0
     y0 = 0.
 
@@ -385,5 +375,5 @@
       yi = y0
       yf = y0 + item.alloc / self.alloc
-      
+
       if item.start_date.date() in dates:
         xi = dates.index(item.start_date.date())
@@ -410,5 +400,5 @@
         item.yi = yi
         item.yf = yf
-      
+
       y0 = yf
 
Index: TOOLS/ConsoGENCI/trunk/bin/libconso_cpt.py
===================================================================
--- TOOLS/ConsoGENCI/trunk/bin/libconso_cpt.py	(revision 2775)
+++ TOOLS/ConsoGENCI/trunk/bin/libconso_cpt.py	(revision 2776)
@@ -24,6 +24,4 @@
 import os
 import glob
-# import psycopg2
-# import psycopg2.extras
 import pprint
 
Index: TOOLS/ConsoGENCI/trunk/bin/plot_bilan.py
===================================================================
--- TOOLS/ConsoGENCI/trunk/bin/plot_bilan.py	(revision 2775)
+++ TOOLS/ConsoGENCI/trunk/bin/plot_bilan.py	(revision 2776)
@@ -15,13 +15,10 @@
 # standard library imports
 from argparse import ArgumentParser
-# import os
-# import pprint
 import datetime as dt
-from dateutil.relativedelta import relativedelta
 import numpy as np
 
 # Application library imports
 from libconso import *
-import libconsodb as cdb
+import libconso_db as cdb
 import db_data
 
@@ -226,13 +223,14 @@
   )
 
+
 ########################################################################
 def plot_config(
   fig, ax_conso, ax_theo,
   xcoord, dates, max_real_use,
-  title, projet
+  title, faitle, projet
 ):
   """
   """
-  from matplotlib.ticker import AutoMinorLocator
+  # from matplotlib.ticker import AutoMinorLocator
 
   # ... Config axes ...
@@ -293,5 +291,4 @@
   )
 
-  
   # 3) Ticks labels
   (date_beg, date_end) = (dates[0], dates[-1])
@@ -362,5 +359,5 @@
     "Allocation(s):\n" +
     "\n".join([
-      "{:%d-%m-%Y}-{:%d-%m-%Y} : {:8,.0f}h".format(
+      "{:%d/%m/%Y}-{:%d/%m/%Y} : {:8,.0f}h".format(
         item.start_date, item.end_date, item.alloc
       ) for item in projet.alloc_items
@@ -368,7 +365,12 @@
   )
   plt.figtext(
-    x=0.92, y=0.93, s=alloc_label,
+    x=0.92, y=0.93, s=alloc_label.replace(",", " "),
     backgroundcolor="linen",
     ha="right", va="bottom", fontsize="x-small"
+  )
+
+  plt.figtext(
+    x=0.5, y=0.93, s=faitle,
+    ha="center", va="bottom", fontsize="large"
   )
 
@@ -592,17 +594,24 @@
         break
     theo_uses.append(100. * poly_theo(dates.index(date)))
-  delay_uses = delay * [0.,] + theo_uses[:-delay]
+  delay_uses = delay * [0., ] + theo_uses[:-delay]
   theo_uses = np.array(theo_uses, dtype=float)
   delay_uses = np.array(delay_uses, dtype=float)
 
-
-  run_mean = np.array([item.run_mean for item in selected_items],
-                       dtype=float)
-  pen_mean = np.array([item.pen_mean for item in selected_items],
-                       dtype=float)
-  run_std  = np.array([item.run_std for item in selected_items],
-                       dtype=float)
-  pen_std  = np.array([item.pen_std for item in selected_items],
-                       dtype=float)
+  run_mean = np.array(
+    [item.run_mean for item in selected_items],
+    dtype=float
+  )
+  pen_mean = np.array(
+    [item.pen_mean for item in selected_items],
+    dtype=float
+  )
+  run_std  = np.array(
+    [item.run_std for item in selected_items],
+    dtype=float
+  )
+  pen_std  = np.array(
+    [item.pen_std for item in selected_items],
+    dtype=float
+  )
 
   # .. Plot stuff ..
@@ -627,6 +636,12 @@
   #   projet.end_date
   # )
-  title = "Consommation {}\n(le {:%d/%m/%Y})".format(
+  # title = "Consommation {}\n(le {:%d/%m/%Y})".format(
+  #   projet.project.upper(),
+  #   today,
+  # )
+  title = "Consommation {})".format(
     projet.project.upper(),
+  )
+  faitle = "(le {:%d/%m/%Y})".format(
     today,
   )
@@ -635,8 +650,6 @@
     fig, ax_conso, ax_theo,
     xcoord, dates, real_uses[dates.index(last_filled_date)],
-    title, projet
-  )
-
-  
+    title, faitle, projet
+  )
 
   # ... Save figure ...
@@ -662,3 +675,2 @@
 
   # exit(0)
-
