Index: sodarplot/trunk/sodarplot/scintec/winddist.py =================================================================== --- sodarplot/trunk/sodarplot/scintec/winddist.py (revision 71) +++ sodarplot/trunk/sodarplot/scintec/winddist.py (revision 72) @@ -23,4 +23,38 @@ next = files[1:] + [files[0]] files = zip(previous,files,next) + +html1 = """ + + + Billy Mitchell Sodar :: """ + + +html2 = """ :: Wind Distribution at """ + +html3 = """ Meters Above Sea Level + + + +
+ <Previous Month    + Next Month>       + <Previous Elevation    + Next Elevation>       + <All At Once> +
+
+ + +""" firstMonth = True @@ -36,5 +70,4 @@ previousMonth = previous[24:26] previousMonth = datetime.datetime(int(previousYear),int(previousMonth),1).strftime('%B') - previous = previous + os.extsep + htmlExt if next: next = os.path.splitext(os.path.basename(next))[0] @@ -42,5 +75,4 @@ nextMonth = next[24:26] nextMonth = datetime.datetime(int(nextYear),int(nextMonth),1).strftime('%B') - next = next + os.extsep + htmlExt nc = pycdf.CDF(ncFile) @@ -73,5 +105,9 @@ firstElevation = True - for x in range(0,rho.shape[0]): + indices = range(0,rho.shape[0]) + previousX = [indices[-1]] + indices[:-1] + nextX = indices[1:] + [indices[0]] + indices = zip(previousX,indices,nextX) + for previousX,x,nextX in indices: if rho[x].any(): fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w') @@ -82,5 +118,5 @@ fig.add_axes(ax) ax.bar(theta[x], rho[x], normed=True, opening=0.8, edgecolor='white') - l = ax.legend(axespad=-0.20) + l = ax.legend(axespad=-0.20,title="Magnitude (m/s)") plt.setp(l.get_texts(), fontsize=8) if not os.path.exists(os.path.join(pngDir,ncFileName)): @@ -88,4 +124,24 @@ outFile = os.path.join(pngDir,ncFileName,('%dm' % z[x]) + os.extsep + pngExt) print 'Saving', outFile - fig.savefig(outFile) + fig.savefig(outFile) + htmlFile = os.path.join(pngDir,ncFileName + "_" + ('%dm' % z[x]) + os.extsep + htmlExt) + html = html1 + month + " " + year + html = html + html2 + ('%dm' % z[x]) + html = html + html3 + previous + "_" + ('%dm' % z[x]) + os.extsep + htmlExt + html = html + html4 + next + "_" + ('%dm' % z[x]) + os.extsep + htmlExt + html = html + html5 + ncFileName + "_" + ('%dm' % z[previousX]) + os.extsep + htmlExt + html = html + html6 + ncFileName + "_" + ('%dm' % z[nextX]) + os.extsep + htmlExt + html = html + html7 + os.path.join(ncFileName,os.path.basename(outFile)) + html8 + handle = open(htmlFile,'w') + handle.write(html) + handle.close() + + if firstMonth and firstElevation: + firstMonth = False + firstElevation = False + htmlFile = os.path.join(pngDir,"index" + os.extsep + htmlExt) + handle = open(htmlFile,'w') + handle.write(html) + handle.close() +