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

greg whittier gregwh at gmail.com
Thu Jun 17 11:59:59 EDT 2010


On Thu, Jun 17, 2010 at 10:41 AM, Robert Kern <robert.kern at gmail.com> wrote:
> On Thu, Jun 17, 2010 at 09:29, greg whittier <gregwh at 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