netcdf4-python usage, NetCDFFile

I've searched through the netcdf4-python trunk, but I find no
reference of NetCDFFile as in how the basemap or Scientific.IO.NetCDF
modules use it.

For compatibility with my old scripts, is it safe to simply:

from netCDF4 import Dataset as NetCDFFile

??

Thanks,
john

John: Neither basemap or Scientific.IO.NetCDF uses it. What gave you the impression they did? There is a 'NetCDFFile' in function in basemap, but it is based on the pure-python netCDF module pupynere. It doesn't support netcdf-4 and I only recommend using it for the occasional light use.

The netcdf4-python API is mostly compatible with Scientific.IO.NetCDF, so if you have old script that use the latter, you can try:

from netCDF4 import Dataset as NetCDFFile

The docs for netcdf4-python are at

http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html

-Jeff

···

On 10/30/10 3:41 AM, John wrote:

I've searched through the netcdf4-python trunk, but I find no
reference of NetCDFFile as in how the basemap or Scientific.IO.NetCDF
modules use it.

For compatibility with my old scripts, is it safe to simply:

from netCDF4 import Dataset as NetCDFFile

??

Thanks,
john

Thank you. I didn't think they used it, I just wanted to know if it
was safe to do what you suggested to try. It does seem to work.

Another question, can netcd4-python READ HDF files? Or is it just that
it creates files that are readable? If it's the latter, does anyone
have a suggestion for a python module that can read both hdf4 and
hdf5??

Thank you,
john

PS: Jeff, this module seems to work very well! And I am very thankful
for the introduction of compression.

···

On Sat, Oct 30, 2010 at 2:55 PM, Jeff Whitaker <jswhit@...146...> wrote:

On 10/30/10 3:41 AM, John wrote:

I've searched through the netcdf4-python trunk, but I find no
reference of NetCDFFile as in how the basemap or Scientific.IO.NetCDF
modules use it.

For compatibility with my old scripts, is it safe to simply:

from netCDF4 import Dataset as NetCDFFile

??

Thanks,
john

John: Neither basemap or Scientific.IO.NetCDF uses it. What gave you
the impression they did? There is a 'NetCDFFile' in function in
basemap, but it is based on the pure-python netCDF module pupynere. It
doesn't support netcdf-4 and I only recommend using it for the
occasional light use.

The netcdf4-python API is mostly compatible with Scientific.IO.NetCDF,
so if you have old script that use the latter, you can try:

from netCDF4 import Dataset as NetCDFFile

The docs for netcdf4-python are at

http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html

-Jeff

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Configuration
``````````````````````````
Plone 2.5.3-final,
CMF-1.6.4,
Zope (Zope 2.9.7-final, python 2.4.4, linux2),
Python 2.6
PIL 1.1.6
Mailman 2.1.9
Postfix 2.4.5
Procmail v3.22 2001/09/10
Basemap: 1.0
Matplotlib: 1.0.0

Thank you. I didn't think they used it, I just wanted to know if it
was safe to do what you suggested to try. It does seem to work.

Another question, can netcd4-python READ HDF files? Or is it just that
it creates files that are readable? If it's the latter, does anyone
have a suggestion for a python module that can read both hdf4 and
hdf5??

Thank you,
john

PS: Jeff, this module seems to work very well! And I am very thankful
for the introduction of compression.

John: If you enabled hdf4 support when you built the netcdf lib, it will read hdf4 files in 'scientific dataset' files.

-Jeff

···

On 10/30/10 5:05 PM, John wrote:

On Sat, Oct 30, 2010 at 2:55 PM, Jeff Whitaker<jswhit@...146...> wrote:

  On 10/30/10 3:41 AM, John wrote:

I've searched through the netcdf4-python trunk, but I find no
reference of NetCDFFile as in how the basemap or Scientific.IO.NetCDF
modules use it.

For compatibility with my old scripts, is it safe to simply:

from netCDF4 import Dataset as NetCDFFile

??

Thanks,
john

John: Neither basemap or Scientific.IO.NetCDF uses it. What gave you
the impression they did? There is a 'NetCDFFile' in function in
basemap, but it is based on the pure-python netCDF module pupynere. It
doesn't support netcdf-4 and I only recommend using it for the
occasional light use.

The netcdf4-python API is mostly compatible with Scientific.IO.NetCDF,
so if you have old script that use the latter, you can try:

from netCDF4 import Dataset as NetCDFFile

The docs for netcdf4-python are at

http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html

-Jeff

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps& games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Jeff,

I just built netcdf with the following script:

#!/bin/bash

./configure --enable-netcdf-4 --enable-hdf4 --enable-hdf4-file-tests
--enable-pnetcdf --enable-cxx-4 --with-hdf5=/flex_wrk/lib64
--enable-shared --prefix=/flex_wrk/lib64
make
make install

Everything seemed to work fine.

I then rebuilt netcdf4-python and got no errors.
IE:
export HDF5_DIR=/flex_wrk/lib64
export NETCDF4_DIR=/flex_wrk/lib64
python setup.py build
python setup.py install --prefix=/custom...

However, when I try to read a hdf4 file in Ipython I get:
In [1]: from netCDF4 import Dataset as NetCDFFile

In [2]: nci = NetCDFFile('scia_200910.hdf')

···

---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)

/xnilu_wrk/flex_wrk/EMISSIONS/<ipython console> in <module>()

/xnilu_wrk/flex_wrk/bin64/site-packages/netCDF4.so in
netCDF4.Dataset.__init__ (netCDF4.c:6336)()

