Getting back to this, 

byteswap() looks like a general endian solution for ndarrays: 

https://stackoverflow.com/questions/49578507/fast-way-to-reverse-float32-endianness-in-binary-file

The examples there specify float32 format for opening a file, but that
seemed to scramble the header that was output. No header being the
desired behavior for the BE file, which happened to occur when using
byteswap from the same program that made the mem-mapped data that was
the normal ndarray, in which case no header was written (conveniently
for java). 

Little-endian access can be handled in java with ByteBuffer.order(). 

Bill 

--

Phobrain.com 

On 2023-01-01 08:31, Jerome Kieffer wrote:

> On Sun, 01 Jan 2023 05:31:55 -0800
> Bill Ross <bross_phobr...@sonic.net> wrote:
> 
> Thanks! 
> 
> Java is known to be big-endian ... your CPU is probably little-endian.    
> $ lscpu | grep -i endian
> Byte Order: Little Endian 
> 
> Numpy has the tools to represent an array of double BE.    
> Is there a lower-level ndarray method that writes an array that could be
> used this way?

One example:

[not applicable, redacted over bounce of previous try]

_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: bross_phobr...@sonic.net
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to