Ignore:
Timestamp:
03/02/15 15:50:26 (9 years ago)
Author:
labetoulle
Message:

Save daily plots on WORK

File:
1 edited

Legend:

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

    r2417 r2425  
    1010import os.path 
    1111import numpy as np 
    12 import matplotlib.pyplot as plt 
    13 from matplotlib.backends.backend_pdf import PdfPages 
     12# import matplotlib.pyplot as plt 
     13# from matplotlib.backends.backend_pdf import PdfPages 
    1414 
    1515# Application library imports 
     
    147147                      help="plot all the logins" + 
    148148                           " (default: plot only non-zero)") 
     149  parser.add_argument("-s", "--show", action="store_true", 
     150                      help="interactive mode") 
     151  parser.add_argument("-d", "--dods", action="store_true", 
     152                      help="copy output on dods") 
    149153 
    150154  return parser.parse_args() 
     
    159163  # ------------------------------ 
    160164  args = get_arguments() 
     165  if args.verbose: 
     166    print(args) 
     167 
     168  # ... Turn interactive mode off ... 
     169  # --------------------------------- 
     170  if not args.show: 
     171    import matplotlib 
     172    matplotlib.use('Agg') 
     173 
     174  import matplotlib.pyplot as plt 
     175  from matplotlib.backends.backend_pdf import PdfPages 
     176 
     177  if not args.show: 
     178    plt.ioff() 
    161179 
    162180  # ... Files and directories ... 
    163181  # ----------------------------- 
    164   file_param = get_last_file(DIR["DATA"], OUT["PARAM"]) 
    165   file_utheo = get_last_file(DIR["DATA"], OUT["UTHEO"]) 
    166   file_login = get_last_file(DIR["DATA"], OUT["LOGIN"]) 
     182  file_param = get_last_file(DIR["SAVE"], OUT["PARAM"]) 
     183  file_utheo = get_last_file(DIR["SAVE"], OUT["UTHEO"]) 
     184  file_login = get_last_file(DIR["SAVE"], OUT["LOGIN"]) 
    167185  img_name = "bilan.pdf" 
    168186 
     
    229247  plot_save(os.path.join(DIR["PLOT"], img_name)) 
    230248 
    231   plt.show() 
     249  # ... Publish figure on dods ... 
     250  # ------------------------------ 
     251  if args.dods: 
     252    dods_cp(os.path.join(DIR["PLOT"], img_name)) 
     253 
     254  if args.show: 
     255    plt.show() 
     256 
    232257  exit() 
Note: See TracChangeset for help on using the changeset viewer.