- Timestamp:
- 03/02/15 14:19:08 (10 years ago)
- Location:
- TOOLS/ConsoGENCMIP6/bin
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/ConsoGENCMIP6/bin/conso_gencmip6.py
r2417 r2421 25 25 try : 26 26 res = subprocess.check_output(command) 27 except Exception as rc 28 #print(rc)27 except Exception as rc: 28 print(rc) 29 29 res = None 30 30 … … 37 37 command = ["du", "-sbh", dirname] 38 38 try : 39 res = float(subprocess.check_output(command)) 39 res = subprocess.check_output(command) 40 res = res.split()[0] 41 40 42 except Exception as rc : 41 43 print(rc) … … 65 67 print(rc) 66 68 exit() 67 with open(os.path.join(DIR["DATA"], OUT _CCCMP), "w") as fileout:69 with open(os.path.join(DIR["DATA"], OUT["CCCMP"]), "w") as fileout: 68 70 fileout.write(res) 69 71 … … 259 261 igcm_out = os.path.join(storedir, "IGCM_OUT") 260 262 261 for dirname in os.listdir(igcm_out): 262 print(dirname, get_dirsize(dirname)) 263 263 if not os.path.isdir(igcm_out): 264 break 265 266 dirlist = [] 267 try: 268 dirlist = os.listdir(igcm_out) 269 except OSError as rc: 270 print("Error on os.listdir({}):\n{}".format(igcm_out, rc)) 271 272 for dirname in dirlist: 264 273 result_str = "{:%Y-%m-%d} {:10s} {:>7s} {:s}\n".format( 265 274 today, 266 275 login, 267 get_dirsize( dirname),268 dirname276 get_dirsize(os.path.join(igcm_out, dirname)), 277 os.path.join(igcm_out, dirname) 269 278 ) 270 if args.dryrun: 279 280 if args.dryrun or args.verbose: 271 281 print(result_str.strip()) 272 else: 282 283 if not args.dryrun: 273 284 fileout.write(result_str) 274 285 -
TOOLS/ConsoGENCMIP6/bin/gencmip6.py
r2420 r2421 6 6 7 7 # standard library imports 8 # from argparse import ArgumentParser9 8 import socket 10 9 import os 11 10 import os.path 12 11 import glob 12 import shutil 13 13 import datetime as dt 14 14 import numpy as np 15 # import matplotlib.pyplot as plt 16 # from matplotlib.backends.backend_pdf import PdfPages 15 16 # Application library imports 17 from gencmip6_path import * 18 19 20 ######################################## 21 def dods_cp(filein): 22 """ 23 """ 24 if not DIR["DODS"]: 25 print("DODS directory not defined") 26 return 27 28 fileout = os.path.join(DIR["DODS"], os.path.basename(filein)) 29 shutil.copy(filein, fileout) 30 31 return 17 32 18 33 -
TOOLS/ConsoGENCMIP6/bin/gencmip6_path.py.init
r2417 r2421 15 15 ROOT_DIR = os.getcwd() 16 16 17 # Common paths 17 18 DIR = { 18 19 "ROOT": ROOT_DIR, … … 20 21 "SAVE": os.path.join(ROOT_DIR, "save"), 21 22 "PLOT": os.path.join(ROOT_DIR, "plot"), 23 "DODS": None, 24 } 25 26 # Common files 27 OUT = { 28 "PARAM": "OUT_CONSO_PARAM", 29 "BILAN": "OUT_CONSO_BILAN", 30 "UTHEO": "OUT_CONSO_UTHEO", 31 "LOGIN": "OUT_CONSO_LOGIN", 32 "STORE": "OUT_CONSO_STORE", 33 "CCCMP": "ccc_myproject.dat" 22 34 } 23 35 … … 25 37 if __name__ == "__main__": 26 38 print(DIR, ) 27 2 39 print(OUT, ) -
TOOLS/ConsoGENCMIP6/bin/plot_bilan.py
r2420 r2421 11 11 import datetime as dt 12 12 import numpy as np 13 import matplotlib.pyplot as plt14 from matplotlib.backends.backend_pdf import PdfPages15 13 16 14 # Application library imports … … 252 250 parser = ArgumentParser() 253 251 parser.add_argument("-v", "--verbose", action="store_true", 254 help=" Verbose mode")252 help="verbose mode") 255 253 parser.add_argument("-f", "--full", action="store_true", 256 254 help="plot the whole period") … … 263 261 parser.add_argument("-m", "--max", action="store_true", 264 262 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") 265 267 266 268 return parser.parse_args() … … 272 274 # .. Initialization .. 273 275 # ==================== 276 274 277 # ... Command line arguments ... 275 278 # ------------------------------ 276 279 args = get_arguments() 277 280 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 278 293 # ... Files and directories ... 279 294 # ----------------------------- 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"]) 283 298 img_name = "bilan.pdf" 284 299 … … 373 388 plot_save(os.path.join(DIR["PLOT"], img_name)) 374 389 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.