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 !
Problems on import octant
-
- Posts: 11
- Joined: Wed Dec 19, 2007 4:44 pm
- Location: School of Ocean and Earth Science and Technology
Re: Problems on import octant
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:
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
Re: Problems on import octant
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:
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.
https://github.com/hetland/octant
You can download it using the command:
Code: Select all
git clone https://github.com/hetland/octant.git
-Rob
p.s. I'll delete the googlecode version, and point to github, as this is not the first time this has happened.