-
Notifications
You must be signed in to change notification settings - Fork 27
Description
When reading boundary data, the points file isn't always read correctly and thus it stops at an assertion. The function that reads the points file has this comment:
windtools/windtools/SOWFA6/constant/boundaryData.py
Lines 147 to 149 in f18bbc1
| """Detects y and z (1-D arrays) from a list of points on a | |
| structured grid. Makes no assumptions about the point | |
| ordering |
but it does make assumptions on the ordering. In this function, the user can specify the number of points in the two directions and the code assumes certain order by doing
| y = ylist.reshape((NY,NZ))[:,0] |
If the user doesn't pass the number of points-- or rather, the points are in fact scrambled and the reshape above is not desirable-- it assumes one of the dimensions is varying faster in an ordered manner:
windtools/windtools/SOWFA6/constant/boundaryData.py
Lines 159 to 161 in f18bbc1
| elif zlist[1]==zlist[0]: | |
| # y changes faster, F-ordering | |
| NY = np.nonzero(zlist > zlist[0])[0][0] |
or,
windtools/windtools/SOWFA6/constant/boundaryData.py
Lines 166 to 168 in f18bbc1
| elif ylist[1]==ylist[0]: | |
| # z changes faster, C-ordering | |
| NZ = np.nonzero(ylist > ylist[0])[0][0] |
The issue is that it assumes that the slow-varying dimension is ordered. The number of points in the slow-varying dimension, obtained with, for example, NY = np.nonzero(zlist > zlist[0])[0][0] only gives the correct number of points in that dimension when zlist is equal to np.sort(zlist). The re-ordering index obtained by reading points need to be carried forward and used when reading the actual files U, T,`k', etc.