NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Changeset 86

Show
Ignore:
Timestamp:
02/04/14 16:45:04
Author:
cbc
Message:

Fix billymitchell proc2plot for level2.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sodarplot/trunk/sodarplot/scintec/meanspeed.py

    r85 r86  
    99import pycdf  
    1010  
    11 ncDir = '/seacoos/data/nccoos/level1/billymitchell/sodar1'  
     11ncDir = '/seacoos/data/nccoos/level2/billymitchell/sodar1'  
    1212ncFileGlob = 'billymitchell_sfas_*.nc'  
    1313  
    14 pngDir = '/seacoos/data/nccoos/level1/billymitchell/sodar1/plots/meanspeed'  
     14pngDir = '/seacoos/data/nccoos/plots/billymitchell/sodar1/meanspeed'  
    1515pngExt = 'png'  
    1616htmlExt = 'html'  
  • sodarplot/trunk/sodarplot/scintec/winddist.py

    r85 r86  
    88import pycdf 
    99 
    10 ncDir = '/seacoos/data/nccoos/level1/billymitchell/sodar1'  
     10ncDir = '/seacoos/data/nccoos/level2/billymitchell/sodar1'  
    1111ncFileGlob = 'billymitchell_sfas_*.nc'  
    1212  
    13 pngDir = '/seacoos/data/nccoos/level1/billymitchell/sodar1/plots/winddist' 
     13pngDir = '/seacoos/data/nccoos/plots/billymitchell/sodar1/winddist' 
    1414if not os.path.exists(pngDir): 
    1515    os.mkdir(pngDir) 
     
    122122    indices = zip(previousX,indices,nextX)  
    123123    for previousX,x,nextX in indices: 
     124        fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w') 
     125        spt = fig.suptitle('Billy Mitchell Sodar :: ' + monthName + " " + year) 
     126        rect = [0.16, 0.16, 0.68, 0.68] 
     127        ax = WindroseAxes(fig, rect, axisbg='w') 
     128        ax.set_title('Wind Distribution at %d Meters Above Sea Level\nPercentage of Wind Magnitude Towards Direction\n\n' % z[x],fontsize=spt.get_fontsize()*0.8) 
     129        fig.add_axes(ax) 
    124130        if rho[x].any(): 
    125             fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w') 
    126             spt = fig.suptitle('Billy Mitchell Sodar :: ' + monthName + " " + year) 
    127             rect = [0.16, 0.16, 0.68, 0.68] 
    128             ax = WindroseAxes(fig, rect, axisbg='w') 
    129             ax.set_title('Wind Distribution at %d Meters Above Sea Level\nPercentage of Wind Magnitude Towards Direction\n\n' % z[x],fontsize=spt.get_fontsize()*0.8) 
    130             fig.add_axes(ax) 
    131131            ax.bar(theta[x], rho[x], bins = np.arange(0.0,20.0,2.5), normed=True, opening=0.8, edgecolor='white') 
    132132            yticklabels = ['',] + \ 
    133133                          ["  %s%%" % plt.getp(textobj,'text') 
    134                               for textobj in plt.getp(ax,'yticklabels')[1:]] 
     134                              for textobj in plt.getp(ax,'yticklabels')[1:]] 
    135135            plt.setp(ax,yticklabels=yticklabels) 
    136136            l = ax.legend(axespad=-0.20,title="Magnitude (m/s)") 
    137137            plt.setp(l.get_texts(), fontsize=8) 
    138             dirName = "%4u_%02u" % (int(year), int(month)) 
    139             if not os.path.exists(os.path.join(pngDir, dirName)): 
    140                 os.mkdir(os.path.join(pngDir, dirName)) 
    141             outFile = os.path.join(pngDir,dirName,('%03um' % z[x]) + os.extsep + pngExt)  
    142             print 'Saving', outFile  
    143             fig.savefig(outFile) 
    144             fig.clear() 
     138        else: 
     139            yticklabels = [" " for textobj in plt.getp(ax,'yticklabels')] 
     140            plt.setp(ax,yticklabels=yticklabels)             
     141        dirName = "%4u_%02u" % (int(year), int(month)) 
     142        if not os.path.exists(os.path.join(pngDir, dirName)): 
     143            os.mkdir(os.path.join(pngDir, dirName)) 
     144        outFile = os.path.join(pngDir,dirName,('%03um' % z[x]) + os.extsep + pngExt)  
     145        print 'Saving', outFile  
     146        fig.savefig(outFile) 
     147        fig.clear() 
    145148 
    146             if genHtml: 
    147                 htmlFile = os.path.join(pngDir,ncFileName + "_" + ('%dm' % z[x]) + os.extsep + htmlExt)  
    148                 html = html1 + monthName + " " + year 
    149                 html = html + html2 + ('%dm' % z[x]) 
    150                 html = html + html3 + previous + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 
    151                 html = html + html4 + next + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 
    152                 html = html + html5 + ncFileName + "_" + ('%dm' % z[previousX]) + os.extsep + htmlExt 
    153                 html = html + html6 + ncFileName + "_" + ('%dm' % z[nextX]) + os.extsep + htmlExt 
    154                 html = html + html7 + os.path.join(dirName,os.path.basename(outFile)) + html8  
     149        if genHtml: 
     150            htmlFile = os.path.join(pngDir,ncFileName + "_" + ('%dm' % z[x]) + os.extsep + htmlExt)  
     151            html = html1 + monthName + " " + year 
     152            html = html + html2 + ('%dm' % z[x]) 
     153            html = html + html3 + previous + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 
     154            html = html + html4 + next + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 
     155            html = html + html5 + ncFileName + "_" + ('%dm' % z[previousX]) + os.extsep + htmlExt 
     156            html = html + html6 + ncFileName + "_" + ('%dm' % z[nextX]) + os.extsep + htmlExt 
     157            html = html + html7 + os.path.join(dirName,os.path.basename(outFile)) + html8  
     158            handle = open(htmlFile,'w')  
     159            handle.write(html)  
     160            handle.close()  
     161 
     162            if lastMonth and firstElevation:  
     163                firstElevation = False 
     164                htmlFile = os.path.join(pngDir,"index" + os.extsep + htmlExt)  
    155165                handle = open(htmlFile,'w')  
    156166                handle.write(html)  
    157                 handle.close()  
    158  
    159                 if lastMonth and firstElevation:  
    160                     firstElevation = False 
    161                     htmlFile = os.path.join(pngDir,"index" + os.extsep + htmlExt)  
    162                     handle = open(htmlFile,'w')  
    163                     handle.write(html)  
    164                     handle.close() 
     167                handle.close() 
    165168 
    166169if __name__ == "__main__": 
     
    178181        if p.exitcode: 
    179182           print "Exitcode %s from processing %s" % (p.exitcode, ncFile)  
     183