netcdf4-python

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
asujrpv

netcdf4-python

#1 Post by asujrpv » Sat Mar 19, 2011 10:49 pm

Hello,

I am having problems netcdf4-python. I installed netcdf4.1.1 and HD5. For or hdf5 I used:
./configure --prefix=/usr/local/hdf5 --enable-shared --enable-hl
make
sudo make install

For netcdf4 I used
./configure --enable-netcdf-4 --with-hdf5=$HDF5_DIR --enable-shared --prefix=$NETCDF4_DIR
where HDF5_DIR is /usr/local/hdf5 and NETCDF4_DIR is /usr/local/netcdf4

When I try to build netcdf-python I get the following error:


rpacheco@mexico~/PLOTROMS/NETCDF4-PYTHON > python setup.py install
Traceback (most recent call last):
File "setup.py", line 106, in <module>
raise ValueError('did not find netCDF version 4 headers %s' % netCDF4_includedir)
ValueError: did not find netCDF version 4 headers /usr/local/netcdf4/include/

Of course I had already place in the .bashrc the following:

export HDF5_DIR=/usr/local/hdf5/
export NETCDF4_DIR=/usr/local/netcdf4/
export NETCDF4_INCDIR=/usr/local/netcdf4/include/

I would appreciate your help with this!
Rafael

mma
Posts: 3
Joined: Fri Jun 06, 2003 4:55 pm
Location: TAMU

Re: netcdf4-python

#2 Post by mma » Sun Mar 20, 2011 1:23 am

i) hdf5 must be at least hdf5-1.8.5-patch1

ii) with netcdf4 (worked fine with netcdf-4.1.1)
./configure --enable-netcdf-4 --with-hdf5=$HDFDIR --enable-shared --enable-dap --prefix=<whatever> --disable-fortran

asujrpv

Re: netcdf4-python

#3 Post by asujrpv » Mon Mar 21, 2011 2:25 am

hdf5 is hdf5-1.8.6 but did not install dap.
If you could, please tell me what the --prefix=<whatever> means and how did you compile hdf5 as well as zlib, since the command states that you are enabling shared I would very much appreciate it.

Thanks for your reply.

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

Re: netcdf4-python

#4 Post by kate » Mon Mar 21, 2011 5:17 pm

asujrpv wrote: raise ValueError('did not find netCDF version 4 headers %s' % netCDF4_includedir)
ValueError: did not find netCDF version 4 headers /usr/local/netcdf4/include/
Have you looked in the /usr/local/netcdf4/include directory? What is in there?

The "--prefix=/usr/local/netcdf4" option tells it to "make install" to this directory tree. Did you run "make check" to run the tests? Did it pass the netcdf4 tests?

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

Re: netcdf4-python

#5 Post by hetland » Tue Mar 22, 2011 1:55 pm

I suspect that your netcdf build actually built netcdf3 libraries. Double check the include and library dirs. Look at the output of configure and make.

Also, DAP support is built into the netCDF4 libraries, not HDF. So there should be no problem there.

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

Re: netcdf4-python

#6 Post by linzhenhua » Wed Mar 23, 2011 12:51 am

I remember I have encountered similar problems when installing netcdf4-python, which could not recognize the environment variables.
I solve this problem by editing the netcdf4-python setup.py file.

asujrpv

Re: netcdf4-python

#7 Post by asujrpv » Thu Mar 24, 2011 3:40 am

Thank you all for your reply, I contacted also the developers, here is the answer:


Unfortunately that combination doesn't work. Please see the note here about
only using HDF5-1.8.5-patch1 with netCDF-4.1.1 or using a later version of
netCDF with HDF5-1.8.6. The netCDF-4.1.2 release will be announced soon, and
that is known to work with HDF5-1.8.6:

http://www.unidata.ucar.edu/netcdf/docs ... at-411-186

--Russ

rsignell
Posts: 123
Joined: Fri Apr 25, 2003 9:22 pm
Location: USGS

Re: netcdf4-python

#8 Post by rsignell » Thu Jun 21, 2012 10:59 am

One easy way to get netcdf4-python is to pick up the Enthought Python Distribution:
http://www.enthought.com/products/epd.php
The latest version (7.3) includes netcdf4-python built with OPeNDAP support and 100+ other packages as well. The key thing is it works the same on 32 and 64 bit versions of Mac, Linux and Windows. This makes installing a kick-butt scientific python distribution as easy as installing Matlab, and yet it is free for academics, and a mere $200 for everyone else. Enthought are key contributers/maintainers of Numpy and Scipy, the core scientific python packages, so they are good company to support also. I originally bought a copy for myself, and now the USGS is picking up a site license for the EPD, to promote interoperability between USGS python users.

-Rich

Post Reply