Changeset 72
- Timestamp:
- 01/24/11 19:03:01
- Files:
-
- sodarplot/trunk/sodarplot/scintec/winddist.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sodarplot/trunk/sodarplot/scintec/winddist.py
r71 r72 23 23 next = files[1:] + [files[0]] 24 24 files = zip(previous,files,next) 25 26 html1 = """<html> 27 <head> 28 <title> 29 Billy Mitchell Sodar :: """ 30 31 32 html2 = """ :: Wind Distribution at """ 33 34 html3 = """ Meters Above Sea Level 35 </title> 36 </head> 37 <body> 38 <form> 39 <a href=\"""" 40 41 html4 = """\"><Previous Month</a> 42 <a href=\"""" 43 44 html5 = """\">Next Month></a> 45 <a href=\"""" 46 47 html6 = """\"><Previous Elevation</a> 48 <a href=\"""" 49 50 html7 = """\">Next Elevation></a> 51 <a href=\"all.html\"><All At Once></a> 52 </form> 53 <br/> 54 <img src=\"""" 55 56 html8 = """\"/> 57 </body> 58 </html>""" 25 59 26 60 firstMonth = True … … 36 70 previousMonth = previous[24:26] 37 71 previousMonth = datetime.datetime(int(previousYear),int(previousMonth),1).strftime('%B') 38 previous = previous + os.extsep + htmlExt39 72 if next: 40 73 next = os.path.splitext(os.path.basename(next))[0] … … 42 75 nextMonth = next[24:26] 43 76 nextMonth = datetime.datetime(int(nextYear),int(nextMonth),1).strftime('%B') 44 next = next + os.extsep + htmlExt45 77 46 78 nc = pycdf.CDF(ncFile) … … 73 105 74 106 firstElevation = True 75 for x in range(0,rho.shape[0]): 107 indices = range(0,rho.shape[0]) 108 previousX = [indices[-1]] + indices[:-1] 109 nextX = indices[1:] + [indices[0]] 110 indices = zip(previousX,indices,nextX) 111 for previousX,x,nextX in indices: 76 112 if rho[x].any(): 77 113 fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w') … … 82 118 fig.add_axes(ax) 83 119 ax.bar(theta[x], rho[x], normed=True, opening=0.8, edgecolor='white') 84 l = ax.legend(axespad=-0.20 )120 l = ax.legend(axespad=-0.20,title="Magnitude (m/s)") 85 121 plt.setp(l.get_texts(), fontsize=8) 86 122 if not os.path.exists(os.path.join(pngDir,ncFileName)): … … 88 124 outFile = os.path.join(pngDir,ncFileName,('%dm' % z[x]) + os.extsep + pngExt) 89 125 print 'Saving', outFile 90 fig.savefig(outFile) 126 fig.savefig(outFile) 91 127 128 htmlFile = os.path.join(pngDir,ncFileName + "_" + ('%dm' % z[x]) + os.extsep + htmlExt) 129 html = html1 + month + " " + year 130 html = html + html2 + ('%dm' % z[x]) 131 html = html + html3 + previous + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 132 html = html + html4 + next + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 133 html = html + html5 + ncFileName + "_" + ('%dm' % z[previousX]) + os.extsep + htmlExt 134 html = html + html6 + ncFileName + "_" + ('%dm' % z[nextX]) + os.extsep + htmlExt 135 html = html + html7 + os.path.join(ncFileName,os.path.basename(outFile)) + html8 136 handle = open(htmlFile,'w') 137 handle.write(html) 138 handle.close() 139 140 if firstMonth and firstElevation: 141 firstMonth = False 142 firstElevation = False 143 htmlFile = os.path.join(pngDir,"index" + os.extsep + htmlExt) 144 handle = open(htmlFile,'w') 145 handle.write(html) 146 handle.close() 147