Index: TOOLS/ConsoGENCMIP6/bin/plot_login.py
===================================================================
--- TOOLS/ConsoGENCMIP6/bin/plot_login.py	(revision 2425)
+++ TOOLS/ConsoGENCMIP6/bin/plot_login.py	(revision 2427)
@@ -10,6 +10,4 @@
 import os.path
 import numpy as np
-# import matplotlib.pyplot as plt
-# from matplotlib.backends.backend_pdf import PdfPages
 
 # Application library imports
@@ -26,11 +24,17 @@
   #---------------------------------------
   def fill_data(self, filein):
-    data = np.genfromtxt(
-      filein,
-      skip_header=1,
-      converters={0: string_to_date,
-                  1: str},
-      missing_values="nan",
-    )
+    """
+    """
+    try:
+      data = np.genfromtxt(
+        filein,
+        skip_header=1,
+        converters={0: string_to_date,
+                    1: str},
+        missing_values="nan",
+      )
+    except:
+      print("Empty file {}".format(filein))
+      exit(1)
 
     for date, login, conso in data:
@@ -87,7 +91,4 @@
   """
   """
-  print(ycoord)
-  print(consos)
-
   ax.barh(ycoord, consos, align="center", color="linen",
           linewidth=0.2, label="conso (heures)")
@@ -119,22 +120,29 @@
 
 
-########################################
-def plot_save(img_name):
-  """
-  """
-  dpi = 200.
-
-  with PdfPages(img_name) as pdf:
-    pdf.savefig(dpi=dpi)
-
-    # pdf file's metadata
-    d = pdf.infodict()
-    d["Title"]   = "Conso GENCMIP6 par login"
-    d["Author"]  = "plot_bilan.py"
-    # d["Subject"] = "Time spent over specific commands during create_ts \
-    #                 jobs at IDRIS and four configurations at TGCC"
-    # d["Keywords"] = "bench create_ts TGCC IDRIS ncrcat"
-    # d["CreationDate"] = dt.datetime(2009, 11, 13)
-    # d["ModDate"] = dt.datetime.today()
+# ########################################
+# def plot_save(img_name):
+#   """
+#   """
+#   dpi = 200.
+
+#   img_in  = os.path.join(DIR["PLOT"], "{}.pdf".format(img_name))
+
+#   with PdfPages(img_in) as pdf:
+#     pdf.savefig(dpi=dpi)
+
+#     # pdf file's metadata
+#     d = pdf.infodict()
+#     d["Title"]   = "Conso GENCMIP6 par login"
+#     d["Author"]  = "plot_bilan.py"
+#     # d["Subject"] = "Time spent over specific commands during create_ts \
+#     #                 jobs at IDRIS and four configurations at TGCC"
+#     # d["Keywords"] = "bench create_ts TGCC IDRIS ncrcat"
+#     # d["CreationDate"] = dt.datetime(2009, 11, 13)
+#     # d["ModDate"] = dt.datetime.today()
+
+#   if os.path.isdir(DIR["SAVEPLOT"]):
+#     img_out = os.path.join(DIR["SAVEPLOT"],
+#                            "{}_{}.pdf".format(img_name, today))
+#     shutil.copy(img_in, img_out)
 
 
@@ -173,5 +181,5 @@
 
   import matplotlib.pyplot as plt
-  from matplotlib.backends.backend_pdf import PdfPages
+  # from matplotlib.backends.backend_pdf import PdfPages
 
   if not args.show:
@@ -180,14 +188,17 @@
   # ... Files and directories ...
   # -----------------------------
-  file_param = get_last_file(DIR["SAVE"], OUT["PARAM"])
-  file_utheo = get_last_file(DIR["SAVE"], OUT["UTHEO"])
-  file_login = get_last_file(DIR["SAVE"], OUT["LOGIN"])
-  img_name = "bilan.pdf"
+  (file_param, file_utheo, file_data) = \
+      get_input_files(DIR["SAVEDATA"],
+                      [OUT["PARAM"], OUT["UTHEO"], OUT["LOGIN"]])
+
+  img_name = "login"
+  today = os.path.basename(file_param).strip(OUT["PARAM"])
 
   if args.verbose:
     print(file_param)
     print(file_utheo)
-    print(file_login)
+    print(file_data)
     print(img_name)
+    print(today)
 
   # .. Get project info ..
@@ -202,5 +213,5 @@
   # ----------------------
   logins = LoginDict()
-  logins.fill_data(file_login)
+  logins.fill_data(file_data)
 
   # .. Extract data depending on C.L. arguments ..
@@ -245,5 +256,5 @@
   # ... Save figure ...
   # -------------------
-  plot_save(os.path.join(DIR["PLOT"], img_name))
+  plot_save(img_name, today, "Conso GENCMIP6 par login")
 
   # ... Publish figure on dods ...
@@ -255,3 +266,3 @@
     plt.show()
 
-  exit()
+  exit(0)
