PYROMS installation

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
ngarg
Posts: 19
Joined: Fri Jul 12, 2013 5:46 pm
Location: NTU

PYROMS installation

#1 Post by ngarg » Thu Sep 26, 2013 5:27 am

Hi,

I am trying to install PYROMS on a desktop FEDORA machine. I have installed netcdf4, netcdf4-cxx, netcdf4-fortran and netcdf4 for python and every other prerequisite, as far as i can think of. I have been trying to install PyROMS for quite some time now and have not been able to do so. I have attached two separate errors I am getting. When i run IPython and import pyroms i get the below mentioned error. Also, when i check the log file for pyroms installation, i get another error which is also shown below. I would really appreciate if someone could guide me regarding this.


In [2]: import numpy

In [3]: import matplotlib

In [4]: import pyroms
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)

/home/nikhil/Documents/ROMS/grid/pyroms/pyroms/pyroms/<ipython console> in <module>()

/home/nikhil/Documents/ROMS/grid/pyroms/pyroms/pyroms/pyroms/__init__.pyc in <module>()
15 import grid
16 import io
---> 17 import tools
18 import remapping
19 import utility

/home/nikhil/Documents/ROMS/grid/pyroms/pyroms/pyroms/pyroms/tools.py in <module>()
3 import numpy as np
4 import _iso
----> 5 import _obs_interp
6
7 import pyroms

ImportError: No module named _obs_interp




Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1)
/usr/bin/gfortran -Wall -L$DESTDIR/lib /tmp/tmpd4mv1j/tmp/tmpd4mv1j/src.linux-x86_64-2.7/scripmodule.o /tmp/tmpd4mv1j/tmp/tmpd4mv1j/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpd4mv1j/pyscrip.o kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o -L/usr/local/lib -L/usr/lib64 -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -lpython2.7 -lgfortran -o ./scrip.so
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib /tmp/tmpd4mv1j/tmp/tmpd4mv1j/src.linux-x86_64-2.7/scripmodule.o /tmp/tmpd4mv1j/tmp/tmpd4mv1j/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpd4mv1j/pyscrip.o kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o -L/usr/local/lib -L/usr/lib64 -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -lpython2.7 -lgfortran -o ./scrip.so" failed with exit status 1
make: *** [scrip.so] Error 1
/bin/cp ./scrip /usr/local/bin
/bin/cp ./scrip_test /usr/local/bin
/bin/cp ./scrip.so /usr/local/lib
/bin/cp: cannot stat `./scrip.so': No such file or directory
make: *** [install] Error 1
cp: cannot stat `scrip.so': No such file or directory

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

Re: PYROMS installation

#2 Post by hetland » Fri Sep 27, 2013 1:10 am

Which pyroms?

User avatar
ngarg
Posts: 19
Joined: Fri Jul 12, 2013 5:46 pm
Location: NTU

Re: PYROMS installation

#3 Post by ngarg » Mon Sep 30, 2013 10:50 am

Hi Roberts,

Thanks for your reply. My current post is related to the PYROMS version from https://github.com/kshedstrom/pyroms.

I also tried to install OCTANT when i was not able to install PYROMS, but I have not been able to run OCTANT too. I manage to install it but seems like with some bugs. When i import OCTANT in python it throws an error saying csa.so is missing. I am not sure what would be the problem. Even though I am able to use csa on my machine I am not able to like it properly with OCTANT.


Any help would be highly appreciated.

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

Re: PYROMS installation

#4 Post by hetland » Mon Sep 30, 2013 12:54 pm

Did you make either package before using it? You need to do something like this:

Code: Select all

python setup.py build
sudo python setup.py install
In order for the C-libraries to be built, and to install everything in the right place. If you did this, then your build is failing somewhere, and you need to look at the error messages you get when you build.

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#5 Post by kate » Mon Sep 30, 2013 2:31 pm

All three of these problems are related to shared libraries. Does your PYTHONPATH include the location of _obs_interp.so or csa.so? Do you have a scrip.so?

User avatar
ngarg
Posts: 19
Joined: Fri Jul 12, 2013 5:46 pm
Location: NTU

Re: PYROMS installation

#6 Post by ngarg » Fri Oct 04, 2013 4:45 am

Thanks Kate and Robert for your replies. I managed to compile OCTANT successfully on my machine. It had the csa.so file, I just had to locate and link it and it worked after that.

Cheers

lbressan
Posts: 3
Joined: Wed Sep 02, 2015 3:40 pm
Location: ARPA Emilia Romagna

Re: PYROMS installation

#7 Post by lbressan » Wed Nov 04, 2015 10:21 am

Dear all,
I installed pyroms in a local directory ($DESTDIR) since I don't have
administrator priviledges. I got different errors, but at the end it worked.
It was a lot of work.

The error I found were:
* lpsolve55 not found in importing bathy_smoother. Solved by manually
installing lpsolve as in http://houstonthereisaproblem.blogspot.it.
* ImportError: No module named move_river_t in importing pyroms_toolbox.
Solved by modyfying setup.py.
* gridgen and libgridgen errors (some functions missing in gridgen). Solved by
installing pygridgen and using its installation of gridgen for pyroms.


I am sharing the steps to install it here. :D


