Re: [Numpy-discussion] How to copy data from a C array to a numpy array efficiently?

2012-10-07 Thread Jianbao Tao
Dag, Thanks for your tip. I didn't know that I could use a numpy array directly. I tried that out, and it works like a charm. :-) Jonathan, Glad that you mentioned spacepy. I actually tried spacepy before I decided to write my own wrapper. However, on the one hand, I can't install spacepy on my

[Numpy-discussion] How to copy data from a C array to a numpy array efficiently?

2012-10-06 Thread Jianbao Tao
Hi, I am developing a Python wrapper of the NASA CDF C library in Cython. I have got a working version of it now, but it is slower than the counterpart in IDL. For loading the same file, mine takes about 400 ms, whereas the IDL version takes about 290 ms. The main overhead in my code is caused by