Ignore:
Timestamp:
03/02/15 17:43:15 (9 years ago)
Author:
labetoulle
Message:

Move common functions to common module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/ConsoGENCMIP6/bin/gencmip6.py

    r2421 r2427  
    9696  os.chdir(current_dir) 
    9797  return res 
     98 
     99 
     100######################################## 
     101def get_input_files(dir_data, file_list): 
     102  """ 
     103  """ 
     104  res = [] 
     105 
     106  for filename in file_list: 
     107    res.append(get_last_file(dir_data, filename)) 
     108 
     109  if None in res: 
     110    print("\nMissing one or more input files, we stop.") 
     111    for f_in, f_out in zip(file_list, res): 
     112      print("=> {}: {}".format(f_in, f_out)) 
     113    exit(1) 
     114 
     115  return res 
     116 
     117 
     118######################################## 
     119def plot_save(img_in, img_out, title): 
     120  """ 
     121  """ 
     122  from matplotlib.backends.backend_pdf import PdfPages 
     123 
     124  dpi = 200. 
     125 
     126  # img_in  = os.path.join(DIR["PLOT"], "{}.pdf".format(img_name)) 
     127 
     128  with PdfPages(img_in) as pdf: 
     129    pdf.savefig(dpi=dpi) 
     130 
     131    # pdf file's metadata 
     132    d = pdf.infodict() 
     133    d["Title"]   = title 
     134    d["Author"]  = os.path.basename(__file__) 
     135    # d["Subject"] = "Time spent over specific commands during create_ts \ 
     136    #                 jobs at IDRIS and four configurations at TGCC" 
     137    # d["Keywords"] = "bench create_ts TGCC IDRIS ncrcat" 
     138    # d["CreationDate"] = dt.datetime(2009, 11, 13) 
     139    # d["ModDate"] = dt.datetime.today() 
     140 
     141  if os.path.isdir(DIR["SAVEPLOT"]): 
     142    # img_out = os.path.join(DIR["SAVEPLOT"], 
     143    #                        "{}_{}.pdf".format(img_name, suffix)) 
     144    shutil.copy(img_in, img_out) 
    98145 
    99146 
Note: See TracChangeset for help on using the changeset viewer.