octant generating curvilinear gird
octant generating curvilinear gird
Hi,
Who has generated curvilinear gird using octant? Do you have a manual or just provide an example?
Thanks a lot.
Who has generated curvilinear gird using octant? Do you have a manual or just provide an example?
Thanks a lot.
Re: octant generating curvilinear gird
Hi,
I have used Octant however I learn it more by looking at the source code and run commands interactively by Ipython. If you have specific question I will be happy to answer/help.
- Saeed.
I have used Octant however I learn it more by looking at the source code and run commands interactively by Ipython. If you have specific question I will be happy to answer/help.
- Saeed.
Re: octant generating curvilinear gird
Hi Saeed,
I can make some simple programming using python. Do you have the source code generating curvilinear grid? I can follow and try it interactively by Ipython. I will make learning easier. Thank you.
I can make some simple programming using python. Do you have the source code generating curvilinear grid? I can follow and try it interactively by Ipython. I will make learning easier. Thank you.
Re: octant generating curvilinear gird
Hi,
Here is one of my examples.
I hope it helps. I wrote it for GETM which should work for ROMS too.
Good luck,
Saeed.
Here is one of my examples.
I hope it helps. I wrote it for GETM which should work for ROMS too.
Good luck,
Saeed.
- Attachments
-
curv_grid_test.py
- (4.45 KiB) Downloaded 505 times
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: octant generating curvilinear gird
Hi,moghimi wrote:Hi,
I have used Octant however I learn it more by looking at the source code and run commands interactively by Ipython. If you have specific question I will be happy to answer/help.
- Saeed.
May you help me to install octant correctly in my ubuntu system? It seems I installed nn, csa, gridutils, and gridgen correctly. However, when I tried to make a simple grid it showed that libgridgen.so hasn't been found by python.
I am attaching the link with my question if you want to help me.
viewtopic.php?f=23&t=3651
Thank you in advance
Re: octant generating curvilinear gird
Hi again,
I guess, you either need to find the location of the library and change the path to this location inside the code (e.g. here octant.__path__[0] and other places based on the error message)and do python setup install again, or make a symbulic link to that library into your usr/local/lib or somewhere that python usually looks into it (PYTHONPATH).
You also may need to add the gridgen directory to your LD_LIBRARY path.
I hope it helps,
Saeed.
I guess, you either need to find the location of the library and change the path to this location inside the code (e.g. here octant.__path__[0] and other places based on the error message)and do python setup install again, or make a symbulic link to that library into your usr/local/lib or somewhere that python usually looks into it (PYTHONPATH).
You also may need to add the gridgen directory to your LD_LIBRARY path.
I hope it helps,
Saeed.
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: octant generating curvilinear gird
Hi again,moghimi wrote:Hi again,
I guess, you either need to find the location of the library and change the path to this location inside the code (e.g. here octant.__path__[0] and other places based on the error message)and do python setup install again, or make a symbulic link to that library into your usr/local/lib or somewhere that python usually looks into it (PYTHONPATH).
You also may need to add the gridgen directory to your LD_LIBRARY path.
I hope it helps,
Saeed.
thank you for answering me promptly, I will try to do what you mentioned above.
Cheers,
Matheus
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: octant generating curvilinear gird
Hi moghimi,
I have fixed this issue as you said. However, now I can't import octant.csa. Even though, I installed nn, gridgen, csa, and gridutils in the same path. When I tried to import octant.csa, I got this error:
OSError Traceback (most recent call last)
<ipython-input-6-6b2d83a1f717> in <module>()
----> 1 import octant.csa
/usr/local/lib/python2.7/dist-packages/octant/csa.py in <module>()
7 import octant
8
----> 9 class CSA(object):
10 '''cubic spline approximation for re-gridding 2D data sets
11
/usr/local/lib/python2.7/dist-packages/octant/csa.py in CSA()
60
61 #_csa = np.ctypeslib.load_library('_csa', octant.__path__[0])
---> 62 _csa = np.ctypeslib.load_library('libcsa', '/home/fagundes/libsmodels/Grid/lib')
63
64 _csa.csa_approximatepoints2.restype = ctypes.POINTER(ctypes.c_double)
/usr/lib/python2.7/dist-packages/numpy/ctypeslib.pyc in load_library(libname, loader_path)
134 raise
135 ## if no successful return in the libname_ext loop:
--> 136 raise OSError("no file with expected extension")
137
138 ctypes_load_library = deprecate(load_library, 'ctypes_load_library',
OSError: no file with expected extension
Since It seems an error pretty similar to that one you helped me to solve, my approach was changing its path, it didn't work out, though.
Would you have any idea how to fix it?
Thank you in advance,
Matheus
I have fixed this issue as you said. However, now I can't import octant.csa. Even though, I installed nn, gridgen, csa, and gridutils in the same path. When I tried to import octant.csa, I got this error:
OSError Traceback (most recent call last)
<ipython-input-6-6b2d83a1f717> in <module>()
----> 1 import octant.csa
/usr/local/lib/python2.7/dist-packages/octant/csa.py in <module>()
7 import octant
8
----> 9 class CSA(object):
10 '''cubic spline approximation for re-gridding 2D data sets
11
/usr/local/lib/python2.7/dist-packages/octant/csa.py in CSA()
60
61 #_csa = np.ctypeslib.load_library('_csa', octant.__path__[0])
---> 62 _csa = np.ctypeslib.load_library('libcsa', '/home/fagundes/libsmodels/Grid/lib')
63
64 _csa.csa_approximatepoints2.restype = ctypes.POINTER(ctypes.c_double)
/usr/lib/python2.7/dist-packages/numpy/ctypeslib.pyc in load_library(libname, loader_path)
134 raise
135 ## if no successful return in the libname_ext loop:
--> 136 raise OSError("no file with expected extension")
137
138 ctypes_load_library = deprecate(load_library, 'ctypes_load_library',
OSError: no file with expected extension
Since It seems an error pretty similar to that one you helped me to solve, my approach was changing its path, it didn't work out, though.
Would you have any idea how to fix it?
Thank you in advance,
Matheus
Re: octant generating curvilinear gird
Hi,
It seems the 'libcsa' is not in this directory '/home/fagundes/libsmodels/Grid/lib'.
As a test, would you please copy all the libs (.a and .so) files into your ~/.local/lib/ and complie the octant once again.
Saeed.
It seems the 'libcsa' is not in this directory '/home/fagundes/libsmodels/Grid/lib'.
As a test, would you please copy all the libs (.a and .so) files into your ~/.local/lib/ and complie the octant once again.
Saeed.
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: octant generating curvilinear gird
Hi, I have compiled octant changing csa's path in csa.py (following these instructions: http://sourceforge.net/p/getm-utils/wiki/octant/), also, re-installed all the libs using default path (/usr/local/) and octant, as well, but it keeps me showing the same error when I try to import octant.csa in ipython. Furthermore, I have installed python-csa just to make sure it wasn't the problem, octant.csa didn't work, though. Do you think I should add a path to my .bashrc?moghimi wrote:Hi,
It seems the 'libcsa' is not in this directory '/home/fagundes/libsmodels/Grid/lib'.
As a test, would you please copy all the libs (.a and .so) files into your ~/.local/lib/ and complie the octant once again.
Saeed.
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
Cheers,
Matheus
Re: octant generating curvilinear gird
Hi again,
Here is what I wrote as note when I tried octant years ago. I hope it helps you.
Saeed.
############################################################################
#saeed Moghimi
#moghimis@gmail.com
#Fri 09 Dec 2011 06:43:12 AM CET
Octant Installation:
A. download:
#Download octant:
svn checkout http://octant.googlecode.com/svn/trunk/ octant-read-only
#Download latest version of gridgen:
svn checkout http://gridgen-c.googlecode.com/svn/gridgen gridgen
#Download latest version of gridutils:
svn checkout http://gridutils-c.googlecode.com/svn/ gridutils
#Download latest version of csa:
svn checkout http://csa-c.googlecode.com/svn/ csa
#Download latest version of nn:
svn checkout http://nn-c.googlecode.com/svn/ nn
B. Compile
Do not forget to set all compiler stuff to gcc,g++,gfortran and ...
rename and replace them with old external subs in Octant
####################
setting for irarum
1. make "nn"
cd nn
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external
make
make install
2. make "csa"
cd csa
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external
make
make install
3. make "gridutils"
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external CPPFLAGS=-I/home/local/moghimi/src/octant/octant-read-only-dec2011/external/include LDFLAGS=-L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
make
make install
4. install newly downloaded gridgen by
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external CPPFLAGS=-I/home/local/moghimi/src/octant/octant-read-only-dec2011/external/include LDFLAGS=-L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
NOTE:
I changed these lines of makefile after ./configure as -->
CFLAGS = -g -O2 -Wall -I/home/local/moghimi/src/octant/octant-read-only-dec2011/external/include
LDFLAGS = -L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
LIBS = -lgu -lm -L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
make
make lib
make shlib
make install
Change this two things :
#############################################################################
1. in file grid.py:
#self._libgridgen = np.ctypeslib.load_library('_gridgen', octant.__path__[0])
to below according to the place of the library:
self._libgridgen = np.ctypeslib.load_library('libgridgen', '/home/local/moghimi/src/octant/octant-read-only-dec2011/external/gridgen')
2. Also:
line 17 from
#from matplotlib.numerix.mlab import amin ##### saeed
to:
from numpy import amin
##############################################################################
3. in file csa.py:
#_csa = np.ctypeslib.load_library('_csa', octant.__path__[0])
to below according to the place of the library:
_csa = np.ctypeslib.load_library('_csa','/home/local/moghimi/src/octant/octant-read-only-dec2011/build/lib.linux-x86_64-2.7/octant')
##############################################################################
4.
#setup octant
python setup.py build --fcompiler=gfortran
python setup.py install --home=/home/local/moghimi/opt/python/
5. add this line to .bashrc
export PYTHONPATH=${PYTHONPATH}:/home/local/moghimi/opt/python/lib/python/
6. add path to your LD_LIBRARY
For finding libs you need to copy every inc and libs also to grid gen directory and add this line in your bashrs too:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:home/local/moghimi/src/octant/octant-read-only-dec2011/external/gridgen
Here is what I wrote as note when I tried octant years ago. I hope it helps you.
Saeed.
############################################################################
#saeed Moghimi
#moghimis@gmail.com
#Fri 09 Dec 2011 06:43:12 AM CET
Octant Installation:
A. download:
#Download octant:
svn checkout http://octant.googlecode.com/svn/trunk/ octant-read-only
#Download latest version of gridgen:
svn checkout http://gridgen-c.googlecode.com/svn/gridgen gridgen
#Download latest version of gridutils:
svn checkout http://gridutils-c.googlecode.com/svn/ gridutils
#Download latest version of csa:
svn checkout http://csa-c.googlecode.com/svn/ csa
#Download latest version of nn:
svn checkout http://nn-c.googlecode.com/svn/ nn
B. Compile
Do not forget to set all compiler stuff to gcc,g++,gfortran and ...
rename and replace them with old external subs in Octant
####################
setting for irarum
1. make "nn"
cd nn
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external
make
make install
2. make "csa"
cd csa
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external
make
make install
3. make "gridutils"
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external CPPFLAGS=-I/home/local/moghimi/src/octant/octant-read-only-dec2011/external/include LDFLAGS=-L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
make
make install
4. install newly downloaded gridgen by
./configure -prefix=/home/local/moghimi/src/octant/octant-read-only-dec2011/external CPPFLAGS=-I/home/local/moghimi/src/octant/octant-read-only-dec2011/external/include LDFLAGS=-L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
NOTE:
I changed these lines of makefile after ./configure as -->
CFLAGS = -g -O2 -Wall -I/home/local/moghimi/src/octant/octant-read-only-dec2011/external/include
LDFLAGS = -L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
LIBS = -lgu -lm -L/home/local/moghimi/src/octant/octant-read-only-dec2011/external/lib
make
make lib
make shlib
make install
Change this two things :
#############################################################################
1. in file grid.py:
#self._libgridgen = np.ctypeslib.load_library('_gridgen', octant.__path__[0])
to below according to the place of the library:
self._libgridgen = np.ctypeslib.load_library('libgridgen', '/home/local/moghimi/src/octant/octant-read-only-dec2011/external/gridgen')
2. Also:
line 17 from
#from matplotlib.numerix.mlab import amin ##### saeed
to:
from numpy import amin
##############################################################################
3. in file csa.py:
#_csa = np.ctypeslib.load_library('_csa', octant.__path__[0])
to below according to the place of the library:
_csa = np.ctypeslib.load_library('_csa','/home/local/moghimi/src/octant/octant-read-only-dec2011/build/lib.linux-x86_64-2.7/octant')
##############################################################################
4.
#setup octant
python setup.py build --fcompiler=gfortran
python setup.py install --home=/home/local/moghimi/opt/python/
5. add this line to .bashrc
export PYTHONPATH=${PYTHONPATH}:/home/local/moghimi/opt/python/lib/python/
6. add path to your LD_LIBRARY
For finding libs you need to copy every inc and libs also to grid gen directory and add this line in your bashrs too:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:home/local/moghimi/src/octant/octant-read-only-dec2011/external/gridgen
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: octant generating curvilinear gird
Hi Saeed,
It works fine now
. However, I have noticed that in its newer version from github, Hetland has removed _csa from the setup and _init_.py files. So at the end, I mixed both versions hahaha, and now I can import octant.csa with no problem at all. Also, I built nn,csa, and so on, using its default paths. On the other hand, octant installation was a little bit trick and as I said I mixed both versions of octant. As a result, when I changed the path in csa.py from octant that I downloaded from github I used the path that was built previously from octant-read-only to get _csa.o in lib*/octant path. After that, I built and installed normally the octant that I downloaded from github. Even though, it sounds a little bit confusing, now everything works smoothly. Thank you a lot for your help.
Cheers,
Matheus
It works fine now
![Smile :)](./images/smilies/icon_smile.gif)
Cheers,
Matheus
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: octant generating curvilinear gird
Hi Saaed,
I was wondering whether I could smooth my bathymetry using octant or I had to make by hand. Could you help me out?
Cheers,
Matheus
I was wondering whether I could smooth my bathymetry using octant or I had to make by hand. Could you help me out?
Cheers,
Matheus
Re: octant generating curvilinear gird
Hi,
You can implement your own or use more advanced packages like the one adopted from Matlab. look at pyroms code here:
https://github.com/kshedstrom/pyroms/tr ... y_smoother
Good luck,
Saeed.
You can implement your own or use more advanced packages like the one adopted from Matlab. look at pyroms code here:
https://github.com/kshedstrom/pyroms/tr ... y_smoother
Good luck,
Saeed.
-
- Posts: 51
- Joined: Wed Dec 03, 2014 1:46 am
- Location: University of Georgia
Re: octant generating curvilinear gird
Hi,
thank you a lot. Have a nice day.
Matheus
thank you a lot. Have a nice day.
Matheus