* LPSOLVE (da http://houstonthereisaproblem.blogspot.it)
Check dependencies and install lpsolve55 manually.

To build lp_solve, you need to download following source files from the
lp_solve SourceForge site

lp_solve_5.5.0.15_source.tar.gz
lp_solve_5.5.0.15_Python_source.tar.gz

Then extract the source files using following command

> tar -zxvf lp_solve_5.5.0.15_source.tar.gz
> tar -zxvf lp_solve_5.5.0.15_Python_source.tar.gz

Then install with the install script in lp_solve.

> cd lp_solve
> sh ccc

Install the python part in extra/Python:

> python setup.py install

Now lpsolve should be installed. Check in python with "import lpsolve55".
It shouldn't complain.


* BATHY_SMOOTHER
Now install bathy_smoother excluding the installation of external
libraries. You need to modifying the file setup.py. I commented out all
lines of "config.add_extension('lpsolve55',..." and
"config.add_library('lpsolve55',...".
Then install it as in the instructions:

> cd bathy_smoother
> python setup.py build
> python setup.py install


* PYROMS_TOOLBOX

Modify the file pyroms_toolbox/pyroms_toolbox/setup.py.
In the external libraries, I added the reference to move_river_t.

Then install it as in the instructions:

> cd pyroms_toolbox
> python setup.py build
> python setup.py install


* GRIDGEN and PYGRIDGEN
The installation of gridgen alone is not enough, since the python part
would be missing. Then I installed pygridgen. I cloned the repository of
pygridgen from github, and I realized later that the phobson fork was more
updated. Better check all forks before.

First, you need to compile the external libraries.
I installed everything in $DESTDIR.

> cd external/nn
> ./configure --prefix==$DESTDIR
> make
> make install

> cd external/csa
> ./configure --prefix==$DESTDIR
> make
> make install

> cd external/gridutils
> ./configure --prefix=$DESTDIR CFLAGS="-fPIC -I$DESTDIR/include
-L$DESTDIR/lib" CPPFLAGS=-I$DESTDIR/include
LDFLAGS=-L$DESTDIR/lib
> make
> make install


If you use autoreconf, you need to update the configure files:
rename configure.in as configure.ac and update the semantic
of AC_DEFINE.

< AC_DEFINE(X, [], [Description])
---
> AC_DEFINE(X)

Then autoreconf -if generates configure, but in my case deletes
a necessary part. I added these lines in a file toppa.h,
to be included together with config.h in geom.h, vertlist.h and zode.h.

#if defined(HAVE_COMPLEX)
#include <complex.h>
#define zdouble _Complex double
#elif defined(HAVE__COMPLEX__)
#include <complex.h>
#define zdouble __complex__ double
#elif defined(NOCOMPLEX)
#include "c99-min/complex.h"
#define zdouble _Complex double
#endif

To include these files use:

#include "toppa.h"
#include "config.h"


If you don't use autoreconf, something like that should work.
> cd external/gridgen
> ./configure --prefix=$DESTDIR CFLAGS="-I$DESTDIR/include
-L$DESTDIR/lib" CPPFLAGS=-I$DESTDIR/include
LDFLAGS=-L$DESTDIR/lib

Modify manually the line 118 of makefile:

118c118
<libgridgen.so: $(HEADERS) triangle.t $(SHLIBOBJS)
< $(CC) -shared -o $@ $(SHLIBOBJS) triangle.t $(LIBS)
---
>libgridgen.so: $(HEADERS) triangle.t $(SHLIBOBJS)
> $(CC) $(LDFLAGS) -shared -o $@ $(SHLIBOBJS) triangle.t $(LIBS)

Then install it and put it in the pyroms directory
($DESTDIR/lib/python2.7/site-packages/pyroms/).

> make
> make lib
> make shlib
> make install


* PYROMS

Install pygridgen and gridgen.

Install scrip, and check PREFIX in the makefile.

> cd pyroms/external/scrip/source
> make
> make all
> make scrip.so
> make install

To install pyroms, scrip.so should be in
$DESTDIR/lib/python2.7/site-packages/scrip.so. I made a link since it was
installed in $DESTDIR/lib. The same for creep.so (for pyroms_toolbox).

Finally, in the pyroms directory, run:

> python setup.py build
> python setup.py install

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#8 Post by kate » Wed Nov 04, 2015 7:05 pm

Thanks for all the careful notes!
  • Would anyone mind if lpsolve went away from pyroms? Does anyone use it?
  • Thanks for the move_river_t fix.
  • We hope to take out the scrip.so part and use ESMF instead.
  • I thought Fred had included stuff to call gridgen without need for outside packages.

turuncu
Posts: 128
Joined: Tue Feb 01, 2005 8:21 pm
Location: Istanbul Technical University (ITU)
Contact:

Re: PYROMS installation

#9 Post by turuncu » Thu Nov 05, 2015 6:47 am

Hi Kate,

I am actively use pyroms. It is great tool. Thanks for it. I am using lpsolve to fix the bathymetry to prevent pressure gradient errors. As you suggest, it will be great to use ESMF (ESMPy) for interpolation instead of SCRIP. If you want we could collaborate about it, i have some experience in ESMF and also python. I also wrote my own forcing tool in NCL and it uses ESMF two step interpolation (including also extrapolation due to the unmatched land-sea mask of the atmosphere and ocean models). It works nicely.

Regards,

--ufuk

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#10 Post by kate » Thu Nov 05, 2015 5:57 pm

If you (or anyone else) care to send me patches, I'll include them. The same goes for my ROMS branch, even if it's not always true for the trunk.

Gabriel_Carvalho
Posts: 9
Joined: Tue Jul 05, 2011 2:47 pm
Location: Prooceano

Re: PYROMS installation

#11 Post by Gabriel_Carvalho » Thu Nov 05, 2015 8:43 pm

Hi, I´m starting with pyroms, still strugling with the instalation.

"Modify the file pyroms_toolbox/pyroms_toolbox/setup.py.
In the external libraries, I added the reference to move_river_t."

Could you provide the "/pyroms_toolbox/setup.py" modification in order to fix the move_river_t issue?

thanks,

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#12 Post by kate » Thu Nov 05, 2015 8:59 pm

Something like:

Code: Select all

diff --git a/pyroms_toolbox/pyroms_toolbox/setup.py b/pyroms_toolbox/pyroms_toolbox/setup.py
index 81ea70e..abae14e 100644
--- a/pyroms_toolbox/pyroms_toolbox/setup.py
+++ b/pyroms_toolbox/pyroms_toolbox/setup.py
@@ -10,6 +10,7 @@ def configuration(parent_package='',top_path=None):
     config.add_subpackage('Grid_HYCOM')
     config.add_library('_average', sources=['src/average.f90']),
     config.add_library('_move_runoff', sources=['src/move_runoff.f90']),
+    config.add_library('_move_river_t', sources=['src/move_river_t.f90']),
     config.add_extension('_average',
           sources = ['src/average.f90'],
           libraries = ['_average']

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#13 Post by maxblu33 » Fri Feb 05, 2016 7:53 pm

Hello, i have been trying to install pyroms for a week and have encounter some problems, mainly with scrip.so, and although at the end I though i solved it, when i try to run and example scrip.so is still missing(the scrip.so exist and is in my PYTHONPATH). I'm working in a 64bit Linux mint 17.3 platform with gfortran and anaconda python distribution
I also have an issue with import move_river_t, could you be a little more specific about what could be the solution to such problem,

elendil@elendil-PC ~/work/python/pyroms $ python make_grid.py
Vendor: Continuum Analytics, Inc.
scrip.so not found. Remapping function will not be available
Traceback (most recent call last):
File "make_grid.py", line 8, in <module>
import pyroms_toolbox
File "/home/elendil/installs/pyroms/pyroms-install/lib/python2.7/site-packages/pyroms_toolbox/__init__.py", line 51, in <module>
from move_river_t import move_river_t
ImportError: No module named move_river_t

thanks in advance
Luis

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#14 Post by kate » Fri Feb 05, 2016 8:12 pm

I thought I pushed this change. The __init__.py in pyroms_toolbox should have:

Code: Select all

from _move_river_t import move_river_t
If that doesn't help, you can just comment out this line for now.

At work my scrip.so is in:

Code: Select all

/import/u/u1/uaf/kate/Python/lib/python2.7/site-packages/pyroms/remapping
with

Code: Select all

/u1/uaf/kate/Python/lib/python2.7/site-packages
being in my PYTHONPATH.

At home, scrip.so is in:

Code: Select all

/usr/local/lib/python2.7/dist-packages
This is an Ubuntu system.

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#15 Post by maxblu33 » Fri Feb 05, 2016 9:57 pm

Kate thank you very much, the change in The __init__.py did not work, but i commented the line and it works just fine( by the way, does this change have any significance)

Regarding the scrip.so, at the end I was linking the file in
/import/u/u1/uaf/kate/Python/lib/python2.7/site-packages/pyroms/remapping
from the one from
/import/u/u1/uaf/kate/Python/lib/ instead of linking it from the original building file
/external/scrip/source
again thanks a lot
luis

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#16 Post by kate » Fri Feb 05, 2016 10:06 pm

move_river_t is only used if you go through the scripts in the examples/rivers directory for building a ROMS rivers file from hydrology model output.

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#17 Post by maxblu33 » Mon Feb 08, 2016 6:11 pm

Dear Kate , i have an lpsolve55.so file in the pyroms-master/../bathy_smoother and also in pyroms-install/../../bathy_smother but whe a run make_grid.py this is what a i get
what can i do?

In [1]: run make_grid.py
Vendor: Continuum Analytics, Inc.
Package: mkl
Message: trial mode expires in 30 days
lpsolve55.so not found.
Linear programming method will not be available.
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/elendil/work/python/pyroms/make_grid.py in <module>()
42
43 #generate the new grid
---> 44 lonp=array([lon0, lon1, lon2, lon3])
45 latp=array([lat0, lat1, lat2, lat3])
46

NameError: name 'array' is not defined

thanks a lot

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#18 Post by kate » Mon Feb 08, 2016 6:40 pm

array comes with numpy. Does your script have:

Code: Select all

import numpy as np
at the top? If so, you can invoke:

Code: Select all

lonp=np.array([lon0, lon1, lon2, lon3])
ETA: you ask about lpsolve. I don't use it. I'd be tempted to remove it from pyroms, but there is at least one fan out there.

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#19 Post by maxblu33 » Fri Feb 12, 2016 10:44 pm

Dear Kate
i solved my problem with the np.array(sorry, I'm new at python)
but now I found another problem regarding the format of the topography file, does pyroms handle netcdf, because by default the format is zip??
I'm using etopo2 and have the same problem with gebco08
again thanks in advance

run make_grid.py
psolve55.so not found.
Linear programming method will not be available.
/home/elendil/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:548: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors == 'face':
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/elendil/work/python/pyroms/make_grid.py in <module>()
76 # svn co https://matplotlib.svn.sourceforge.net/ ... hots/data/"
77 datadir = '/home/elendil/work/Modelos_numericos/Roms_tools_V3.1.1/Topo'
---> 78 topo = np.loadtxt(os.path.join(datadir, 'etopo2_original.nc'))
79 lons = np.loadtxt(os.path.join(datadir, 'lon.dat'))
80 lats = np.loadtxt(os.path.join(datadir, 'lat.dat'))

/home/elendil/anaconda/lib/python2.7/site-packages/numpy/lib/npyio.pyc in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin)
926
927 # Convert each value according to its column and store
--> 928 items = [conv(val) for (conv, val) in zip(converters, vals)]
929 # Then pack it according to the dtype's nesting
930 items = pack_items(items, packing)

/home/elendil/anaconda/lib/python2.7/site-packages/numpy/lib/npyio.pyc in floatconv(x)
657 if b'0x' in x:
658 return float.fromhex(asstr(x))
--> 659 return float(x)
660
661 typ = dtype.type

ValueError: could not convert string to float: CDF

Luis

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#20 Post by kate » Fri Feb 12, 2016 11:54 pm

My bathymetry files are indeed in NetCDF. If yours are not you'll have to change your files or change the Python to read them as is.

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#21 Post by maxblu33 » Mon Feb 29, 2016 2:36 pm

Kate i already solve the problem of the batimetry but i got a problem with the function griddata, any advice?
thanks in advance

In [1]: run make_grid.py
lpsolve55.so not found.
Linear programming method will not be available.

/home/elendil/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:548: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors == 'face':
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/elendil/work/python/pyroms/make_grid.py in <module>()
92 # interpolate new bathymetry
93 lon, lat = np.meshgrid(lons, lats)
---> 94 h = griddata(lon.flat,lat.flat,topo.flat,hgrd.lon_rho,hgrd.lat_rho, method='cubic')
95
96 # insure that depth is always deeper than hmin

TypeError: griddata() got multiple values for keyword argument 'method'

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#22 Post by kate » Mon Feb 29, 2016 7:16 pm

If I go into interactive python and type "griddata", I get "<function matplotlib.mlab.griddata>", which has this signature:

Code: Select all

matplotlib.mlab.griddata(x, y, z, xi, yi, interp='nn')

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#23 Post by maxblu33 » Mon Feb 29, 2016 9:12 pm

dear kate, i was confused and thought that griddata belongs to scipy instead, so i changed it and I'm using matplotlib.mlab. but it does give anything at all, just a blank screen,
I'm really confused
thanks in advance

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#24 Post by kate » Mon Feb 29, 2016 10:47 pm

Perhaps you should tell us exactly what you are doing (and trying to do). Is this 'ipython --pylab'?

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#25 Post by maxblu33 » Tue Mar 01, 2016 5:12 pm

Dear Kate
I'm trying to create a grid for the west part of Cuba with pyroms, I'm beginning the project now so any realistic(non analytic grid) will be fine, then final purpose is to predict the behavior of sea currents and other oceanographic variables in such region with a relatively high spatial resolution(3km or so) I'm using Anaconda as my python distribution with python 2.7 on ubuntu 64 bit 14.04 system and gfortran as compiler
so after many advices from you I properly install pyroms and start to create a grid with the make_grid.py script from your github distribution, essentially i have a problem with the griddata function, I'm running the script with the default parameters of dimension(number of point in x-w direction and region) just to test if it works before staring to tune it for my personal apliccation
I'm using ipython in the linux terminal

the main error is :
In [1]: run make_grid.py
Vendor: Continuum Analytics, Inc.
lpsolve55.so not found.
Linear programming method will not be available.
/home/elendil/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:548: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors == 'face':
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/elendil/work/python/pyroms/make_grid.py in <module>()
92 # interpolate new bathymetry
93 lon, lat = np.meshgrid(lons, lats)
---> 94 h = griddata(lon.flat,lat.flat,topo.flat,hgrd.lon_rho,hgrd.lat_rho)
95
96 # insure that depth is always deeper than hmin

NameError: name 'griddata' is not defined

So i search for the griddata function in python, but there sre several grdidata functions that belongs to matplolib, scipy etc and therefore i not sure of what is the one i should define in the start of the script
regards Luis

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#26 Post by kate » Tue Mar 01, 2016 6:12 pm

You can add an import statement at the top of your script to get the griddata of your choice.

Code: Select all

from xxx import griddata

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#27 Post by maxblu33 » Tue Mar 01, 2016 7:24 pm

I tried with your recommendation from matplotlib.mlab import griddata and the result after 15 minutes of computing is killed with no other information that could give a hint of what the problem could be
thanks in advance

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#28 Post by kate » Wed Mar 02, 2016 1:23 am

Actually, the grid generation stuff is usually performed in an interactive session, cutting and pasting from the script, especially if you want to do interactive land mask editing. In this case, one runs "ipython --pylab".

Having something just killed is likely running out of memory or else running into a time limit on your job.

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#29 Post by maxblu33 » Mon May 09, 2016 4:10 pm

Dear kate
Sorry for the late response but I had a problem with my PC, and had to reinstall the system. I'm currently using ubuntu 14.04 and carefully install pyroms, But again When I try to make a grid I still encounter the same problem regarding griddata (t gives me nothing and then the process is killed after 15 minutes of a blank screen). I'm running the Yellow sea example
I believe that the problem is related with my Anaconda python distribution, but I'm not sure
Is there any other way to perform my bathimetry interpolation in python

thanks in advance
Luis Sorinas-Morales

User avatar
rdussin
Posts: 8
Joined: Wed Jul 13, 2011 12:37 pm
Location: IMCS Rutgers

Re: PYROMS installation

#30 Post by rdussin » Wed May 11, 2016 1:35 pm

the griddata function from numpy is not working correctly. I have replaced it by the one from scipy.interpolate
the call to the function is a bit different so there is an extra-step here:

Code: Select all

import scipy.interpolate as scipyint

# interpolate new bathymetry
lon, lat = np.meshgrid(lons, lats)

sizetot_ini  = lons.shape[0]*lats.shape[0]
position_ini = np.zeros((sizetot_ini ,2))

a = lon.flat
b = lat.flat

for k in np.arange(sizetot_ini):
        position_ini[k,0] = a[k]
        position_ini[k,1] = b[k]

sizetot_final  = hgrd.lon_rho.shape[0]*hgrd.lon_rho.shape[1]
position_final = np.zeros((sizetot_final ,2))

c = hgrd.lon_rho.flat
d = hgrd.lat_rho.flat

for k in np.arange(sizetot_final):
        position_final[k,0] = c[k]
        position_final[k,1] = d[k]

h0 = scipyint.griddata(position_ini,topo.flat,position_final)
h = np.reshape(h0,hgrd.lon_rho.shape)

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#31 Post by maxblu33 » Wed May 18, 2016 6:12 pm

Dear rdussin
Thanks a lot for your response
I try to use the solution that you gave me but it did not work either, after 15 minutes I run out of memory, I have no idea of what could go wrong, I'm triyng to run make_YELLOW_grd_v1.py , is the same prolem that i encounter using griddata from matpltlib.mlab.Do you have any script to make a grid using pyroms, any location would work, is just to test that my anaconda python distribution and my pyroms installation are working correctly
thanks in advance
Luis Sorinas-Morales

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#32 Post by maxblu33 » Tue May 24, 2016 5:31 pm

Hello again, I fix the problem of griddata, it seems that there was an issue regarding netcdf in, when a tried to load data from etopo2 bathimetry the griddata function run out of mrmory, but I run the make_box_grid example with the default data that comes as example with Basemap an it works fine In addition i found another problem writing the grid
... wrote theta_s
... wrote theta_b
... wrote Tcline
... wrote hc
... wrote s_rho
... wrote s_w
... wrote Cs_r
... wrote Cs_w
... wrote h
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/media/elendil/LUIS_64/kate/make_box_grid.py in <module>()
56 grd_name = 'test'
57 grd = pyroms.grid.ROMS_Grid(grd_name, hgrd, vgrd)
---> 58 pyroms.grid.write_ROMS_grid(grd, filename='box.nc')
59
60

/home/elendil/installs/pyroms/pyroms-install/lib/python2.7/site-packages/pyroms/grid.pyc in write_ROMS_grid(grd, filename)
536 write_nc_var(grd.vgrid.h, 'h', ('eta_rho', 'xi_rho'), 'bathymetry at RHO-points', 'meter')
537 #ensure that we have a bath dependancy for hraw
--> 538 if len(grd.vgrid.hraw.shape) == 2:
539 hraw = np.zeros((1, grd.vgrid.hraw.shape[0], grd.vgrid.hraw.shape[1]))
540 hraw[0,:] = grd.vgrid.hraw

AttributeError: 'NoneType' object has no attribute 'shape'

thanks in advance
Luis Sorinas-Morales

hpftcb
Posts: 28
Joined: Wed Apr 13, 2016 7:37 pm
Location: Prooceano

Re: PYROMS installation

#33 Post by hpftcb » Mon Jun 06, 2016 11:25 pm

Hi maxblu33,
I am also having the same error in grid generation. Did you find out the error's source?
Regards

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: PYROMS installation

#34 Post by maxblu33 » Wed Jun 08, 2016 3:16 pm

hello hpftcb
Well, since the error was related to hraw, i try to find hraw variable but it did not appear
so i created my own hraw based on h

grd.vgrid.hraw=grd.vgrid.h
and then when i try to write the grid with

pyroms.grid.write_ROMS_grid(grd, filename='box.nc')
it works fine, I obtain a grid that at least seems correctly, nevertheless I'm not quite sure of why hraw was missing

best regards
Luis Sorinas-Morales

zsurenj
Posts: 9
Joined: Fri Apr 24, 2015 4:06 pm
Location: Zhongshan university

Re: PYROMS installation

#35 Post by zsurenj » Mon Oct 17, 2016 2:43 pm

Hi,
I am attempting to build pyroms_tools. I have installed netcdf4, netcdf4-cxx, netcdf4-fortran and netCDF4 for python and every other prerequisite(numpy,scipy,matplotlib...), as far as i can think of. This results in compilation errors on macOS Sierra are following:
...
f2py options: []
adding 'build/src.macosx-10.12-x86_64-2.7/fortranobject.c' to sources.
adding 'build/src.macosx-10.12-x86_64-2.7' to include_dirs.
building extension "pyroms_toolbox._move_runoff" sources
f2py options: []
adding 'build/src.macosx-10.12-x86_64-2.7/fortranobject.c' to sources.
adding 'build/src.macosx-10.12-x86_64-2.7' to include_dirs.
build_src: building npy-pkg config files
running build_py
running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
customize Gnu95FCompiler
Found executable /usr/local/bin/gfortran
customize Gnu95FCompiler
customize Gnu95FCompiler using build_clib
building '_average' library
compiling Fortran sources
Fortran f77 compiler: /usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: /usr/local/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran fix compiler: /usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops
creating build/temp.macosx-10.12-x86_64-2.7
creating build/temp.macosx-10.12-x86_64-2.7/pyroms_toolbox
creating build/temp.macosx-10.12-x86_64-2.7/pyroms_toolbox/src
compile options: '-I/usr/local/lib/python2.7/site-packages/numpy/core/include -c'
gfortran:fix: pyroms_toolbox/src/average.f90
ar: adding 1 object files to build/temp.macosx-10.12-x86_64-2.7/lib_average.a
ranlib:@ build/temp.macosx-10.12-x86_64-2.7/lib_average.a
building '_move_runoff' library
compiling Fortran sources
Fortran f77 compiler: /usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: /usr/local/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran fix compiler: /usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops
compile options: '-I/usr/local/lib/python2.7/site-packages/numpy/core/include -c'
gfortran:fix: pyroms_toolbox/src/move_runoff.f90
ar: adding 1 object files to build/temp.macosx-10.12-x86_64-2.7/lib_move_runoff.a
ranlib:@ build/temp.macosx-10.12-x86_64-2.7/lib_move_runoff.a
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize Gnu95FCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'pyroms_toolbox._average' extension
compiling C sources
C compiler: clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/hdf5/1.8.17/include -I/usr/local/Cellar/zlib/1.2.8/include -I/usr/local/Cellar/netcdf/4.3.3.1_5/include

creating build/temp.macosx-10.12-x86_64-2.7/build
creating build/temp.macosx-10.12-x86_64-2.7/build/src.macosx-10.12-x86_64-2.7
creating build/temp.macosx-10.12-x86_64-2.7/build/src.macosx-10.12-x86_64-2.7/pyroms_toolbox
compile options: '-Ibuild/src.macosx-10.12-x86_64-2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c'
clang: build/src.macosx-10.12-x86_64-2.7/fortranobject.c
In file included from build/src.macosx-10.12-x86_64-2.7/fortranobject.c:2:
In file included from build/src.macosx-10.12-x86_64-2.7/fortranobject.h:13:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1777:
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
1 warning generated.
clang: build/src.macosx-10.12-x86_64-2.7/pyroms_toolbox/_averagemodule.c
In file included from build/src.macosx-10.12-x86_64-2.7/pyroms_toolbox/_averagemodule.c:19:
In file included from build/src.macosx-10.12-x86_64-2.7/fortranobject.h:13:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1777:
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
build/src.macosx-10.12-x86_64-2.7/pyroms_toolbox/_averagemodule.c:112:12: warning: unused function 'f2py_size' [-Wunused-function]
static int f2py_size(PyArrayObject* var, ...)
^
2 warnings generated.
compiling Fortran sources
Fortran f77 compiler: /usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: /usr/local/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran fix compiler: /usr/local/bin/gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops
compile options: '-Ibuild/src.macosx-10.12-x86_64-2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c'
gfortran:fix: pyroms_toolbox/src/average.f90
/usr/local/bin/gfortran -Wall -g -L/usr/local/Cellar/hdf5/1.8.17/lib -L/usr/local/Cellar/zlib/1.2.8/lib -L/usr/local/Cellar/netcdf/4.3.3.1_5/lib build/temp.macosx-10.12-x86_64-2.7/build/src.macosx-10.12-x86_64-2.7/pyroms_toolbox/_averagemodule.o build/temp.macosx-10.12-x86_64-2.7/build/src.macosx-10.12-x86_64-2.7/fortranobject.o build/temp.macosx-10.12-x86_64-2.7/pyroms_toolbox/src/average.o -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0 -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.12-x86_64-2.7 -l_average -lgfortran -o build/lib.macosx-10.12-x86_64-2.7/pyroms_toolbox/_average.so
Undefined symbols for architecture x86_64:
"_PyArg_ParseTupleAndKeywords", referenced from:
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
"_PyCObject_AsVoidPtr", referenced from:
_init_average in _averagemodule.o
_F2PyCapsule_AsVoidPtr in fortranobject.o
"_PyCObject_FromVoidPtr", referenced from:
_fortran_getattr in fortranobject.o
_F2PyCapsule_FromVoidPtr in fortranobject.o
"_PyCObject_Type", referenced from:
_init_average in _averagemodule.o
_F2PyCapsule_Check in fortranobject.o
"_PyComplex_Type", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
"_PyDict_DelItemString", referenced from:
_fortran_setattr in fortranobject.o
"_PyDict_GetItemString", referenced from:
_fortran_getattr in fortranobject.o
"_PyDict_New", referenced from:
_PyFortranObject_New in fortranobject.o
_PyFortranObject_NewAsAttr in fortranobject.o
_fortran_setattr in fortranobject.o
"_PyDict_SetItemString", referenced from:
_init_average in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
_PyFortranObject_New in fortranobject.o
_fortran_getattr in fortranobject.o
_fortran_setattr in fortranobject.o
"_PyErr_Clear", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
_fortran_repr in fortranobject.o
"_PyErr_Format", referenced from:
_init_average in _averagemodule.o
_fortran_call in fortranobject.o
"_PyErr_NewException", referenced from:
_init_average in _averagemodule.o
"_PyErr_NoMemory", referenced from:
_fortran_getattr in fortranobject.o
"_PyErr_Occurred", referenced from:
_init_average in _averagemodule.o
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
"_PyErr_Print", referenced from:
_init_average in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
"_PyErr_SetString", referenced from:
_init_average in _averagemodule.o
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_fortran_setattr in fortranobject.o
_array_from_pyobj in fortranobject.o
...
"_PyExc_AttributeError", referenced from:
_init_average in _averagemodule.o
_fortran_setattr in fortranobject.o
"_PyExc_ImportError", referenced from:
_init_average in _averagemodule.o
"_PyExc_RuntimeError", referenced from:
_init_average in _averagemodule.o
_fortran_call in fortranobject.o
"_PyExc_TypeError", referenced from:
_fortran_call in fortranobject.o
_array_from_pyobj in fortranobject.o
"_PyExc_ValueError", referenced from:
_array_from_pyobj in fortranobject.o
"_PyFloat_Type", referenced from:
_double_from_pyobj in _averagemodule.o
"_PyImport_ImportModule", referenced from:
_init_average in _averagemodule.o
"_PyMem_Free", referenced from:
_fortran_dealloc in fortranobject.o
_fortran_getattr in fortranobject.o
"_PyMem_Malloc", referenced from:
_fortran_getattr in fortranobject.o
"_PyModule_GetDict", referenced from:
_init_average in _averagemodule.o
"_PyNumber_Float", referenced from:
_double_from_pyobj in _averagemodule.o
"_PyNumber_Int", referenced from:
_int_from_pyobj in _averagemodule.o
"_PyOS_snprintf", referenced from:
_fortran_getattr in fortranobject.o
"_PyObject_GetAttrString", referenced from:
_init_average in _averagemodule.o
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_fortran_repr in fortranobject.o
"_PySequence_Check", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
"_PySequence_GetItem", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
"_PyString_AsString", referenced from:
_fortran_repr in fortranobject.o
"_PyString_ConcatAndDel", referenced from:
_fortran_getattr in fortranobject.o
"_PyString_FromFormat", referenced from:
_fortran_repr in fortranobject.o
"_PyString_FromString", referenced from:
_init_average in _averagemodule.o
_fortran_getattr in fortranobject.o
_fortran_repr in fortranobject.o
"_PyString_FromStringAndSize", referenced from:
_fortran_getattr in fortranobject.o
"_PyType_IsSubtype", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_array_from_pyobj in fortranobject.o
"_PyType_Type", referenced from:
_init_average in _averagemodule.o
"_Py_BuildValue", referenced from:
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
"_Py_FindMethod", referenced from:
_fortran_getattr in fortranobject.o
"_Py_InitModule4_64", referenced from:
_init_average in _averagemodule.o
"__PyObject_New", referenced from:
_PyFortranObject_New in fortranobject.o
_PyFortranObject_NewAsAttr in fortranobject.o
"__Py_NoneStruct", referenced from:
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
_fortran_getattr in fortranobject.o
_fortran_setattr in fortranobject.o
_array_from_pyobj in fortranobject.o
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Undefined symbols for architecture x86_64:
"_PyArg_ParseTupleAndKeywords", referenced from:
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
"_PyCObject_AsVoidPtr", referenced from:
_init_average in _averagemodule.o
_F2PyCapsule_AsVoidPtr in fortranobject.o
"_PyCObject_FromVoidPtr", referenced from:
_fortran_getattr in fortranobject.o
_F2PyCapsule_FromVoidPtr in fortranobject.o
"_PyCObject_Type", referenced from:
_init_average in _averagemodule.o
_F2PyCapsule_Check in fortranobject.o
"_PyComplex_Type", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
"_PyDict_DelItemString", referenced from:
_fortran_setattr in fortranobject.o
"_PyDict_GetItemString", referenced from:
_fortran_getattr in fortranobject.o
"_PyDict_New", referenced from:
_PyFortranObject_New in fortranobject.o
_PyFortranObject_NewAsAttr in fortranobject.o
_fortran_setattr in fortranobject.o
"_PyDict_SetItemString", referenced from:
_init_average in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
_PyFortranObject_New in fortranobject.o
_fortran_getattr in fortranobject.o
_fortran_setattr in fortranobject.o
"_PyErr_Clear", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
_fortran_repr in fortranobject.o
"_PyErr_Format", referenced from:
_init_average in _averagemodule.o
_fortran_call in fortranobject.o
"_PyErr_NewException", referenced from:
_init_average in _averagemodule.o
"_PyErr_NoMemory", referenced from:
_fortran_getattr in fortranobject.o
"_PyErr_Occurred", referenced from:
_init_average in _averagemodule.o
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
"_PyErr_Print", referenced from:
_init_average in _averagemodule.o
_F2PyDict_SetItemString in fortranobject.o
"_PyErr_SetString", referenced from:
_init_average in _averagemodule.o
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_fortran_setattr in fortranobject.o
_array_from_pyobj in fortranobject.o
...
"_PyExc_AttributeError", referenced from:
_init_average in _averagemodule.o
_fortran_setattr in fortranobject.o
"_PyExc_ImportError", referenced from:
_init_average in _averagemodule.o
"_PyExc_RuntimeError", referenced from:
_init_average in _averagemodule.o
_fortran_call in fortranobject.o
"_PyExc_TypeError", referenced from:
_fortran_call in fortranobject.o
_array_from_pyobj in fortranobject.o
"_PyExc_ValueError", referenced from:
_array_from_pyobj in fortranobject.o
"_PyFloat_Type", referenced from:
_double_from_pyobj in _averagemodule.o
"_PyImport_ImportModule", referenced from:
_init_average in _averagemodule.o
"_PyMem_Free", referenced from:
_fortran_dealloc in fortranobject.o
_fortran_getattr in fortranobject.o
"_PyMem_Malloc", referenced from:
_fortran_getattr in fortranobject.o
"_PyModule_GetDict", referenced from:
_init_average in _averagemodule.o
"_PyNumber_Float", referenced from:
_double_from_pyobj in _averagemodule.o
"_PyNumber_Int", referenced from:
_int_from_pyobj in _averagemodule.o
"_PyOS_snprintf", referenced from:
_fortran_getattr in fortranobject.o
"_PyObject_GetAttrString", referenced from:
_init_average in _averagemodule.o
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_fortran_repr in fortranobject.o
"_PySequence_Check", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
"_PySequence_GetItem", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
"_PyString_AsString", referenced from:
_fortran_repr in fortranobject.o
"_PyString_ConcatAndDel", referenced from:
_fortran_getattr in fortranobject.o
"_PyString_FromFormat", referenced from:
_fortran_repr in fortranobject.o
"_PyString_FromString", referenced from:
_init_average in _averagemodule.o
_fortran_getattr in fortranobject.o
_fortran_repr in fortranobject.o
"_PyString_FromStringAndSize", referenced from:
_fortran_getattr in fortranobject.o
"_PyType_IsSubtype", referenced from:
_double_from_pyobj in _averagemodule.o
_int_from_pyobj in _averagemodule.o
_array_from_pyobj in fortranobject.o
"_PyType_Type", referenced from:
_init_average in _averagemodule.o
"_Py_BuildValue", referenced from:
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
"_Py_FindMethod", referenced from:
_fortran_getattr in fortranobject.o
"_Py_InitModule4_64", referenced from:
_init_average in _averagemodule.o
"__PyObject_New", referenced from:
_PyFortranObject_New in fortranobject.o
_PyFortranObject_NewAsAttr in fortranobject.o
"__Py_NoneStruct", referenced from:
_f2py_rout__average_avg3d in _averagemodule.o
_f2py_rout__average_avg2d in _averagemodule.o
_fortran_getattr in fortranobject.o
_fortran_setattr in fortranobject.o
_array_from_pyobj in fortranobject.o
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
error: Command "/usr/local/bin/gfortran -Wall -g -L/usr/local/Cellar/hdf5/1.8.17/lib -L/usr/local/Cellar/zlib/1.2.8/lib -L/usr/local/Cellar/netcdf/4.3.3.1_5/lib build/temp.macosx-10.12-x86_64-2.7/build/src.macosx-10.12-x86_64-2.7/pyroms_toolbox/_averagemodule.o build/temp.macosx-10.12-x86_64-2.7/build/src.macosx-10.12-x86_64-2.7/fortranobject.o build/temp.macosx-10.12-x86_64-2.7/pyroms_toolbox/src/average.o -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0 -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.12-x86_64-2.7 -l_average -lgfortran -o build/lib.macosx-10.12-x86_64-2.7/pyroms_toolbox/_average.so" failed with exit status 1

The above errors may be with regard to f2py compiler options, How can I fix them? I would really appreciate for your advices.

navin
Posts: 11
Joined: Mon Jun 08, 2015 4:40 pm
Location: Indian Institute of Technology Delhi

Re: PYROMS installation

#36 Post by navin » Wed Nov 30, 2016 11:02 am

I am trying to install pyroms from few days. I have installed pyroms in ubuntu 14.04 64 bit For this I am following this discussion.I am using anaconda2. During installation I found out below problem

1 I have solved the lpsolve55 issue, whenever I do "import lpsolve55" in my console or spyder console it gives no error but during execution of make_YELLOW_grd_v1.py it throws an error.
2. I have also made a shortcut file for scrip.so in lib/python2.7/site-packages/pyroms/remapping folder, but it shows an error scrip.so is not found

Here is the detail output error when i run the make_YELLOW_grd_v1.py from spyder idle

runfile('/home/navin/Downloads/pyroms/examples/Yellow_Sea/make_YELLOW_grd_v1.py', wdir='/home/navin/Downloads/pyroms/examples/Yellow_Sea')
Reloaded modules: pyroms.io, pyroms_toolbox.jview, pyroms_toolbox.get_ijcoast_line, pyroms.extern.greatcircle, pyroms_toolbox, pyroms_toolbox.BGrid_GFDL.flood, pyroms_toolbox.seawater.misc, pyroms_toolbox.seawater.heat, bathy_smoother, pyroms_toolbox._average, pyroms_toolbox.lonview, pyroms_toolbox.iso2gregorian, _interp, pyroms_toolbox.plot_coast_line_from_mask, pyroms_toolbox.TS_diagram, pyroms.tools, _move_river_t, pyroms_toolbox.remapping_bound, pyroms_toolbox.low_pass_filter, pyroms_toolbox.Grid_HYCOM.flood, pyroms_toolbox.mld_from_dens, creep, pyroms.remapping.sta2z, pyroms_toolbox.get_littoral2, pyroms.cf, _obs_interp, pyroms_toolbox.rx0, pyroms.vgrid, pyroms_toolbox.quiver, pyroms.remapping.flood2d, pyroms_toolbox.isoview, pyroms_toolbox.N2, bathy_smoother.LP_tools, pyroms_toolbox.plot_coast_line, pyroms_toolbox.sview, pyroms_toolbox.BGrid_SODA, pyroms_toolbox.BGrid_POP.flood, pyroms_toolbox.seawater.density, pyroms_toolbox.nc_create_roms_file, pyroms_toolbox.Grid_HYCOM.get_nc_Grid_HYCOM, pyroms_toolbox.remapping_tensor, pyroms.extern, _iso, pyroms_toolbox.BGrid_POP.make_remap_grid_file, pyroms_toolbox.BGrid_GFDL.BGrid_GFDL, pyroms_toolbox.shapiro_filter, pyroms_toolbox._move_runoff, pyroms_toolbox.lsq_phase_amplitude, pyroms_toolbox.BGrid_GFDL.plot_coast_line, pyroms_toolbox.ocean_in, pyroms_toolbox.transectview, pyroms.remapping.flood, pyroms_toolbox.O2_saturation, bathy_smoother.LP_bathy_tools, pyroms.remapping.z2roms, pyroms_toolbox.Grid_HYCOM.make_remap_grid_file, pyroms_toolbox.BGrid_SODA.BGrid_SODA, pyroms_toolbox.laplacian, pyroms_toolbox.Grid_HYCOM.flood_fast_weighted, pyroms_toolbox.twoDview, pyroms_toolbox.BGrid_SODA.make_remap_grid_file, pyroms_toolbox.BGrid_GFDL.get_Bgrid_proj, pyroms_toolbox.get_cell_area, pyroms.utility, pyroms_toolbox.latview, pyroms_toolbox.remapping_bound_sig, bathy_smoother.bathy_tools, _remapping, pyroms_toolbox.Grid_HYCOM.Grid_HYCOM, bathy_smoother.bathy_smoothing, pyroms.remapping.remap2, pyroms.hgrid, pyroms_toolbox.shift_SODA_data, bathy_smoother.LP_bathy_smoothing, pyroms_toolbox.rx1, pyroms_toolbox.remapping, pyroms_toolbox.plot_mask, pyroms_toolbox.BGrid_GFDL.get_nc_BGrid_GFDL, pyroms.remapping.test_remap_weights, pyroms_toolbox.jday2date, pyroms.remapping.make_remap_grid_file, pyroms_toolbox.mld_from_temp, pyroms_toolbox.compute_eke, pyroms_toolbox.get_coast_line_from_mask, pyroms.extern.pupynere, pyroms.grid, pyroms.remapping.roms2z, pyroms_toolbox.rvalue, _remapping_fast, pyroms_toolbox.smooth_1D, pyroms, pyroms.remapping, pyroms_toolbox.BGrid_POP, pyroms_toolbox.plot_ijcoast_line, pyroms_toolbox.get_littoral, pyroms_toolbox.BGrid_GFDL, pyroms_toolbox.BGrid_SODA.get_nc_BGrid_SODA, pyroms.sta_grid, pyroms_toolbox.strain_norm_old, pyroms_toolbox.get_coast_line, pyroms_toolbox.gregorian2iso, pyroms_toolbox.seawater, pyroms_toolbox.iview, pyroms_toolbox.seawater.salinity, pyroms_toolbox.zview, pyroms.remapping.remap, pyroms_toolbox.average, pyroms_toolbox.Grid_HYCOM, pyroms_toolbox.BGrid_SODA.flood, pyroms.extern.kdtree, pyroms.remapping.compute_remap_weights, pyroms_toolbox.BGrid_GFDL.make_remap_grid_file, pyroms_toolbox.BGrid_GFDL.get_coast_line, pyroms_toolbox.change, pyroms_toolbox.vorticity, pyroms_toolbox.nc_create_roms_bdry_file, _remapping_fast_weighted, pyroms_toolbox.BGrid_POP.get_nc_BGrid_POP, pyroms_toolbox.BGrid_POP.BGrid_POP, pyroms_toolbox.PCA, pyroms_toolbox.Grid_HYCOM.flood_fast, pyroms_toolbox.date2jday, pyroms_toolbox.compute_moc, pyroms_toolbox.strain_norm, pyroms.sta_hgrid
scrip.so not found. Remapping function will not be available
lpsolve55.so not found.
Linear programming method will not be available.
Exception AttributeError: "'Gridgen' object has no attribute '_libgridgen'" in <bound method Gridgen.__del__ of <pyroms.hgrid.Gridgen object at 0x7efb8514fcd0>> ignored
Traceback (most recent call last):

File "<ipython-input-2-6cbab32db6bb>", line 1, in <module>
runfile('/home/navin/Downloads/pyroms/examples/Yellow_Sea/make_YELLOW_grd_v1.py', wdir='/home/navin/Downloads/pyroms/examples/Yellow_Sea')

File "/home/navin/anaconda2/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 714, in runfile
execfile(filename, namespace)

File "/home/navin/anaconda2/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
builtins.execfile(filename, *where)

File "/home/navin/Downloads/pyroms/examples/Yellow_Sea/make_YELLOW_grd_v1.py", line 32, in <module>
hgrd = pyroms.grid.Gridgen(lonp, latp, beta, (Mm+3, Lm+3), proj=map)

File "/home/navin/roms/pyroms/lib/python2.7/site-packages/pyroms/hgrid.py", line 1028, in __init__
self._libgridgen = np.ctypeslib.load_library('libgridgen', pyroms.__path__[0])

File "/home/navin/anaconda2/lib/python2.7/site-packages/numpy/ctypeslib.py", line 128, in load_library
raise OSError("no file with expected extension")

OSError: no file with expected extension



but when i run the same example directly in terminal I gets below error

/home/navin/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
scrip.so not found. Remapping function will not be available
Traceback (most recent call last):
File "make_YELLOW_grd_v1.py", line 11, in <module>
import pyroms_toolbox
File "/home/navin/roms/pyroms/lib/python2.7/site-packages/pyroms_toolbox/__init__.py", line 51, in <module>
from _move_river_t import move_river_t
ImportError: No module named _move_river_t

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#37 Post by kate » Wed Nov 30, 2016 6:16 pm

Just edit this file:
File "/home/navin/roms/pyroms/lib/python2.7/site-packages/pyroms_toolbox/__init__.py", line 51, in <module>
and comment out the line with _move_river_t.

navin
Posts: 11
Joined: Mon Jun 08, 2015 4:40 pm
Location: Indian Institute of Technology Delhi

Re: PYROMS installation

#38 Post by navin » Thu Dec 01, 2016 11:16 am

/home/navin/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
Thank's kate for your reply. I did as you told me after that I am getting this error.
Further if anyone can tell me when I am imoprting lpsolve55 in console it is not showing any error, while runnin the grid file it shows error and same about scrip.so, i have already made a link of scrip.so file in the /python2.7/site-packages/pyroms/remapping folder, then why it is showing error. If any one can provide a proper documentation for the installation of pyroms in ubuntu 14.04 64 bit, I will be very helpful.

warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
scrip.so not found. Remapping function will not be available
lpsolve55.so not found.
Linear programming method will not be available.
Traceback (most recent call last):
File "make_YELLOW_grd_v1.py", line 32, in <module>
hgrd = pyroms.grid.Gridgen(lonp, latp, beta, (Mm+3, Lm+3), proj=map)
File "/home/navin/roms/pyroms/lib/python2.7/site-packages/pyroms/hgrid.py", line 1028, in __init__
self._libgridgen = np.ctypeslib.load_library('libgridgen', pyroms.__path__[0])
File "/home/navin/anaconda2/lib/python2.7/site-packages/numpy/ctypeslib.py", line 128, in load_library
raise OSError("no file with expected extension")
OSError: no file with expected extension
Exception AttributeError: "'Gridgen' object has no attribute '_libgridgen'" in <bound method Gridgen.__del__ of <pyroms.hgrid.Gridgen object at 0x7efbd671d850>> ignored

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#39 Post by kate » Thu Dec 01, 2016 6:45 pm

First of all, Ubuntu 14.04 is so old they are no longer providing updates for it. It is recommended that you update to the 16.x series. I have such a beast in a VirtualBox I've been meaning to install pyroms/PyCNAL into.

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#40 Post by kate » Thu Dec 01, 2016 10:49 pm

I just got PyCNAL to install with Anaconda3. Important, set PYTHONPATH in your .bashrc file before the Anaconda stuff:
export PYTHONPATH=/home/kate/anaconda3/lib/python3.5/site-packages
export PATH="/home/kate/anaconda3/bin:$PATH"
"import pycnal" even works for me, but now I'm having trouble with pycnal_toolbox and its "import _average". Sigh.

Anyway, check to see if you have any .so files in your .../site-packages/pyroms directory and make sure that .../site-packages directory is in your PYTHONPATH.

User avatar
kate
Posts: 3802
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: PYROMS installation

#41 Post by kate » Fri Dec 02, 2016 12:28 am

I think I finally fixed that move_river_t issue. Also the creep issue. As for location of the .so files, it seems to behave if I have them all where the installation scripts put them as well as one directory up, right inside the site-packages directory. :roll: :?:

Post Reply