[Numpy-discussion] Changing the numpy array into required shape
cleo21drakos at gmail.com
Sat Aug 23 02:14:54 EDT 2014
Hello numpy users:
I have 2d numpy array of 480 rows and 1440 columns as named by 'data' below:
The first element belongs to (49.875S,179.875W),
the second element belongs to (49.625S,179.625W),and the last element
belongs to (49.875N,179.875E).
import os, glob, gdal, numpy as np
fname = '3B42RT.2014010606.7.bin'
with open(fname, 'rb') as fi:
data = np.fromfile(fi,dtype=np.uint16,count=480*1440)
data = data.byteswap()
data = data.reshape(1440,480)
How can I convert this numpy array so that its first element belongs to
(49.875N,179.625W), i.e., upper left latitude and longitude respectively;
and the last element belong to (49.625S,179.875E), i.e., lower right
latitute and longitude respectively.
I tried to rotate it, but I do not think it is correct.
data = np.rot90(data,1)
Have some of you experienced with this type of problem? The binary file I
am using is here:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion