Changeset 2526
- Timestamp:
- 05/21/15 11:50:57 (9 years ago)
- Location:
- TOOLS/ConsoGENCMIP6/bin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/ConsoGENCMIP6/bin/plot_bilan.py
r2524 r2526 163 163 self.real_use = real_use 164 164 self.theo_use = theo_use 165 self.poly_theo = np.poly1d([]) 166 self.poly_delay = np.poly1d([]) 165 167 self.run_mean = run_mean 166 168 self.pen_mean = pen_mean … … 364 366 # ------------------------------ 365 367 args = get_arguments() 366 if args.verbose:367 print(args)368 368 369 369 # ... Turn interactive mode off ... … … 387 387 [OUT["PARAM"], OUT["UTHEO"], OUT["BILAN"]]) 388 388 389 img_name = "bilan" 389 img_name = os.path.splitext( 390 os.path.basename(__file__) 391 )[0].replace("plot_", "") 392 390 393 today = os.path.basename(file_param).strip(OUT["PARAM"]) 391 394 392 395 if args.verbose: 393 print(file_param) 394 print(file_utheo) 395 print(file_data) 396 print(img_name) 397 print(today) 396 fmt_str = "{:10s} : {}" 397 print(fmt_str.format("args", args)) 398 print(fmt_str.format("today", today)) 399 print(fmt_str.format("file_param", file_param)) 400 print(fmt_str.format("file_utheo", file_utheo)) 401 print(fmt_str.format("file_data", file_data)) 402 print(fmt_str.format("img_name", img_name)) 398 403 399 404 # .. Get project info .. … … 506 511 # ------------------------------ 507 512 if args.dods: 513 if args.verbose: 514 print("Publish figure on dods") 508 515 dods_cp(img_in, DIR) 509 516 … … 512 519 513 520 exit(0) 521 -
TOOLS/ConsoGENCMIP6/bin/plot_bilan_jobs.py
r2464 r2526 10 10 import os.path 11 11 import datetime as dt 12 from dateutil.relativedelta import relativedelta 12 13 import numpy as np 13 14 … … 102 103 y2 = theo_uses[idx_max] 103 104 104 m = np.array([ 105 [x1, 1.], 106 [x2, 1.] 107 ], dtype="float") 108 n = np.array([ 109 y1, 110 y2 111 ], dtype="float") 112 105 m = np.array([[x1, 1.], [x2, 1.]], dtype="float") 106 n = np.array([y1, y2], dtype="float") 107 108 poly_ok = True 113 109 try: 114 (a, b) = np.linalg.solve(m, n)110 poly_theo = np.poly1d(np.linalg.solve(m, n)) 115 111 except np.linalg.linalg.LinAlgError: 116 (a, b) = (None, None) 117 118 if a and b: 119 for date in dates: 120 self[date].theo_equ = date.timetuple().tm_yday*a + b 112 poly_ok = False 113 114 if poly_ok: 115 delta = (dates[0] + relativedelta(months=2) - dates[0]).days 116 117 poly_delay = np.poly1d( 118 [poly_theo[1], poly_theo[0] - poly_theo[1] * delta] 119 ) 120 121 self.poly_theo = poly_theo 122 self.poly_delay = poly_delay 121 123 122 124 #--------------------------------------- … … 161 163 self.real_use = real_use 162 164 self.theo_use = theo_use 163 self.theo_equ = np.nan 165 self.poly_theo = np.poly1d([]) 166 self.poly_delay = np.poly1d([]) 164 167 self.run_mean = run_mean 165 168 self.pen_mean = pen_mean … … 198 201 ######################################## 199 202 def plot_data(ax_conso, ax_theo, ax_jobs, xcoord, dates, 200 consos, theo_uses, real_uses, theo_equs, 203 consos, theo_uses, real_uses, theo_equs, theo_delay, 201 204 run_mean, pen_mean, run_std, pen_std): 202 205 """ … … 206 209 line_width = 0.05 207 210 else: 208 # line_style = "+-"209 211 line_width = 0.1 210 212 … … 214 216 ) 215 217 218 ax_theo.plot( 219 xcoord, real_uses, line_style, 220 color="forestgreen", linewidth=1, markersize=8, 221 solid_capstyle="round", solid_joinstyle="round", 222 label="conso\nréelle (%)" 223 ) 216 224 ax_theo.plot( 217 225 xcoord, theo_equs, "--", … … 220 228 ) 221 229 ax_theo.plot( 222 xcoord, theo_uses, line_style, color="firebrick",223 linewidth=1, markersize=8,230 xcoord, theo_uses, line_style, 231 color="firebrick", linewidth=1, markersize=8, 224 232 solid_capstyle="round", solid_joinstyle="round", 225 233 label="conso\nthéorique (%)" 226 234 ) 227 235 ax_theo.plot( 228 xcoord, real_uses, line_style, color="forestgreen",229 linewidth=1, markersize=8,236 xcoord, theo_delay, ":", 237 color="firebrick", linewidth=0.5, 230 238 solid_capstyle="round", solid_joinstyle="round", 231 label=" conso\nréelle(%)"239 label="retard de\ndeux mois (%)" 232 240 ) 233 241 … … 389 397 # ------------------------------ 390 398 args = get_arguments() 391 if args.verbose:392 print(args)393 399 394 400 # ... Turn interactive mode off ... … … 412 418 [OUT["PARAM"], OUT["UTHEO"], OUT["BILAN"]]) 413 419 414 img_name = "bilan_jobs" 420 img_name = os.path.splitext( 421 os.path.basename(__file__) 422 )[0].replace("plot_", "") 423 415 424 today = os.path.basename(file_param).strip(OUT["PARAM"]) 416 425 417 426 if args.verbose: 418 print(file_param) 419 print(file_utheo) 420 print(file_data) 421 print(img_name) 422 print(today) 427 fmt_str = "{:10s} : {}" 428 print(fmt_str.format("args", args)) 429 print(fmt_str.format("today", today)) 430 print(fmt_str.format("file_param", file_param)) 431 print(fmt_str.format("file_utheo", file_utheo)) 432 print(fmt_str.format("file_data", file_data)) 433 print(fmt_str.format("img_name", img_name)) 423 434 424 435 # .. Get project info .. … … 456 467 nb_items = len(selected_items) 457 468 458 xcoord 459 dates 460 461 cumul 469 xcoord = np.linspace(1, nb_items, num=nb_items) 470 dates = [item.date for item in selected_items] 471 472 cumul = np.array([item.conso for item in selected_items], 462 473 dtype=float) 463 consos 474 consos = [] 464 475 consos.append(cumul[0]) 465 476 consos[1:nb_items] = cumul[1:nb_items] - cumul[0:nb_items-1] 466 consos 477 consos = np.array(consos, dtype=float) 467 478 468 479 conso_per_day = projet.alloc / projet.days 469 480 470 theo_uses = np.array([100.*item.theo_use for item in selected_items], 471 dtype=float) 472 real_uses = np.array([100.*item.real_use for item in selected_items], 473 dtype=float) 474 theo_equs = np.array([100.*item.theo_equ for item in selected_items], 475 dtype=float) 481 theo_uses = np.array( 482 [100.*item.theo_use for item in selected_items], 483 dtype=float 484 ) 485 real_uses = np.array( 486 [100.*item.real_use for item in selected_items], 487 dtype=float 488 ) 489 theo_equs = np.array( 490 [100. * bilan.poly_theo(date.timetuple().tm_yday) 491 for date in dates], 492 dtype=float 493 ) 494 theo_delay = np.array( 495 [100. * bilan.poly_delay(date.timetuple().tm_yday) 496 for date in dates], 497 dtype=float 498 ) 476 499 477 500 run_mean = np.array([item.run_mean for item in selected_items], … … 493 516 # ----------------- 494 517 plot_data(ax_conso, ax_theo, ax_jobs, xcoord, dates, 495 consos, theo_uses, real_uses, theo_equs, 518 consos, theo_uses, real_uses, theo_equs, theo_delay, 496 519 run_mean, pen_mean, run_std, pen_std) 497 520 … … 520 543 # ------------------------------ 521 544 if args.dods: 545 if args.verbose: 546 print("Publish figure on dods") 522 547 dods_cp(img_in, DIR) 523 548 -
TOOLS/ConsoGENCMIP6/bin/plot_login.py
r2464 r2526 125 125 parser = ArgumentParser() 126 126 parser.add_argument("-v", "--verbose", action="store_true", 127 help=" Verbose mode")127 help="verbose mode") 128 128 parser.add_argument("-f", "--full", action="store_true", 129 129 help="plot all the logins" + … … 145 145 # ------------------------------ 146 146 args = get_arguments() 147 if args.verbose:148 print(args)149 147 150 148 # ... Turn interactive mode off ... … … 168 166 [OUT["PARAM"], OUT["UTHEO"], OUT["LOGIN"]]) 169 167 170 img_name = "login" 168 img_name = os.path.splitext( 169 os.path.basename(__file__) 170 )[0].replace("plot_", "") 171 171 172 today = os.path.basename(file_param).strip(OUT["PARAM"]) 172 173 173 174 if args.verbose: 174 print(file_param) 175 print(file_utheo) 176 print(file_data) 177 print(img_name) 178 print(today) 175 fmt_str = "{:10s} : {}" 176 print(fmt_str.format("args", args)) 177 print(fmt_str.format("today", today)) 178 print(fmt_str.format("file_param", file_param)) 179 print(fmt_str.format("file_utheo", file_utheo)) 180 print(fmt_str.format("file_data", file_data)) 181 print(fmt_str.format("img_name", img_name)) 179 182 180 183 # .. Get project info .. … … 184 187 projet.get_date_init(file_utheo) 185 188 186 # .. Fill in data dict .. 187 # ======================= 188 # ... Initialization ... 189 # ---------------------- 189 # .. Fill in data .. 190 # ================== 190 191 logins = LoginDict() 191 192 logins.fill_data(file_data) … … 241 242 # ------------------------------ 242 243 if args.dods: 244 if args.verbose: 245 print("Publish figure on dods") 243 246 dods_cp(img_in, DIR) 244 247 -
TOOLS/ConsoGENCMIP6/bin/plot_store.py
r2524 r2526 209 209 parser = ArgumentParser() 210 210 parser.add_argument("-v", "--verbose", action="store_true", 211 help=" Verbose mode")211 help="verbose mode") 212 212 parser.add_argument("-f", "--full", action="store_true", 213 213 help="plot all the directories in IGCM_OUT" + … … 278 278 projet.get_date_init(file_utheo) 279 279 280 # .. Fill in data dict..281 # ================== =====280 # .. Fill in data .. 281 # ================== 282 282 stores = StoreDict() 283 283 stores.fill_data(file_data, file_init)
Note: See TracChangeset
for help on using the changeset viewer.