<jupyter_start><jupyter_text>Figures by heightEach of the following figures could be drawn for any probe height. Currently, figures are only drawn for z=80m (hub height)<jupyter_code>categories = list(catinfo['columns'].keys())

for cat in categories:
    if 'stability flag' in cat.lower():
        continue
    
    # savepath for new figs
    savecat = catinfo['save'][cat]
    catfigpath = os.path.join(figPath,savecat)
    
    catcolumns, probe_heights, _ = utils.get_vertical_locations(catinfo['columns'][cat])
    
    ## wind roses by height
    for height in [87]:#probe_heights:
    
        # SCATTER PLOTS
        ## cumulative scatter
        fig, ax = vis.winddir_scatter(metdat, catinfo, cat, vertloc=height, exclude_angles=exclude_angles)
        fig.savefig(os.path.join(catfigpath,'{}_{}_scatter_{}.png'.format(towerID, savecat, height)), dpi=200, bbox_inches='tight')

        # stability scatter
        fig, ax = vis.stability_winddir_scatter(metdat, catinfo, cat, vertloc=height)
        fig.savefig(os.path.join(catfigpath,'{}_{}_scatter_stability_{}.png'.format(towerID, savecat, height)), dpi=200, bbox_inches='tight')

        # HISTOGRAMS
        # cumulative
        fig,ax = vis.hist(metdat, catinfo, cat, vertloc=height)
        fig.savefig(os.path.join(catfigpath,'{}_{}_hist_{}.png'.format(towerID, savecat, height)), dpi=200, bbox_inches='tight')

        # stability breakout
        fig,ax = vis.hist_by_stability(metdat, catinfo, cat, vertloc=height)
        fig.savefig(os.path.join(catfigpath,'{}_{}_hist_stabilty_{}.png'.format(towerID, savecat, height)), dpi=200, bbox_inches='tight')

        # stability stacked
        fig,ax = fig,ax = vis.stacked_hist_by_stability(metdat, catinfo, cat, vertloc=height)
        fig.savefig(os.path.join(catfigpath,'{}_{}_hist_stabilty_stacked_{}.png'.format(towerID, savecat, height)), dpi=200, bbox_inches='tight')
        
        if 'ti' not in cat.lower():
            # groupby direction scatter
            fig,ax = vis.groupby_scatter(metdat, catinfo, cat, vertloc=height, abscissa='direction', groupby='ti')
            fig.set_size_inches(8,3)
            fig.tight_layout()
            fig.savefig(os.path.join(catfigpath,'{}_{}_TI_scatter_{}m.png'.format(towerID, savecat, height)), dpi=200, bbox_inches='tight')

    plt.close('all')<jupyter_output>/Users/nhamilto/.local/lib/python3.6/site-packages/numpy/lib/function_base.py:838: RuntimeWarning: invalid value encountered in true_divide
  return n/db/n.sum(), bin_edges
/Users/nhamilto/anaconda/lib/python3.6/site-packages/pandas/plotting/_core.py:1060: RuntimeWarning: invalid value encountered in greater_equal
  if (values >= 0).all():
/Users/nhamilto/anaconda/lib/python3.6/site-packages/pandas/plotting/_core.py:1062: RuntimeWarning: invalid value encountered in less_equal
  elif (values <= 0).all():<jupyter_text>Wind rosesMight as well draw all of the wind roses (by height)<jupyter_code># wind roses
