Changeset 2425


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

Save daily plots on WORK

Location:
TOOLS/ConsoGENCMIP6/bin
Files:
5 edited

Legend:

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

    r2424 r2425  
    292292      filein  = os.path.join(DIR["DATA"], filename) 
    293293      if os.path.isfile(filein): 
    294         fileout = os.path.join(DIR["SAVE"], 
     294        fileout = os.path.join(DIR["SAVEDATA"], 
    295295                               "_".join((filename, suffix))) 
    296296        shutil.copy(filein, fileout) 
     
    327327  if args.verbose: 
    328328    print(DIR["DATA"]) 
    329     print(DIR["SAVE"]) 
     329    print(DIR["SAVEDATA"]) 
    330330 
    331331  (project, logins, today, total, utheo, ureal) = \ 
     
    387387  if args.verbose: 
    388388    print("=> Save files") 
    389  
    390389  if not args.dryrun: 
    391390    save_files(OUT, today) 
  • TOOLS/ConsoGENCMIP6/bin/gencmip6_path.py.init

    r2421 r2425  
    77# standard library imports 
    88import os 
    9 # import os.path 
     9import os.path 
    1010 
    1111# Application library imports 
     
    1616 
    1717# Common paths 
     18# ============ 
    1819DIR = { 
    1920  "ROOT": ROOT_DIR, 
     
    2324  "DODS": None, 
    2425} 
     26DIR["SAVEDATA"] = os.path.join(DIR["SAVE"], "data") 
     27DIR["SAVEPLOT"] = os.path.join(DIR["SAVE"], "plot") 
     28 
     29for dirname in DIR.itervalues(): 
     30  if dirname and not os.path.isdir(dirname): 
     31    try : 
     32      os.makedirs(dirname) 
     33    except Exception as rc : 
     34      print("Could not create {}:\n{}".format(dirname, rc)) 
    2535 
    2636# Common files 
     37# ============ 
    2738OUT = { 
    2839  "PARAM": "OUT_CONSO_PARAM", 
  • TOOLS/ConsoGENCMIP6/bin/plot_bilan.py

    r2421 r2425  
    274274  # .. Initialization .. 
    275275  # ==================== 
    276  
    277276  # ... Command line arguments ... 
    278277  # ------------------------------ 
    279278  args = get_arguments() 
     279  if args.verbose: 
     280    print(args) 
    280281 
    281282  # ... Turn interactive mode off ... 
     
    293294  # ... Files and directories ... 
    294295  # ----------------------------- 
    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"]) 
    298   img_name = "bilan.pdf" 
     296  file_param = get_last_file(DIR["SAVEDATA"], OUT["PARAM"]) 
     297  file_utheo = get_last_file(DIR["SAVEDATA"], OUT["UTHEO"]) 
     298  file_bilan = get_last_file(DIR["SAVEDATA"], OUT["BILAN"]) 
     299  img_name = "bilan" 
     300 
     301  today = os.path.basename(file_param).strip(OUT["PARAM"]) 
    299302 
    300303  if args.verbose: 
     
    303306    print(file_bilan) 
    304307    print(img_name) 
     308    print(today) 
     309    print(DIR) 
     310    print(OUT) 
    305311 
    306312  # .. Get project info .. 
     
    386392  # ... Save figure ... 
    387393  # ------------------- 
    388   plot_save(os.path.join(DIR["PLOT"], img_name)) 
     394  # plot_save(os.path.join(DIR["PLOT"], img_name)) 
     395  img_in  = os.path.join(DIR["PLOT"], "{}.pdf".format(img_name)) 
     396  plot_save(img_in) 
     397  if os.path.isdir(DIR["SAVEPLOT"]): 
     398    img_out = os.path.join(DIR["SAVEPLOT"], 
     399                           "{}_{}.pdf".format(img_name, today)) 
     400    shutil.copy(img_in, img_out) 
    389401 
    390402  # ... Publish figure on dods ... 
    391403  # ------------------------------ 
    392404  if args.dods: 
    393     dods_cp(os.path.join(DIR["PLOT"], img_name)) 
     405    dods_cp(img_in) 
    394406 
    395407  if args.show: 
    396408    plt.show() 
     409 
     410  exit() 
  • 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() 
  • TOOLS/ConsoGENCMIP6/bin/plot_store.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 
     
    194194                      default="IPSLCM6", 
    195195                      help="plot the whole period") 
     196  parser.add_argument("-s", "--show", action="store_true", 
     197                      help="interactive mode") 
     198  parser.add_argument("-d", "--dods", action="store_true", 
     199                      help="copy output on dods") 
    196200 
    197201  return parser.parse_args() 
     
    209213    print(args) 
    210214 
     215  # ... Turn interactive mode off ... 
     216  # --------------------------------- 
     217  if not args.show: 
     218    import matplotlib 
     219    matplotlib.use('Agg') 
     220 
     221  import matplotlib.pyplot as plt 
     222  from matplotlib.backends.backend_pdf import PdfPages 
     223 
     224  if not args.show: 
     225    plt.ioff() 
     226 
    211227  # ... Files and directories ... 
    212228  # ----------------------------- 
    213   file_param = get_last_file(DIR["DATA"], OUT["PARAM"]) 
    214   file_utheo = get_last_file(DIR["DATA"], OUT["UTHEO"]) 
    215   file_store = get_last_file(DIR["DATA"], OUT["STORE"]) 
     229  file_param = get_last_file(DIR["SAVE"], OUT["PARAM"]) 
     230  file_utheo = get_last_file(DIR["SAVE"], OUT["UTHEO"]) 
     231  file_store = get_last_file(DIR["SAVE"], OUT["STORE"]) 
    216232  img_name = "bilan.pdf" 
    217233 
     
    287303  plot_save(os.path.join(DIR["PLOT"], img_name)) 
    288304 
    289   plt.show() 
     305  # ... Publish figure on dods ... 
     306  # ------------------------------ 
     307  if args.dods: 
     308    dods_cp(os.path.join(DIR["PLOT"], img_name)) 
     309 
     310  if args.show: 
     311    plt.show() 
     312 
    290313  exit() 
Note: See TracChangeset for help on using the changeset viewer.