subclassing Scientific.IO.NetCDFFile
Jon Beezley
jon.beezley at gmail.com
Sun Sep 6 06:33:19 EDT 2009
Hi all,
I have come across a problem that I am unsure how to get around. What
I want to do is create a subclass of Scientific.IO.NetCDFFile, but
despite what the docstrings say isn't really a class at all, but a
function that returns some sort of data structure from the netcdf C
api. I am aware of pure python implementations such as
scipy.io.netcdf_file, but these seem to have internal limitations
causing overflows when opening large (e.g. several gigabytes) files.
I have tried creating a class with an open NetCDFFile as a member
(f). File attributes are easy enough to deal with
(self.__dict__=self.f.__dict__), and I can even create callable
methods such as self.dimensions which return self.f.dimensions.
However, when it comes to more esoteric aspects such as multi-
dimensional slicing of the variables (derived somehow from
numpy.array), I am somewhat at a loss.
So my question is: Is there a simple method of containing NetCDFFile
in a class? If not, how can I design a class that will behave like
NetCDFFile from the user perspective?
Thanks,
Jon
More information about the Python-list
mailing list