cat = 'speed'
catcolumns, probe_heights, ind = utils.get_vertical_locations(catinfo['columns'][cat])
# savepath for new figs
savecat = catinfo['save'][cat]
catfigpath = os.makedirs(os.path.join(figPath,savecat,'roses'), mode=0o777, exist_ok=True)
catfigpath = os.path.join(figPath,savecat,'roses')
## wind roses by height
for height in probe_heights:
    ## cumulative wind rose
    fig,ax,leg = vis.rose_fig(metdat, catinfo, cat, vertloc=height, bins=np.linspace(0,15,6), ylim=9)
    fig.savefig(os.path.join(catfigpath,'{}_{}_rose_{}m.png'.format(towerID, cat, height)), dpi=200, bbox_inches='tight')
    ## monthly wind roses
    fig,ax,leg = vis.monthly_rose_fig(metdat, catinfo, cat, vertloc=height, bins=np.linspace(0,15,6), ylim=12)
    fig.savefig(os.path.join(catfigpath,'{}_{}_rose_monthly_{}m.png'.format(towerID, cat, height)), dpi=200, bbox_inches='tight')

    plt.close('all')
# TI roses
cat = 'ti'
catcolumns, probe_heights, ind = utils.get_vertical_locations(catinfo['columns'][cat])
# savepath for new figs
savecat = catinfo['save'][cat]
catfigpath = os.makedirs(os.path.join(figPath,savecat,'roses'), mode=0o777, exist_ok=True)
catfigpath = os.path.join(figPath,savecat,'roses')
## wind roses by height
for height in probe_heights:
    ## cumulative wind rose
    fig,ax,leg = vis.rose_fig(metdat, catinfo, cat, vertloc=height, bins=np.linspace(0,40,6), ylim=12)
    fig.savefig(os.path.join(catfigpath,'{}_{}_rose_{}m.png'.format(towerID, cat, height)), dpi=200, bbox_inches='tight')
    ## monthly wind roses
    fig,ax,leg = vis.monthly_rose_fig(metdat, catinfo, cat, vertloc=height, bins=np.linspace(0,40,6), ylim=14)
    fig.savefig(os.path.join(catfigpath,'{}_{}_rose_monthly_{}m.png'.format(towerID, cat, height)), dpi=200, bbox_inches='tight')

    plt.close('all')
fig, ax = vis.normalized_hist_by_stability(metdat, catinfo)
fig.savefig(os.path.join(figPath,'{}_normalized_stability_flag.png'.format(towerID)), dpi=200, bbox_inches='tight')
fig, ax = vis.normalized_monthly_hist_by_stability(metdat,catinfo)
fig.savefig(os.path.join(figPath,'{}_normalized_stability_flag_monthly.png'.format(towerID)), dpi=200, bbox_inches='tight')
cat = 'wind shear'
# savepath for new figs
savecat = catinfo['save'][cat]
catfigpath = os.path.join(figPath,savecat)
fig,ax = vis.hist(metdat, catinfo, cat, vertloc=122)
fig.savefig(os.path.join(catfigpath,'{}_{}_hist_{}.png'.format(towerID, savecat, 122)), dpi=200, bbox_inches='tight')
height
plt.rcParams.update({'font.size': 12})
colors = utils.get_nrelcolors()
blue = colors['blue'][0]
cat = 'wind shear'
# savepath for new figs
savecat = catinfo['save'][cat]
catfigpath = os.path.join(figPath,savecat)
catcolumns, probe_heights, ind = utils.get_vertical_locations(catinfo['columns'][cat])
for col in catcolumns[5:6]:
    fig, ax = plt.subplots(figsize=(5,3))
    metdat[col].hist(ax=ax, bins=35, color=blue, edgecolor='k', density=False, weights = np.ones(metdat[col].count())/len(metdat[col]))
    ax.grid(False)
    ax.set_title(col, fontsize=12)
    ax.set_ylabel('Frequency [%]', fontsize=12)
    ax.set_xlabel(catinfo['labels'][cat], fontsize=12)
