Dear All,
I'm new ROMS user.
I try to build grid covering 60E-160W, 40S-50N.
Preparing boundary.dat seem to be fine,
but I'v got a problem in adding topograpy.
I prefer to use ETOPO5.nc as input
and follow Main_grid.m but when I
type command:
>> tic; h=rnt_griddata(lon,lat,topo,grd.lonr,grd.latr,'cubic');toc;
then I got this error
ERROR: Five inputs needed. (Manu)
??? One or more output arguments not assigned during call to "rnt_hindicesTRI_mex".
Error in ==> rnt_hindicesTRI at 41
[Ipos,Jpos,triX,triY,Ival,Jval]=rnt_hindicesTRI_mex(Xpos,Ypos,Xgrd,Ygrd);
Error in ==> rnt_griddata at 36
[Ipos,Jpos]=rnt_hindicesTRI(lon(:),lat(:),Xgrd,Ygrd);
I checked lon, lat topo, grd.lonr,and grd.latr, all of them can redable.
Please help and suggest how to solve this problem.
Thank you very much for your kind.
Kritanai, Thailand
Build grid -Topography
Re: Build grid -Topography
the annoying mex problem, i don't know how to fix it in Windows, but in Ubuntu, i use Matlab2009a,and use g95 to mex;
1. first, after decompressing the g95,you should create a symbolic link from a directory in your $PATH (e.g. ~/bin) to the executable:(in my case)
sudo ln -s $PWD/roms_softwares/g95-install/bin/i686-pc-linux-gnu-g95 /usr/bin/g95
or matlab will tell you "could not find g95"
2. "Set up the following environemental variables in your .bashrc file if you use bash shell" as rnt tells you, in my case, open bashrc(sudo gedit ~/.bashrc) and add the following section:
#---------------------g95 section----------------------------
export MATLABPATH='/home/administrator/roms/matlab'
G95_PATH=/home/administrator/roms_softwares/g95-install
# Add library to path for g95
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="${G95_PATH}/lib/gcc-lib/i686-pc-linux-gnu/4.0.3"
else
LD_LIBRARY_PATH="${G95_PATH}/lib/gcc-lib/i686-pc-linux-gnu/4.0.3"
fi
export LD_LIBRARY_PATH
# Add G95 to path
PATH="${G95_PATH}/bin:$PATH"; export PATH
#-------------------------------------------------------------------------------
3 .(this is refer to /matlab/mex/mexsepeli/README)open matlab's mexopts (/home/administrator/matlab2009a/bin/mexopts.sh) and there are three parts need to be modified:
in the glnx86 section, change
CLIBS="$RPATH $MLIBS -lm"
FLIBS="$RPATH $MLIBS -lm“
to
CLIBS="$RPATH $MLIBS -lm /usr/lib/i386-linux-gnu/libstdc++.so.6"
FLIBS="$RPATH $MLIBS -lm /usr/lib/i386-linux-gnu/libstdc++.so.6"
at the bottom of the file,uncomment the FFLAGS line down, make it look like:
# FC="$FC"
# FFLAGS="$FFLAGS"
FFLAGS="-g -fno-second-underscore $FFLAGS"
# FOPTIMFLAGS="$FOPTIMFLAGS"
# FDEBUGFLAGS="$FDEBUGFLAGS"
# FLIBS="$FLIBS"
FFLAGS="-g -fno-second-underscore $FFLAGS"
4. replace all the "interger*8" to "interger", and "MXCREATEFULL" to "MXCREATEDOUBLEMATRIX" in the F file, and mex them
1. first, after decompressing the g95,you should create a symbolic link from a directory in your $PATH (e.g. ~/bin) to the executable:(in my case)
sudo ln -s $PWD/roms_softwares/g95-install/bin/i686-pc-linux-gnu-g95 /usr/bin/g95
or matlab will tell you "could not find g95"
2. "Set up the following environemental variables in your .bashrc file if you use bash shell" as rnt tells you, in my case, open bashrc(sudo gedit ~/.bashrc) and add the following section:
#---------------------g95 section----------------------------
export MATLABPATH='/home/administrator/roms/matlab'
G95_PATH=/home/administrator/roms_softwares/g95-install
# Add library to path for g95
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="${G95_PATH}/lib/gcc-lib/i686-pc-linux-gnu/4.0.3"
else
LD_LIBRARY_PATH="${G95_PATH}/lib/gcc-lib/i686-pc-linux-gnu/4.0.3"
fi
export LD_LIBRARY_PATH
# Add G95 to path
PATH="${G95_PATH}/bin:$PATH"; export PATH
#-------------------------------------------------------------------------------
3 .(this is refer to /matlab/mex/mexsepeli/README)open matlab's mexopts (/home/administrator/matlab2009a/bin/mexopts.sh) and there are three parts need to be modified:
in the glnx86 section, change
CLIBS="$RPATH $MLIBS -lm"
FLIBS="$RPATH $MLIBS -lm“
to
CLIBS="$RPATH $MLIBS -lm /usr/lib/i386-linux-gnu/libstdc++.so.6"
FLIBS="$RPATH $MLIBS -lm /usr/lib/i386-linux-gnu/libstdc++.so.6"
at the bottom of the file,uncomment the FFLAGS line down, make it look like:
# FC="$FC"
# FFLAGS="$FFLAGS"
FFLAGS="-g -fno-second-underscore $FFLAGS"
# FOPTIMFLAGS="$FOPTIMFLAGS"
# FDEBUGFLAGS="$FDEBUGFLAGS"
# FLIBS="$FLIBS"
FFLAGS="-g -fno-second-underscore $FFLAGS"
4. replace all the "interger*8" to "interger", and "MXCREATEFULL" to "MXCREATEDOUBLEMATRIX" in the F file, and mex them
- arango
- Site Admin
- Posts: 1356
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: Build grid -Topography
I highly recommend to everybody to stop using the RNT toolbox. We do not support such a toolbox. I don't think that it has been updated in several years. I am aware of several things that are incorrect and inconsistent in that toolbox with modern versions of ROMS. In particular, it does not support the new vertical coordinate transformations of ROMS. So the depths are incorrect
It also uses Matlab functions that will deprecated in future versions. For example, we should use TriScatteredInterp instead of griddata. It is possible that Matlab will discontinue support for griddata in the future
I highly recommend everybody to learn how to use TriScatteredInterp ... It is absolutely fantastic
There is no reason nowadays to use the MEX interface in Matlab to have access to old Fortran codes. Modern Matlab offers excellent routines for interpolation and finding indices. The intrinsic inpolygon function is excellent, fast, and accurate to determine such indices for horizontal curvilinear interpolations. Matlab has made great efforts improving the a lot the basic functions and their efficiency.
Starting with Matlab 2012a, there is a complete support to any type of NetCDF file including OpenDAP access. No longer there is a need for third party support interfaces for Matlab like MEXNC, SNCTOOLS, and others. The native NetCDF interface for Matlab started with version 2008a. We are currently eliminating the need for these third party NetCDF interfaces in all the future releases of all the distributed Matlab scripts in ROMS repository.
In my opinion, every ROMS user should master any of the tools that are available out there to pre- and post-processing ROMS data. Some of us like Matlab and Python programming language and graphical interfaces.
You are just interpolation the bathymetry to your grid... It can be done directly in Matlab without the need of such toolboxes. This is very trivial stuff. Use the matlab scripts distributed in ROMS repositories to process your data. You just need to be familiar with them and learn how to use them. All these scripts are maintained and tested with newer versions of ROMS and Matlab.
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
![Cool 8)](./images/smilies/icon_cool.gif)
There is no reason nowadays to use the MEX interface in Matlab to have access to old Fortran codes. Modern Matlab offers excellent routines for interpolation and finding indices. The intrinsic inpolygon function is excellent, fast, and accurate to determine such indices for horizontal curvilinear interpolations. Matlab has made great efforts improving the a lot the basic functions and their efficiency.
Starting with Matlab 2012a, there is a complete support to any type of NetCDF file including OpenDAP access. No longer there is a need for third party support interfaces for Matlab like MEXNC, SNCTOOLS, and others. The native NetCDF interface for Matlab started with version 2008a. We are currently eliminating the need for these third party NetCDF interfaces in all the future releases of all the distributed Matlab scripts in ROMS repository.
In my opinion, every ROMS user should master any of the tools that are available out there to pre- and post-processing ROMS data. Some of us like Matlab and Python programming language and graphical interfaces.
You are just interpolation the bathymetry to your grid... It can be done directly in Matlab without the need of such toolboxes. This is very trivial stuff. Use the matlab scripts distributed in ROMS repositories to process your data. You just need to be familiar with them and learn how to use them. All these scripts are maintained and tested with newer versions of ROMS and Matlab.
Re: Build grid -Topography
well, what a blow:!: i need a new episode of BingBang to relax
-
- Posts: 13
- Joined: Wed Jul 27, 2011 3:35 am
- Location: IOCAS
Re: Build grid -Topography
Hello,Wei,I did what you have posted,but it still didn't work.Here is the error message:
>> rnt_compile
Warning: You are using gcc version "4.6.3-1ubuntu5)". The earliest gcc version supported
with mex is "4.1". The latest version tested for use with mex is "4.2".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mex.f:57
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mex.f:74
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
ld: cannot find crti.o: No such file or directory
mex: link of ' "rnt_2s_mex.mexglx"' failed.
??? Error using ==> mex at 221
Unable to complete successfully.
Error in ==> rnt_compile at 3
mex rnt_2s_mex.f
I can't figure out why.However,I have just noticed that maybe we're in the same city,I wonder whether it is convinient for you to leave your QQ number or something.My QQ:632675463 .Thank you.
>> rnt_compile
Warning: You are using gcc version "4.6.3-1ubuntu5)". The earliest gcc version supported
with mex is "4.1". The latest version tested for use with mex is "4.2".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mex.f:57
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mex.f:74
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
ld: cannot find crti.o: No such file or directory
mex: link of ' "rnt_2s_mex.mexglx"' failed.
??? Error using ==> mex at 221
Unable to complete successfully.
Error in ==> rnt_compile at 3
mex rnt_2s_mex.f
I can't figure out why.However,I have just noticed that maybe we're in the same city,I wonder whether it is convinient for you to leave your QQ number or something.My QQ:632675463 .Thank you.
DongniWei wrote:the annoying mex problem, i don't know how to fix it in Windows, but in Ubuntu, i use Matlab2009a,and use g95 to mex;
1. first, after decompressing the g95,you should create a symbolic link from a directory in your $PATH (e.g. ~/bin) to the executable:(in my case)
sudo ln -s $PWD/roms_softwares/g95-install/bin/i686-pc-linux-gnu-g95 /usr/bin/g95
or matlab will tell you "could not find g95"
2. "Set up the following environemental variables in your .bashrc file if you use bash shell" as rnt tells you, in my case, open bashrc(sudo gedit ~/.bashrc) and add the following section:
#---------------------g95 section----------------------------
export MATLABPATH='/home/administrator/roms/matlab'
G95_PATH=/home/administrator/roms_softwares/g95-install
# Add library to path for g95
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="${G95_PATH}/lib/gcc-lib/i686-pc-linux-gnu/4.0.3"
else
LD_LIBRARY_PATH="${G95_PATH}/lib/gcc-lib/i686-pc-linux-gnu/4.0.3"
fi
export LD_LIBRARY_PATH
# Add G95 to path
PATH="${G95_PATH}/bin:$PATH"; export PATH
#-------------------------------------------------------------------------------
3 .(this is refer to /matlab/mex/mexsepeli/README)open matlab's mexopts (/home/administrator/matlab2009a/bin/mexopts.sh) and there are three parts need to be modified:
in the glnx86 section, change
CLIBS="$RPATH $MLIBS -lm"
FLIBS="$RPATH $MLIBS -lm“
to
CLIBS="$RPATH $MLIBS -lm /usr/lib/i386-linux-gnu/libstdc++.so.6"
FLIBS="$RPATH $MLIBS -lm /usr/lib/i386-linux-gnu/libstdc++.so.6"
at the bottom of the file,uncomment the FFLAGS line down, make it look like:
# FC="$FC"
# FFLAGS="$FFLAGS"
FFLAGS="-g -fno-second-underscore $FFLAGS"
# FOPTIMFLAGS="$FOPTIMFLAGS"
# FDEBUGFLAGS="$FDEBUGFLAGS"
# FLIBS="$FLIBS"
FFLAGS="-g -fno-second-underscore $FFLAGS"
4. replace all the "interger*8" to "interger", and "MXCREATEFULL" to "MXCREATEDOUBLEMATRIX" in the F file, and mex them