Cache file handle to netCDF files in python

E Efkan YILMAZ 2 years 4 months ago
13 0 0

Is there a way to cache python file handles? I have a function that takes a netCDF file path as input, opens it, extracts some data from the netCDF file and closes it. It gets called a lot of times, and the overhead of opening the file each time is high.

How can I make it faster by maybe caching the file handle? Maybe there is a python library to do this

CONTACT
Can’t find what you’re looking for?