[Numpy-discussion] reading big-endian uint16 into array on little-endian machine

greg whittier gregwh@gmail....
Thu Jun 17 10:59:59 CDT 2010


On Thu, Jun 17, 2010 at 10:41 AM, Robert Kern <robert.kern@gmail.com> wrote:
> On Thu, Jun 17, 2010 at 09:29, greg whittier <gregwh@gmail.com> wrote:
>> I have files (from an external source) that contain ~10 GB of
>> big-endian uint16's that I need to read into a series of arrays.
>
> np.fromfile(filename, dtype='>i2')
>
> --
> Robert Kern
>


Doh!  I'm so used to doing np.uint16 that I didn't think of other
options to pass to dtype.  (And yes, I was referring to the standard
array module.)

Thanks!
Greg


More information about the NumPy-Discussion mailing list