Permalink
Browse files

Moved NetCDF interface code into the `tables.netcdf3` subpackage.

git-svn-id: http://www.pytables.org/svn/pytables/branches/professional@2222 1b98710c-d8ec-0310-ae81-f5f2bcd8cb94
  • Loading branch information...
Ivan Vilata i Balaguer
Ivan Vilata i Balaguer committed Jan 13, 2007
1 parent 933fe05 commit 732fc26945835e9ad32ec354b572606710ba8691
View
4 THANKS
@@ -23,8 +23,8 @@ nextafterf math functions that despite the fact they are standard in
C99 standard, they are not at the official places in Microsoft VC++
6.x nor VC++ 7.x.
-Jeff Whitaker for providing the NetCDF module and the utilities for
-doing conversions between to HDF5 (nctoh5).
+Jeff Whitaker for providing the NetCDF module and the utility for
+converting netCDF files to HDF5 (nctoh5).
Norbert Nemec for providing several interesting patches.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -404,7 +404,7 @@ def __init__(self, name, tag, header_name, library_name, runtime_name):
'console_scripts': [
'ptdump = tables.scripts.ptdump:main',
'ptrepack = tables.scripts.ptrepack:main',
- 'nctoh5 = tables.scripts.nctoh5:main [netCDF]',
+ 'nctoh5 = tables.netcdf3.scripts.nctoh5:main [netCDF]',
],
}
setuptools_kwargs['scripts'] = []
@@ -414,7 +414,7 @@ def __init__(self, name, tag, header_name, library_name, runtime_name):
# There is no other chance, these values must be hardwired.
setuptools_kwargs['packages'] = [
'tables', 'tables.nodes', 'tables.scripts', 'tables.numexpr',
- 'tables.nra']
+ 'tables.nra', 'tables.netcdf3']
setuptools_kwargs['scripts'] = [
'utils/ptdump', 'utils/ptrepack', 'utils/nctoh5']
@@ -1,7 +1,7 @@
"""
PyTables NetCDF version 3 emulation API.
-This module provides an API is nearly identical to Scientific.IO.NetCDF
+This package provides an API is nearly identical to Scientific.IO.NetCDF
(http://starship.python.net/~hinsen/ScientificPython/ScientificPythonManual/Scientific.html).
Some key differences between the Scientific.IO.NetCDF API and the pytables
NetCDF emulation API to keep in mind are:
@@ -10,7 +10,7 @@
2) Although each variable can have only one unlimited
dimension, it need not be the first as in a true NetCDF file.
Complex data types 'F' (complex64) and 'D' (complex128) are supported
- in tables.NetCDF, but are not supported in netCDF
+ in tables.netcdf3, but are not supported in netCDF
(or Scientific.IO.NetCDF). Files with variables that have
these datatypes, or an unlimited dimension other than the first,
cannot be converted to netCDF using h5tonc.
@@ -65,15 +65,15 @@
9) output similar to 'ncdump -h' can be obtained by simply
printing the NetCDFFile instance.
-A tables.NetCDF file consists of array objects (either EArrays or
+A tables.netcdf3 file consists of array objects (either EArrays or
CArrays) located in the root group of a pytables hdf5 file. Each of
the array objects must have a dimensions attribute, consisting of a
tuple of dimension names (the length of this tuple should be the same
as the rank of the array object). Any such objects with one
of the supported data types in a pytables file that conforms to
-this simple structure can be read with the tables.NetCDF module.
+this simple structure can be read with the tables.netcdf3 package.
-Note: This module does not yet create HDF5 files that are compatible
+Note: This package does not yet create HDF5 files that are compatible
with netCDF version 4.
Datasets created with the PyTables netCDF emulation API can be shared
@@ -227,7 +227,7 @@ def __init__(self,filename,mode='r',history=None):
continue
self.variables[var.name]=_NetCDFVariable(var,self)
if len(self.variables.keys()) == 0:
- raise IOError, 'file does not contain any objects compatible with tables.NetCDF'
+ raise IOError, 'file does not contain any objects compatible with tables.netcdf3'
else:
# initialize dimension and variable dictionaries for a new file.
self.dimensions = {}
@@ -437,7 +437,7 @@ def h5tonc(self,filename,packshort=False,scale_factor=None,add_offset=None):
def nctoh5(self,filename,unpackshort=True,filters=None):
"""convert a true netcdf file (filename) to a hdf5 file
- compatible with this module. Requires Scientific.IO.NetCDF
+ compatible with this package. Requires Scientific.IO.NetCDF
module. If unpackshort=True, variables stored as short
integers with a scale and offset are unpacked to Float32
variables in the hdf5 file. If the least_significant_digit
No changes.
@@ -11,8 +11,8 @@
import sys, os.path, getopt, time
-import tables.NetCDF
-if not tables.NetCDF.ScientificIONetCDF_imported:
+import tables.netcdf3
+if not tables.netcdf3.ScientificIONetCDF_imported:
raise ImportError, 'nctoh5 requires the ScientificIONetCDF module'
from tables.Leaf import Filters
@@ -21,9 +21,9 @@
def nctoh5(ncfilename, h5filename, filters, verbose, overwritefile):
# open h5 file
if overwritefile:
- h5file = tables.NetCDF.NetCDFFile(h5filename, mode = "w")
+ h5file = tables.netcdf3.NetCDFFile(h5filename, mode = "w")
else:
- h5file = tables.NetCDF.NetCDFFile(h5filename, mode = "a")
+ h5file = tables.netcdf3.NetCDFFile(h5filename, mode = "a")
# convert to netCDF
nobjects, nbytes = h5file.nctoh5(ncfilename,filters=filters)
# ncdump-like output
No changes.
@@ -1,20 +1,16 @@
-import sys
import unittest
import os
import tempfile
-import warnings
import numpy
-from tables import *
-import tables.NetCDF as NetCDF
-import tables.tests.common as common
-from tables.tests.common import verbose, allequal, cleanup, heavy
+from tables import netcdf3 as NetCDF
+from tables.tests.common import PyTablesTestCase, cleanup
# To delete the internal attributes automagically
unittest.TestCase.tearDown = cleanup
-class NetCDFFileTestCase(common.PyTablesTestCase):
+class NetCDFFileTestCase(PyTablesTestCase):
def setUp(self):
# Create an HDF5 with the NetCDF interface.
View
@@ -45,7 +45,6 @@ def suite():
###'test_queries', # Please, activate this when almost tests passes
# Sub-packages
'test_filenode',
- 'test_NetCDF',
]
# Add test_Numeric only if Numeric is installed
@@ -57,16 +56,6 @@ def suite():
print "*Warning*: Numeric version is lower than recommended: %s < %s" % \
(Numeric.__version__, minimum_numeric_version)
test_modules.append("test_Numeric")
-
- # Warn about conversion between hdf5 <--> NetCDF will only be
- # checked if Numeric *and* Scientific.IO.NetCDF are installed.
- try:
- import Scientific.IO.NetCDF as RealNetCDF
- print \
-"Scientific.IO.NetCDF is present. Will check for HDF5 <--> NetCDF conversions."
- except:
- print \
-"Scientific.IO.NetCDF not found. Skipping HDF5 <--> NetCDF conversion tests."
except:
print "Skipping Numeric test suite"
View
@@ -1,3 +1,3 @@
#!/usr/bin/env python
-from tables.scripts.nctoh5 import main
+from tables.netcdf3.scripts.nctoh5 import main
main()

0 comments on commit 732fc26

Please sign in to comment.