pyroms problem running/installing

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
asujrpv

pyroms problem running/installing

#1 Unread post by asujrpv »

Hello everybody,
I am trying to run pyroms (or octant) and have the following errors. I would be grateful for your help.
For pyroms it gives me the error cannot import MFDataset, but it loaded numpy, pylab, and other toolkits:

rpacheco@mexico~/PLOTROMS/Grid > python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> import pylab as pl
>>> from mpl_toolkits.basemap import Basemap
/usr/local/lib/python2.6/dist-packages/mpl_toolkits/__init__.py:2: UserWarning: Module dateutil was already imported from /usr/local/lib/python2.6/dist-packages/dateutil/__init__.pyc, but /usr/lib/pymodules/python2.6 is being added to sys.path
__import__('pkg_resources').declare_namespace(__name__)
>>> import netCDF4
>>> import pyroms
/usr/local/lib/python2.6/dist-packages/pyroms/Dataset.py:65: UserWarning: netCDF4 not found -- using pupynere.
warnings.warn('netCDF4 not found -- using pupynere.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/pyroms/__init__.py", line 15, in <module>
from Dataset import Dataset, MFDataset
ImportError: cannot import name MFDataset

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: pyroms problem running/installing

#2 Unread post by linzhenhua »

I think you should first check that you have installed python-netcdf4 package successfully.

asujrpv

Re: pyroms problem running/installing

#3 Unread post by asujrpv »

"I think you should first check that you have installed python-netcdf4 package successfully."

I have tested python-netcdf4 successfully. I also think that when I import netcdf and python does not complain implies that python-netcdf4 is installed properly, but I am not an expert on these issues, and thus my question.

Thanks!

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: pyroms problem running/installing

#4 Unread post by linzhenhua »

Do you install pyroms after you have installed python-netcdf4 successfully?

asujrpv

Re: pyroms problem running/installing

#5 Unread post by asujrpv »

linzhenhua wrote:Do you install pyroms after you have installed python-netcdf4 successfully?
I believe I did.

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: pyroms problem running/installing

#6 Unread post by linzhenhua »

Then I have no idea what's wrong. Maybe a fresh reinstall help.

The Warning message "netCDF4 not found -- using pupynere." indicate that pyroms could not import netCDF4 module.

The error message "ImportError: cannot import name MFDataset" is a consequence of failing to import netCDF4 module.

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

Re: pyroms problem running/installing

#7 Unread post by hetland »

I'm not sure what is going on. Since you can import netCDF4 by hand, it seems like that is all fine. You can try to find where pypurene is loaded in pyroms (it will be in a try/except block), and hardwire in a netcdf4 import.

I don't think that the latest version of octant does this, though. You may want to try that instead. I don't keep up with pyroms development, and have moved all active (well not so active recently) development to octant.

asujrpv

Re: pyroms problem running/installing

#8 Unread post by asujrpv »

hetland wrote:I'm not sure what is going on. Since you can import netCDF4 by hand, it seems like that is all fine. You can try to find where pypurene is loaded in pyroms (it will be in a try/except block), and hardwire in a netcdf4 import.

I don't think that the latest version of octant does this, though. You may want to try that instead. I don't keep up with pyroms development, and have moved all active (well not so active recently) development to octant.
I appreciate very much your responses. I can now run gridgen and seems like octant is now working. I have a little problem I think, with plotting pyplot. Please see the warning below - how can I make this work? I can use one of gridgen examples, but does octant have one that I can follow to learn? I am new on this ROMS modeling, in particular new with python. Thanks very much
Rafael


rpacheco@mexico~/PLOTROMS/Grid > python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> import pylab as pl
>>> from scipy.io import matlab
>>> import scipy.interpolate as interpolate
>>> from datetime import datetime
>>> from pylab import imread
>>> import netCDF4
>>> import matplotlib
>>> from mpl_toolkits.basemap import Basemap
/usr/local/lib/python2.6/dist-packages/mpl_toolkits/__init__.py:2: UserWarning: Module dateutil was already imported from /usr/local/lib/python2.6/dist-packages/dateutil/__init__.pyc, but /usr/lib/pymodules/python2.6 is being added to sys.path
__import__('pkg_resources').declare_namespace(__name__)
>>> import octant
/usr/local/lib/python2.6/dist-packages/matplotlib/numerix/__init__.py:18: DeprecationWarning:
**********************************************************
matplotlib.numerix and all its subpackages are deprecated.
They will be removed soon. Please use numpy instead.
**********************************************************

warnings.warn(msg, DeprecationWarning)
>>> x1 = [16704, 10709, 3563, 4277, 13488 , 16704 ]
>>> y1 = [18405, 10051, 8584, 2334, 6352, 14770]
>>> beta1 = [1.0, 0, 1.0, 1.0, 0, 1.0]
>>> pyplot(x1, y1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'pyplot' is not defined
>>> exit()

linzhenhua
Posts: 64
Joined: Mon Oct 17, 2005 2:02 am
Location: Institute of Oceanology,Chinese Academy of Sciences

Re: pyroms problem running/installing

#9 Unread post by linzhenhua »

If you want to use pyplot, you need first import it.

from matplotlib import pyplot

pyplot.plot()

Post Reply