Opened 10 years ago

Closed 6 years ago

#1298 closed enhancement (fixed)

netCDF et al

Reported by: darkblueb Owned by: live-demo@…
Priority: normal Milestone: OSGeoLive8.0
Component: OSGeoLive Keywords: python, netCDF


There has been some discussion about netCDF, python-netCDF and versions.. This ticket is to clarify and record information relating to netCDF versions.

Change history (14)

comment:1 by darkblueb, 10 years ago

there is a python package called ScientificPython which contains IO.NetCDF. A revision date shows 2008. It is present on the disk but not referenced.

user@live-79a-042:~/gisvm/bin$ locate

comment:2 by darkblueb, 10 years ago

Two .so libs present. One is 2.3M, the other is 1.1M. Both have very similar lists of linked libs.


user@live-79a-042:~$ ldd /usr/local/lib/python2.7/dist-packages/ | sort => /usr/lib/i386-linux-gnu/ (0x00ab8000) => /lib/i386-linux-gnu/ (0x004c8000) => /lib/i386-linux-gnu/ (0x009e6000) => /lib/i386-linux-gnu/ (0x00110000) => /usr/lib/i386-linux-gnu/ (0x002ba000) => /lib/i386-linux-gnu/ (0x00730000) => /lib/i386-linux-gnu/ (0x006a6000) => /usr/lib/i386-linux-gnu/ (0x003a6000) => /lib/i386-linux-gnu/ (0x0072b000) => /usr/lib/i386-linux-gnu/ (0x004e2000) => /usr/lib/i386-linux-gnu/ (0x0053c000) => /usr/lib/i386-linux-gnu/ (0x009b1000) => /usr/lib/ (0x00312000) => /usr/lib/ (0x00c02000) => /usr/lib/i386-linux-gnu/ (0x0088d000) => /usr/lib/i386-linux-gnu/ (0x00735000) => /usr/lib/i386-linux-gnu/ (0x00bb2000) => /usr/lib/i386-linux-gnu/ (0x0074c000) => /usr/lib/i386-linux-gnu/ (0x0084f000) => /lib/i386-linux-gnu/ (0x0073d000) => /usr/lib/i386-linux-gnu/ (0x00a35000) => /usr/lib/i386-linux-gnu/ (0x00780000) => /usr/lib/i386-linux-gnu/ (0x00fbb000) => /usr/lib/i386-linux-gnu/ (0x00345000) => /usr/lib/i386-linux-gnu/ (0x00354000)
	/lib/ (0x0089d000) => /lib/i386-linux-gnu/ (0x00484000) => /usr/lib/ (0x0058e000) => /usr/lib/i386-linux-gnu/ (0x00579000) => /lib/i386-linux-gnu/ (0x00fcb000) => /lib/i386-linux-gnu/ (0x004b0000) => /usr/lib/i386-linux-gnu/ (0x00877000) => /usr/lib/i386-linux-gnu/ (0x0046a000) => /lib/i386-linux-gnu/ (0x00a2c000) => /usr/lib/i386-linux-gnu/ (0x00520000) => /usr/lib/i386-linux-gnu/ (0x00fe6000) => /usr/lib/i386-linux-gnu/ (0x004cd000) => /usr/lib/i386-linux-gnu/ (0x008bf000) => /lib/i386-linux-gnu/ (0x00b9c000) =>  (0x00a2b000)
user@live-79a-042:~$ ldd /usr/lib/ | sort => /usr/lib/i386-linux-gnu/ (0x00e55000) => /lib/i386-linux-gnu/ (0x00110000) => /lib/i386-linux-gnu/ (0x00ccc000) => /lib/i386-linux-gnu/ (0x007de000) => /usr/lib/i386-linux-gnu/ (0x00c36000) => /lib/i386-linux-gnu/ (0x0011a000) => /lib/i386-linux-gnu/ (0x00a4c000) => /usr/lib/i386-linux-gnu/ (0x00988000) => /lib/i386-linux-gnu/ (0x00115000) => /usr/lib/i386-linux-gnu/ (0x001c8000) => /usr/lib/i386-linux-gnu/ (0x00d0a000) => /usr/lib/i386-linux-gnu/ (0x00be0000) => /usr/lib/ (0x00d84000) => /usr/lib/ (0x003a7000) => /usr/lib/i386-linux-gnu/ (0x00789000) => /usr/lib/i386-linux-gnu/ (0x00281000) => /usr/lib/i386-linux-gnu/ (0x00f20000) => /usr/lib/i386-linux-gnu/ (0x00142000) => /usr/lib/i386-linux-gnu/ (0x00bb8000) => /lib/i386-linux-gnu/ (0x00f1c000) => /usr/lib/i386-linux-gnu/ (0x00db7000) => /usr/lib/i386-linux-gnu/ (0x00ad1000) => /usr/lib/i386-linux-gnu/ (0x00cc3000) => /usr/lib/i386-linux-gnu/ (0x0079d000) => /usr/lib/i386-linux-gnu/ (0x00176000)
	/lib/ (0x00120000) => /lib/i386-linux-gnu/ (0x0074b000) => /usr/lib/i386-linux-gnu/ (0x00777000) => /lib/i386-linux-gnu/ (0x0024a000) => /lib/i386-linux-gnu/ (0x00e3d000) => /usr/lib/i386-linux-gnu/ (0x007ac000) => /usr/lib/i386-linux-gnu/ (0x00206000) => /lib/i386-linux-gnu/ (0x00f76000) => /usr/lib/i386-linux-gnu/ (0x00265000) => /usr/lib/i386-linux-gnu/ (0x00f7f000) => /usr/lib/i386-linux-gnu/ (0x00220000) => /usr/lib/i386-linux-gnu/ (0x00c8e000) => /lib/i386-linux-gnu/ (0x00234000) =>  (0x007dd000)

