IDL to Python IO - tiagopereira/python_tips GitHub Wiki

IDL to Python IO

(to be expanded)

I/O conversion quick sheet from IDL to Python

  • openr/readu -> tt.io.fort_read
  • writeu -> tt.io.fort_write
  • assoc -> numpy.memmap

Note: readu should also be possible with numpy.fromfile (followed by a transpose to put Fortran-order into C-order), or numpy.memmap. However, care will have to be taken with the size of header and footer. (fort_read is essentially a numpy.fromfile.) The fort_read/numpy.fromfile approach has the advantage that the file object can be read sequentially, without the need for updating the offset in numpy.memmap.