RuntimeError: Attempt to use feature that was not turned on when
netCDF was built.

What is it that I need to do to 'build' netCDF and netcdf4-python with
the support?

Thank you,
john

On Sun, Oct 31, 2010 at 2:53 AM, Jeff Whitaker <jswhit@...146...> wrote:

On 10/30/10 5:05 PM, John wrote:

Thank you. I didn't think they used it, I just wanted to know if it
was safe to do what you suggested to try. It does seem to work.

Another question, can netcd4-python READ HDF files? Or is it just that
it creates files that are readable? If it's the latter, does anyone
have a suggestion for a python module that can read both hdf4 and
hdf5??

Thank you,
john

PS: Jeff, this module seems to work very well! And I am very thankful
for the introduction of compression.

John: If you enabled hdf4 support when you built the netcdf lib, it will
read hdf4 files in 'scientific dataset' files.

-Jeff

On Sat, Oct 30, 2010 at 2:55 PM, Jeff Whitaker<jswhit@...146...> wrote:

On 10/30/10 3:41 AM, John wrote:

I've searched through the netcdf4-python trunk, but I find no
reference of NetCDFFile as in how the basemap or Scientific.IO.NetCDF
modules use it.

For compatibility with my old scripts, is it safe to simply:

from netCDF4 import Dataset as NetCDFFile

??

Thanks,
john

John: Neither basemap or Scientific.IO.NetCDF uses it. What gave you
the impression they did? There is a 'NetCDFFile' in function in
basemap, but it is based on the pure-python netCDF module pupynere. It
doesn't support netcdf-4 and I only recommend using it for the
occasional light use.

The netcdf4-python API is mostly compatible with Scientific.IO.NetCDF,
so if you have old script that use the latter, you can try:

from netCDF4 import Dataset as NetCDFFile

The docs for netcdf4-python are at

http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html

-Jeff

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America
contest
Create new apps& games for the Nokia N8 for consumers in U.S. and
Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in
marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Configuration
``````````````````````````
Plone 2.5.3-final,
CMF-1.6.4,
Zope (Zope 2.9.7-final, python 2.4.4, linux2),
Python 2.6
PIL 1.1.6
Mailman 2.1.9
Postfix 2.4.5
Procmail v3.22 2001/09/10
Basemap: 1.0
Matplotlib: 1.0.0

Jeff,

I just built netcdf with the following script:

#!/bin/bash

./configure --enable-netcdf-4 --enable-hdf4 --enable-hdf4-file-tests
--enable-pnetcdf --enable-cxx-4 --with-hdf5=/flex_wrk/lib64
--enable-shared --prefix=/flex_wrk/lib64
make
make install

John: You forget --with-hdf4=<where hdf4 is installed>.

-Jeff

···

On 10/31/10 5:44 AM, John wrote:

Everything seemed to work fine.

I then rebuilt netcdf4-python and got no errors.
IE:
export HDF5_DIR=/flex_wrk/lib64
export NETCDF4_DIR=/flex_wrk/lib64
python setup.py build
python setup.py install --prefix=/custom...

However, when I try to read a hdf4 file in Ipython I get:
In [1]: from netCDF4 import Dataset as NetCDFFile

In [2]: nci = NetCDFFile('scia_200910.hdf')
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)

/xnilu_wrk/flex_wrk/EMISSIONS/<ipython console> in<module>()

/xnilu_wrk/flex_wrk/bin64/site-packages/netCDF4.so in
netCDF4.Dataset.__init__ (netCDF4.c:6336)()

RuntimeError: Attempt to use feature that was not turned on when
netCDF was built.

What is it that I need to do to 'build' netCDF and netcdf4-python with
the support?

Thank you,
john

On Sun, Oct 31, 2010 at 2:53 AM, Jeff Whitaker<jswhit@...146...> wrote:

On 10/30/10 5:05 PM, John wrote:

Thank you. I didn't think they used it, I just wanted to know if it
was safe to do what you suggested to try. It does seem to work.

Another question, can netcd4-python READ HDF files? Or is it just that
it creates files that are readable? If it's the latter, does anyone
have a suggestion for a python module that can read both hdf4 and
hdf5??

Thank you,
john

PS: Jeff, this module seems to work very well! And I am very thankful
for the introduction of compression.

John: If you enabled hdf4 support when you built the netcdf lib, it will
read hdf4 files in 'scientific dataset' files.

-Jeff

On Sat, Oct 30, 2010 at 2:55 PM, Jeff Whitaker<jswhit@...146...> wrote:

  On 10/30/10 3:41 AM, John wrote:

I've searched through the netcdf4-python trunk, but I find no
reference of NetCDFFile as in how the basemap or Scientific.IO.NetCDF
modules use it.

For compatibility with my old scripts, is it safe to simply:

from netCDF4 import Dataset as NetCDFFile

??

Thanks,
john

John: Neither basemap or Scientific.IO.NetCDF uses it. What gave you
the impression they did? There is a 'NetCDFFile' in function in
basemap, but it is based on the pure-python netCDF module pupynere. It
doesn't support netcdf-4 and I only recommend using it for the
occasional light use.

The netcdf4-python API is mostly compatible with Scientific.IO.NetCDF,
so if you have old script that use the latter, you can try:

from netCDF4 import Dataset as NetCDFFile

The docs for netcdf4-python are at

http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html

-Jeff

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America
contest
Create new apps& games for the Nokia N8 for consumers in U.S. and
Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in
marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users