[Thread Prev][Thread Next][Index]

[ferret_users] LIST/CLOBBER doesn't trim the file



Hi Ferret users,

I've found that LIST/CLOBBER/FORMAT=STREAM doesn't trim the file if it already exists and is longer than the data written.

Suppose that our file "out.bin" is currently 1000-byte long and we are now going to overwrite it with 16 bytes of data:

yes? list/clobber/format=stream/file=out.bin sixteen_byte_var

Then, only the first 16 bytes of "out.bin" is overwritten and the remaining bytes retain their original values.  That, I suppose, doesn't agree with the spirit of CLOBBER.

[In Fortran, CLOBBER should mean OPEN(STATUS="REPLACE"), I suppose.]

I provide a self-contained example below. I tested the code  on

PyFerret v7.43 (optimized)
Darwin 16.7.0 - 09/14/18

on macOS Mojave.

Best regards,
Ryo
-----------------
set data levitus_climatology

! Create a file of 2 KiB filled with zeros.
SP dd if=/dev/zero of=out2.bin  bs=1024  count=2

list/clobber/format=stream/file=out1.bin temp[x=180,y=0]
list/clobber/format=stream/file=out2.bin temp[x=180,y=0]


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement