Dear Ferret users,
I'm trying to read a small portion of a huge binary file but have failed to do so far. Here is the relevant quote from the Ferret manual:
When reading from stream or binary files, the entire grid is read when the data is requested. To read subsets of the data, define a smaller grid to read a subset of records and perhaps write that out to a netCDF file, then do a second read, skipping those first records, and so on.
So, as a test, I was trying to read only the initial 10 elements, like so:
define axis/x=0:9:1 xax
define grid/x=xax mygrid
file/grid=mygrid/var=temp/form=stream/type=r8 temp0-rot-pntd.bin
list temp
When I run the above program (pyferret -nodisplay -script try-slices.jnl), I get this error
**ERROR: Size of file ./temp0-rot-pntd.bin doesn't match size specified by variables/grid
list temp
Command file, command group, or REPEAT execution aborted
*** NOTE: Binary file reading: Insufficient memory reading variable 2
The above script works when the binary file is not huge. So, it seems that Ferret tries to read the whole thing.
It's PyFerret v7.5 on Linux.
Ryo