NOAA-PMEL / Ferret

The Ferret program from NOAA/PMEL
https://ferret.pmel.noaa.gov/Ferret/
The Unlicense
55 stars 20 forks source link

Binary codes for the head and tail of data output by Fortran using unformatted format #1995

Open lilinling509 opened 2 years ago

lilinling509 commented 2 years ago

I come across a problem in editing a binary file which includes a large array outputted by Fortran in unformatted data format. As I know that the unformatted method will add 4 bytes at both the head and the tail of the array to indicate the number of bytes taking by the array. I can read in that 4 bytes using Julia read function as Int32, finding them equal and it works when the number is less than 2147483647. But I recently get a far larger array and I find there is 4 bytes at the head but 12 bytes at the tail. I can't understand what is happening. Any one can help? By the way, the large array is the CFD flow field in format plot3d. 我在编辑一个二进制文件时遇到了一个问题,其中包括一个由Fortran以未格式化数据格式输出的大数组。我知道未格式化的方法会在数组的头部和尾部增加4个字节来表示数组所占的字节数。我可以使用Julia读函数将这4个字节作为Int32读入,发现它们相等,当数字小于2147483647时,它是有效的。但是我最近得到了一个大得多的数组,我发现在头部有4个字节,但是在尾部有12个字节。我不明白发生了什么。有谁能帮忙吗?顺便说一下,这个大数组是格式为plot3d的CFD流场。