So I just started a programming course in python and I have this assignment called 'Wind data analysis' in which I am to extract data from a bin.file and sort it into x,y and z values. So far I got:
filename="turb21351_L72u.bin"
with open(filename,'br') as f:
buffer = f.read(100000)
print("Length of buffer is %d" % len(buffer))
for i in buffer:
print(int(i))
Which works fine (note; there are some indentation error on the script i wrote here) and gives me value in the range 1 to 300.
The problem is sorting the data. The description of the assignment sounds like this:
"The data file consists of Nz X Ny X Nx numbers (floating point single precision). The sequence of the numbers corresponds to indexes z, y and x which all increase sequentially from 1 to Nz, Ny and Nx respectively. The fastest-varying index is z, followed by y, and the slowest varying index is x. That is, the first Nz numbers from the sequence correspond to indexes z going from 1 to Nz, y = 1, and x = 1. Based on this ordering rule, the function must convert the data to a three-dimensional array with dimensions Nz X Ny X Nx."
My question is:
How is the assigniment description to be understood mathmathtically and how would one go about sorting it based on the ordering rule?