fig.savefig(os.path.join(catfigpath,'{}_{}_hist_{}.png'.format(towerID, savecat, 122)), dpi=200, bbox_inches='tight')
colors = utils.get_nrelcolors()
blue = colors['blue'][0]
cat = 'wind veer'
# savepath for new figs
savecat = catinfo['save'][cat]
catfigpath = os.path.join(figPath,savecat)
catcolumns, probe_heights, ind = utils.get_vertical_locations(catinfo['columns'][cat])
for col in catcolumns[5:6]:
    fig, ax = plt.subplots(figsize=(5,3))
    metdat[col].hist(ax=ax, bins=35, color=blue, edgecolor='k', density=False, weights = np.ones(metdat[col].count())/len(metdat[col]))
    ax.grid(False)
    ax.set_title(col, fontsize=12)
    ax.set_ylabel('Frequency [%]', fontsize=12)
    ax.set_xlabel(catinfo['labels'][cat], fontsize=12)
fig.savefig(os.path.join(catfigpath,'{}_{}_hist_{}.png'.format(towerID, savecat, 122)), dpi=200, bbox_inches='tight')
imp.reload(vis)
for cat in ['air pressure']:#categories:
    savecat = catinfo['save'][cat]
    catfigpath = os.path.join(figPath,savecat)
    fig,ax = vis.monthly_stacked_hist_by_stability(metdat,catinfo,cat, vertloc=87)
    fig.savefig(os.path.join(catfigpath,'{}_{}_monthly_stacked_hist_by_stability_{}.png'.format(towerID, savecat, 87)), dpi=200, bbox_inches='tight')
# direction conditioned
dircol, probe_heights, ind = utils.get_vertical_locations(catinfo['columns']['direction'], location=87)
spdcol, probe_heights, ind = utils.get_vertical_locations(catinfo['columns']['speed'], location=87)

northerly = metdat[(metdat[dircol] < 45) | (metdat[dircol] > 315)]

southerly = metdat[(metdat[dircol] > 135) & (metdat[dircol] < 225)]

weakwest = metdat[(metdat[dircol] > 225) & (metdat[dircol] < 315) & (metdat[spdcol] < 10)]

strongwest = metdat[(metdat[dircol] > 225) & (metdat[dircol] < 315) & (metdat[spdcol] > 10)]

imp.reload(vis)
cat = 'ti'
fig,ax = vis.stacked_hist_by_stability(northerly, catinfo, cat, vertloc=87)
fig,ax = vis.stacked_hist_by_stability(southerly, catinfo, cat, vertloc=87)
fig,ax = vis.stacked_hist_by_stability(weakwest, catinfo, cat, vertloc=87)
fig,ax = vis.stacked_hist_by_stability(strongwest, catinfo, cat, vertloc=87)
cat = 'turbulent kinetic energy'
fig,ax = vis.stacked_hist_by_stability(northerly, catinfo, cat, vertloc=87)
fig,ax = vis.stacked_hist_by_stability(southerly, catinfo, cat, vertloc=87)
fig,ax = vis.stacked_hist_by_stability(weakwest, catinfo, cat, vertloc=87)
fig,ax = vis.stacked_hist_by_stability(strongwest, catinfo, cat, vertloc=87)<jupyter_output><empty_output><jupyter_text>Monthly histograms<jupyter_code>categories = list(catinfo['columns'].keys())
imp.reload(vis)
for cat in categories:
    
    height = 87
    if 'shear' in cat.lower(): 
        height = 122
    if 'stability flag' in cat.lower():
        continue
        
    savecat = catinfo['save'][cat]
    catfigpath = os.path.join(figPath,savecat)
    
    fig,ax = vis.monthly_hist(metdat, catinfo, cat, vertloc=height)
    fig.savefig(os.path.join(catfigpath,'{}_{}_monthly_hist_{}.png'.format(towerID, savecat, height)), dpi=200, bbox_inches='tight')
    
    plt.clf()
metdat.columns<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15767091920183185, 'fraction_numerical': 0.022134990731654126, 'mean_word_length': 5.603311735061195, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '471746', 'license': 'Apache-2.0', 'n_tokens_mistral': 3558, 'n_tokens_neox': 3418, 'n_words': 565, 'path': 'notebooks/M5_figs_process-Copy1.ipynb', 'repo_name': 'Lucas-Mc/MetMast', 'size': '9171'}