comment:3 by darkblueb, 10 years ago

There is a project at What is the relationship to apt-get install python-netcdf ?

After svn co netcdf4-python-trunk and reading a bit, I noticed that read three variables from the netCDF4 module. These three variable match in netCDF4 supplied by apt-get install python-netcdf.

comment:4 by darkblueb, 10 years ago

in python, making a call to netCDF4 Dataset.filepath() returns

filepath method requires netcdf lib >= 4.1.2, you have 4.1.1

comment:5 by darkblueb, 10 years ago

a python example

In [2]: import netCDF4

In [3]: from netCDF4 import Dataset

In [4]: tDS = Dataset('/usr/local/share/data/netcdf/')

In [5]: tDS.file_format

Apparently the Canadian Climate Centre is using netCDF3 format data.. others mention using v3 data also, and a current rev of NetCDF is needed to do both netCDF3 and read/write HDF5 format.

comment:6 by darkblueb, 10 years ago

Note that this page has no reference to python... more chance that there are several python implementations then..

comment:7 by darkblueb, 10 years ago

hiebert writes : -- With respect to netcdf pacakges in python, Scientific.IO.NetCDF is a pure python implementation that only handles classic (version 3) NetCDF files. To my knowledge it is not under active development (like you have noted with the 6 year old revision date). There is definitely merit to using a pure python implementation (it can run on different interpreters like PyPy and Jython, there is no build/linking process, and it's substantially more portable). However, not handling version 4 NetCDF files can be problematic.

It's worth noting that the NetCDF4 format is a subset of the HDF5 format, so you can use either library to open NetCDF4 files. We use the netcdf4-python and the h5py packages. Both sets of developers are extremely responsive and I trust their code. We typically install both using python's pip, rather than relying on the Debian packages.

I hadn't noticed that I only gave you NetCDF 3 files. Hopefully, that's OK. We use both depending on the needs of the data storage for a particular project.


comment:8 by kalxas, 10 years ago

Milestone: OSGeoLive7.9OSGeoLive8.0

comment:9 by darkblueb, 10 years ago

oddly, netCDF4 install is erroring out in LUbuntu 14.04.1 change to setuptools method (for now)

comment:10 by darkblueb, 10 years ago

package libhdf4-alt-dev is pulled in by gdal-dev:

user@live8-a4:~/libhdf4-4.2r10$ less debian/libhdf4-alt-dev.install

usr/lib-alt/lib*.a  usr/lib
usr/lib-alt/lib*.la usr/lib
usr/lib-alt/lib*.so usr/lib
usr/include-alt/hdf usr/include
usr/share/man/man1/hdf.3 usr/share/man/man3
debian/libhdf4-alt-dev.install (END)

comment:11 by hamish, 10 years ago

fyi libhdf4-alt-dev is needed to move files around from their original, and perhaps user-expected positions, since GDAL wants to be able to read both HDF4 and HDF5 datasets, but the upstream authors only expect you to have one version installed at a time, which leads to conflicting namespace problems in the filesystem. there's a bit of discussion about it on the debiangis mailing list archives if anyone is curious.

what's the current status of this ticket? specifically the errors mentioned in comment:9?

do we have a viewer already on disc that the *.nc files could be associated with via a double click?

thanks, Hamish

comment:12 by darkblueb, 10 years ago

When the Live switched to using the jtaylor PPA for IPython, it resolved most of the ambiguities in the component versions under Ubuntu 14.04. Please note that the SciPy stack is a confederation of previously independent projects.. there definitely *were* issues of components dissonance, but things are much better now. NetCDF libs are included in that.

Some of this ticket is meant to simply document obscure lore as the installs evolved.

comment:13 by darkblueb, 9 years ago

Live 8.5 build 12028 -- note that package python-netcdf supplies :


while package python-netcdf4 supplies :


comment:14 by darkblueb, 6 years ago

Resolution: fixed
Status: newclosed

version 12dev alpha1 ; netCDF4 python is stable and integrated

Note: See TracTickets for help on using tickets.