Ignore:
Timestamp:
03/02/15 14:19:08 (9 years ago)
Author:
labetoulle
Message:

copy plots on dods

File:
1 edited

Legend:

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

    r2420 r2421  
    1111import datetime as dt 
    1212import numpy as np 
    13 import matplotlib.pyplot as plt 
    14 from matplotlib.backends.backend_pdf import PdfPages 
    1513 
    1614# Application library imports 
     
    252250  parser = ArgumentParser() 
    253251  parser.add_argument("-v", "--verbose", action="store_true", 
    254                       help="Verbose mode") 
     252                      help="verbose mode") 
    255253  parser.add_argument("-f", "--full", action="store_true", 
    256254                      help="plot the whole period") 
     
    263261  parser.add_argument("-m", "--max", action="store_true", 
    264262                      help="plot with y_max = allocation") 
     263  parser.add_argument("-s", "--show", action="store_true", 
     264                      help="interactive mode") 
     265  parser.add_argument("-d", "--dods", action="store_true", 
     266                      help="copy output on dods") 
    265267 
    266268  return parser.parse_args() 
     
    272274  # .. Initialization .. 
    273275  # ==================== 
     276 
    274277  # ... Command line arguments ... 
    275278  # ------------------------------ 
    276279  args = get_arguments() 
    277280 
     281  # ... Turn interactive mode off ... 
     282  # --------------------------------- 
     283  if not args.show: 
     284    import matplotlib 
     285    matplotlib.use('Agg') 
     286 
     287  import matplotlib.pyplot as plt 
     288  from matplotlib.backends.backend_pdf import PdfPages 
     289 
     290  if not args.show: 
     291    plt.ioff() 
     292 
    278293  # ... Files and directories ... 
    279294  # ----------------------------- 
    280   file_param = get_last_file(DIR["DATA"], OUT["PARAM"]) 
    281   file_utheo = get_last_file(DIR["DATA"], OUT["UTHEO"]) 
    282   file_bilan = get_last_file(DIR["DATA"], OUT["BILAN"]) 
     295  file_param = get_last_file(DIR["SAVE"], OUT["PARAM"]) 
     296  file_utheo = get_last_file(DIR["SAVE"], OUT["UTHEO"]) 
     297  file_bilan = get_last_file(DIR["SAVE"], OUT["BILAN"]) 
    283298  img_name = "bilan.pdf" 
    284299 
     
    373388  plot_save(os.path.join(DIR["PLOT"], img_name)) 
    374389 
    375   plt.show() 
     390  # ... Publish figure on dods ... 
     391  # ------------------------------ 
     392  if args.dods: 
     393    dods_cp(os.path.join(DIR["PLOT"], img_name)) 
     394 
     395  if args.show: 
     396    plt.show() 
Note: See TracChangeset for help on using the changeset viewer.