[SciPy-user] netCDF files, ctypes, and numpy

Chris Lee C.J.Lee@tnw.utwente...
Wed Jun 18 02:26:57 CDT 2008

Hi All,

I am trying to develop a script to read and write netCDF files. I  
could use Scientific.IO to do this (and in fact I already do this on a  
linux box) but I would rather use a single script that talks directly  
to the library so that I avoid needing to ensure that Scientific,  
Numeric, and numpy are all installed on every system the code gets  
used on.

I have made a start, using ctypes, I can load the netCDF file, read  
the attributes of each variable, count the dimensions and the  
variables.... but there are a few things that baffle me...

The file I am working with has multiple variables that use a single  
dimension. When I try and discover which dimensions are used, or load  
values from the variable, the buffer remains null. It appears that  
ctypes uses create_string_buffer(some_size) for all buffers.

Does anyone have any experience with this?


More information about the SciPy-user mailing list