[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #SID-581519]: posix_fadvise


The python netcdf4 library wraps the netcdf4 C library. The C library handles 
all of the calls that open files, so there is no Python file object available 
to use with posix_fadvise() in Python.

As far as I can tell, I don't think what you want to achieve would be possible.


> Linux provides the function posix_fadvise to instruct the kernel to
> discard the IO cache for an open file after use with the parameter
> POSIX_FADV_DONTNEED. This is useful if many large files are read in
> (only once). I can use fadvise with files opened with a python "open"
> statement but not with the file objects returned by netcdf4.Dataset.
> f=netCDF4.Dataset(fn,'r')
> m=fallocate.posix_fadvise(f, 0, siz,fallocate.POSIX_FADV_DONTNEED)
> fails.
> Can you instruct me how to use fadvise with netcdf files?

Ticket Details
Ticket ID: SID-581519
Department: Support Python
Priority: Normal
Status: Closed