Changeset 2517
- Timestamp:
- 05/20/15 16:30:57 (9 years ago)
- Location:
- TOOLS/ConsoGENCMIP6/bin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/ConsoGENCMIP6/bin/libconso.py
r2464 r2517 249 249 n = np.array([utheos[x1], utheos[x2]]) 250 250 251 poly_ok = True 251 252 try: 252 (a, b) = np.linalg.solve(m, n)253 polynome = np.poly1d(np.linalg.solve(m, n)) 253 254 except np.linalg.linalg.LinAlgError: 254 (a, b) = (None, None)255 256 if a and b:257 delta = int(round( (-b/a)-x1+ 1))258 259 d1 = dates[ x1]255 poly_ok = False 256 257 if poly_ok: 258 delta = int(round(polynome.r[0] + 1)) 259 260 d1 = dates[0] 260 261 self.date_init = d1 + dt.timedelta(days=delta) 261 262 else: -
TOOLS/ConsoGENCMIP6/bin/plot_bilan.py
r2464 r2517 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: 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 119 121 for date in dates: 120 self[date].theo_equ = date.timetuple().tm_yday*a + b 122 self.poly_theo = poly_theo 123 self.poly_delay = poly_delay 121 124 122 125 #--------------------------------------- … … 161 164 self.real_use = real_use 162 165 self.theo_use = theo_use 163 self.theo_equ = np.nan166 # self.theo_equ = np.nan 164 167 self.run_mean = run_mean 165 168 self.pen_mean = pen_mean … … 192 195 ######################################## 193 196 def plot_data(ax_conso, ax_theo, xcoord, dates, 194 consos, theo_uses, real_uses, theo_equs, 197 consos, theo_uses, real_uses, theo_equs, theo_delay, 195 198 run_mean, pen_mean, run_std, pen_std): 196 199 """ … … 209 212 210 213 ax_theo.plot( 214 xcoord, real_uses, line_style, 215 color="forestgreen", linewidth=1, markersize=8, 216 solid_capstyle="round", solid_joinstyle="round", 217 label="conso\nréelle (%)" 218 ) 219 ax_theo.plot( 211 220 xcoord, theo_equs, "--", 212 221 color="firebrick", linewidth=0.5, … … 214 223 ) 215 224 ax_theo.plot( 216 xcoord, theo_uses, line_style, color="firebrick",217 linewidth=1, markersize=8,225 xcoord, theo_uses, line_style, 226 color="firebrick", linewidth=1, markersize=8, 218 227 solid_capstyle="round", solid_joinstyle="round", 219 228 label="conso\nthéorique (%)" 220 229 ) 221 230 ax_theo.plot( 222 xcoord, real_uses, line_style, color="forestgreen",223 linewidth=1, markersize=8,231 xcoord, theo_delay, ":", 232 color="firebrick", linewidth=0.5, 224 233 solid_capstyle="round", solid_joinstyle="round", 225 label=" conso\nréelle(%)"234 label="retard de\ndeux mois (%)" 226 235 ) 227 236 … … 439 448 theo_uses = np.array([100.*item.theo_use for item in selected_items], 440 449 dtype=float) 450 441 451 real_uses = np.array([100.*item.real_use for item in selected_items], 442 452 dtype=float) 443 theo_equs = np.array([100.*item.theo_equ for item in selected_items], 444 dtype=float) 453 theo_equs = np.array( 454 [100. * bilan.poly_theo(date.timetuple().tm_yday) 455 for date in dates], 456 dtype=float 457 ) 458 theo_delay = np.array( 459 [100. * bilan.poly_delay(date.timetuple().tm_yday) 460 for date in dates], 461 dtype=float 462 ) 445 463 446 464 run_mean = np.array([item.run_mean for item in selected_items], … … 462 480 # ----------------- 463 481 plot_data(ax_conso, ax_theo, xcoord, dates, 464 consos, theo_uses, real_uses, theo_equs, 482 consos, theo_uses, real_uses, theo_equs, theo_delay, 465 483 run_mean, pen_mean, run_std, pen_std) 466 484 … … 494 512 495 513 exit(0) 496 -
TOOLS/ConsoGENCMIP6/bin/plot_jobs.py
r2464 r2517 351 351 bilan = DataDict() 352 352 bilan.init_range(projet.date_init, projet.deadline) 353 354 353 # ... Extract data from file ... 355 354 # ------------------------------
Note: See TracChangeset
for help on using the changeset viewer.