Changeset 2420


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

plot daily consumption instead of cumulative total

Location:
TOOLS/ConsoGENCMIP6/bin
Files:
2 edited

Legend:

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

    r2417 r2420  
    111111      missing_values="nan", 
    112112    ) 
    113     print(data) 
    114     print(type(data)) 
    115     print(data.shape) 
    116     print(data.size) 
     113    # print(data) 
     114    # print(type(data)) 
     115    # print(data.shape) 
     116    # print(data.size) 
    117117    dates, utheos = zip(*data) 
    118118 
  • TOOLS/ConsoGENCMIP6/bin/plot_bilan.py

    r2417 r2420  
    164164######################################## 
    165165def plot_data(ax_conso, ax_theo, xcoord, xlabels, 
    166               consos, theo_uses, real_uses, theo_equs): 
     166              consos, conso_per_day, theo_uses, real_uses, theo_equs): 
    167167  """ 
    168168  """ 
     
    176176  ax_conso.bar(xcoord, consos, align="center", color="linen", 
    177177               linewidth=line_width, label="conso (heures)") 
     178  # ax_conso.plot(xcoord, conso_per_day, line_style, color="blue", 
     179  #               linewidth=1, markersize=8, alpha=0.5, 
     180  #               # solid_capstyle="round", solid_joinstyle="round", 
     181  #               label="conso journaliÚre idéale (heures)") 
     182  ax_conso.axhline(y=conso_per_day[0], color="blue", alpha=0.5, 
     183                   label="conso journaliÚre idéale (heures)") 
    178184 
    179185  ax_theo.plot(xcoord, theo_equs, "--", 
     
    320326  xlabels   = ["{:%d-%m}".format(item.date) 
    321327               for item in selected_items] 
    322   consos    = np.array([item.conso for item in selected_items], 
     328  cumul     = np.array([item.conso for item in selected_items], 
    323329                        dtype=float) 
     330  consos    = [] 
     331  consos.append(cumul[0]) 
     332  consos[1:nb_items] = cumul[1:nb_items] - cumul[0:nb_items-1] 
     333  consos    = np.array(consos, dtype=float) 
     334 
     335  conso_per_day = np.array([gencmip6.alloc / nb_items 
     336                              for item in selected_items], dtype=float) 
     337 
    324338  theo_uses = np.array([100.*item.theo_use for item in selected_items], 
    325339                       dtype=float) 
     
    338352  # ----------------- 
    339353  plot_data(ax_conso, ax_theo, xcoord, xlabels, 
    340             consos, theo_uses, real_uses, theo_equs) 
     354            consos, conso_per_day, theo_uses, real_uses, theo_equs) 
    341355 
    342356  # ... Tweak figure ... 
Note: See TracChangeset for help on using the changeset viewer.