Problems on import octant

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
wzf1984
Posts: 3
Joined: Wed May 02, 2012 7:38 pm
Location: Ocean University of China

Problems on import octant

#1 Unread post by wzf1984 »

I have install octant occording to
https://code.google.com/p/octant/wiki/installation
I have replaced line in grid.py with
self.libgridgen = np.ctypeslib.load_library('libgridgen', '/usr/local/lib')

However, when I import octant , there are errors:

>>> import octant
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/octant/__init__.py", line 25, in <module>
import grid
File "/usr/local/lib/python2.7/dist-packages/octant/grid.py", line 902
self._libgridgen.gridgen_generategrid2.restype = ctypes.c_void_p
^
IndentationError: unindent does not match any outer indentation level

I would appreciate your help !

saulo
Posts: 11
Joined: Wed Dec 19, 2007 4:44 pm
Location: School of Ocean and Earth Science and Technology

Re: Problems on import octant

#2 Unread post by saulo »

Hi,

You probably disrupted the python indentation when commenting a line of the grid.py, which if I remember is a necessary step on the instructions. Make sure all lines in this function are 4 columns from beguining of def statement. You can use an editor with automatic python indentation as well.
My bit of grid.py looks like this:

Code: Select all

    def __init__(self, xbry, ybry, beta, shape, ul_idx=0, \
                 focus=None, proj=None, \
                 nnodes=14, precision=1.0e-12, nppe=3, \
                 newton=True, thin=True, checksimplepoly=True, verbose=False):
        
        self._libgridgen = np.ctypeslib.load_library('libgridgen', '/usr/local/lib')
        print octant.__path__[0]
        #self._libgridgen = np.ctypeslib.load_library('_gridgen', octant.__path__[0])
        
        self._libgridgen.gridgen_generategrid2.restype = ctypes.c_void_p
        self._libgridgen.gridnodes_getx.restype = ctypes.POINTER(ctypes.POINTER(ctypes.c_double))
        self._libgridgen.gridnodes_gety.restype = ctypes.POINTER(ctypes.POINTER(ctypes.c_double))
        self._libgridgen.gridnodes_getnce1.restype = ctypes.c_int
        self._libgridgen.gridnodes_getnce2.restype = ctypes.c_int
        self._libgridgen.gridmap_build.restype = ctypes.c_void_p

User avatar
hetland
Posts: 81
Joined: Thu Jul 03, 2003 3:39 pm
Location: TAMU,USA

Re: Problems on import octant

#3 Unread post by hetland »

The googlecode version of octant is deprecated. You should use the one on github:

https://github.com/hetland/octant

You can download it using the command:

Code: Select all

git clone https://github.com/hetland/octant.git
For this version, I separated out the gridgen stuff, so it should be much easier to install.

-Rob

p.s. I'll delete the googlecode version, and point to github, as this is not the first time this has happened.

Post Reply