[Thread Prev][Thread Next][Index]

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

Hi Ryo,

You're right that of course /CLOBBER should open the file in such a way that it's wiped out and contains nothing but the data currently being written. 

Thank you for the example - that same behavior goes back to all the older versions of Ferret.  Looking into the code, this seems to be intentional, but I can't imagine why this would have been implemented this way (maybe it's just an oversight). There's nothing about this in the documentation or old tickets. Clobber is clobber.  We'll change it.


On 12/4/2018 9:24 AM, Ryo Furue wrote:
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,
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