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

Changeset 74

Show
Ignore:
Timestamp:
01/25/11 18:18:21
Author:
cbc
Message:

Fix magnitude intervals and eliminate masked values in winddist.

Files:

Legend:

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

    r73 r74  
    9797 
    9898    mrho = np.sqrt((mu**2) + (mv**2)) 
    99     rho = mrho.T.data 
     99    mrho = mrho.T 
    100100    mtheta = (180 * np.arctan2(mv, mu)/np.pi) 
    101101    theta = np.piecewise(mtheta, 
    102102                         (mtheta <= 90, mtheta > 90), 
    103103                         (lambda x: 90 - x, lambda x: 450 - x)) 
    104     theta = theta.T 
     104    mtheta = np.ma.array(theta,mask=mtheta.mask) 
     105    mtheta = mtheta.T 
     106 
     107    rho = [np.array([elem 
     108                     for elem,mask 
     109                     in zip(row.data,row.mask) 
     110                     if not mask]) 
     111           for row 
     112           in mrho] 
     113    theta = [np.array([elem 
     114                       for elem,mask 
     115                       in zip(row.data,row.mask) 
     116                       if not mask]) 
     117             for row 
     118             in mtheta] 
    105119 
    106120    firstElevation = True 
    107     indices = range(0,rho.shape[0]
     121    indices = range(len(rho)
    108122    previousX = [indices[-1]] + indices[:-1]  
    109123    nextX = indices[1:] + [indices[0]]  
     
    126140            fig.savefig(outFile) 
    127141 
    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()  
     142            # htmlFile = os.path.join(pngDir,ncFileName + "_" + ('%dm' % z[x]) + os.extsep + htmlExt)  
     143            # html = html1 + month + " " + year 
     144            # html = html + html2 + ('%dm' % z[x]) 
     145            # html = html + html3 + previous + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 
     146            # html = html + html4 + next + "_" + ('%dm' % z[x]) + os.extsep + htmlExt 
     147            # html = html + html5 + ncFileName + "_" + ('%dm' % z[previousX]) + os.extsep + htmlExt 
     148            # html = html + html6 + ncFileName + "_" + ('%dm' % z[nextX]) + os.extsep + htmlExt 
     149            # html = html + html7 + os.path.join(ncFileName,os.path.basename(outFile)) + html8  
     150            # handle = open(htmlFile,'w')  
     151            # handle.write(html)  
     152            # handle.close()  
    139153 
    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()  
     154            # if firstMonth and firstElevation:  
     155            #     firstMonth = False 
     156            #     firstElevation = False 
     157            #     htmlFile = os.path.join(pngDir,"index" + os.extsep + htmlExt)  
     158            #     handle = open(htmlFile,'w')  
     159            #     handle.write(html)  
     160            #     handle.close()  
    147161