Skip to content

Commit 91141a6

Browse files
committed
revert to last known working version
1 parent 521d513 commit 91141a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+6109
-7050
lines changed

Packages/cdms2/Lib/CDML.py

Lines changed: 208 additions & 217 deletions
Large diffs are not rendered by default.

Packages/cdms2/Lib/CDMLParser.py

Lines changed: 84 additions & 105 deletions
Large diffs are not rendered by default.

Packages/cdms2/Lib/MV2.py

Lines changed: 204 additions & 320 deletions
Large diffs are not rendered by default.

Packages/cdms2/Lib/__init__.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@
22
CDMS module-level API
33
"""
44
import cdat_info
5-
cdat_info.pingPCMDIdb("cdat", "cdms2")
5+
cdat_info.pingPCMDIdb("cdat","cdms2")
66

7-
__all__ = ["cdmsobj", "axis", "coord", "grid", "hgrid", "avariable",
8-
"sliceut", "error", "variable", "fvariable", "tvariable", "dataset",
9-
"database", "cache", "selectors", "MV2", "convention", "bindex",
10-
"auxcoord", "gengrid", "gsHost", "gsStaticVariable", "gsTimeVariable",
11-
"mvBaseWriter", "mvSphereMesh", "mvVsWriter", "mvCdmsRegrid"]
7+
__all__ = ["cdmsobj", "axis", "coord", "grid", "hgrid", "avariable", \
8+
"sliceut", "error", "variable", "fvariable", "tvariable", "dataset", \
9+
"database", "cache", "selectors", "MV2", "convention", "bindex", \
10+
"auxcoord", "gengrid", "gsHost", "gsStaticVariable", "gsTimeVariable", \
11+
"mvBaseWriter", "mvSphereMesh", "mvVsWriter", "mvCdmsRegrid"]
1212

1313
# Errors
14-
from .error import CDMSError
14+
from error import CDMSError
1515

1616
# CDMS datatypes
17-
from .cdmsobj import CdArray, CdChar, CdByte, CdDouble, CdFloat, CdFromObject, CdInt, CdLong, CdScalar, CdShort, CdString
17+
from cdmsobj import CdArray, CdChar, CdByte, CdDouble, CdFloat, CdFromObject, CdInt, CdLong, CdScalar, CdShort, CdString
1818

1919
# Functions which operate on all objects or groups of objects
20-
from .cdmsobj import Unlimited, getPathFromTemplate, matchPattern, matchingFiles, searchPattern, searchPredicate, setDebugMode
20+
from cdmsobj import Unlimited, getPathFromTemplate, matchPattern, matchingFiles, searchPattern, searchPredicate, setDebugMode
2121

2222
# Axis functions and classes
23-
from .axis import AbstractAxis, axisMatches, axisMatchAxis, axisMatchIndex
24-
from .axis import createAxis, createEqualAreaAxis, createGaussianAxis, createUniformLatitudeAxis, createUniformLongitudeAxis, setAutoBounds, getAutoBounds
23+
from axis import AbstractAxis, axisMatches, axisMatchAxis, axisMatchIndex
24+
from axis import createAxis, createEqualAreaAxis, createGaussianAxis, createUniformLatitudeAxis, createUniformLongitudeAxis, setAutoBounds, getAutoBounds
2525

2626
# Grid functions
27-
from .grid import createGenericGrid, createGlobalMeanGrid, createRectGrid, createUniformGrid, createZonalGrid, setClassifyGrids, createGaussianGrid, writeScripGrid, isGrid
27+
from grid import createGenericGrid, createGlobalMeanGrid, createRectGrid, createUniformGrid, createZonalGrid, setClassifyGrids, createGaussianGrid, writeScripGrid, isGrid
2828

2929
# Dataset functions
30-
from .dataset import createDataset, openDataset, useNetcdf3, \
31-
getNetcdfClassicFlag, getNetcdfShuffleFlag, getNetcdfDeflateFlag, getNetcdfDeflateLevelFlag,\
30+
from dataset import createDataset, openDataset, useNetcdf3, \
31+
getNetcdfClassicFlag, getNetcdfShuffleFlag, getNetcdfDeflateFlag, getNetcdfDeflateLevelFlag,\
3232
setNetcdfClassicFlag, setNetcdfShuffleFlag, setNetcdfDeflateFlag, setNetcdfDeflateLevelFlag,\
33-
setNetcdfUseNCSwitchModeFlag, getNetcdfUseNCSwitchModeFlag,\
33+
setNetcdfUseNCSwitchModeFlag,getNetcdfUseNCSwitchModeFlag,\
3434
setCompressionWarnings,\
3535
setNetcdf4Flag, getNetcdf4Flag,\
3636
setNetcdfUseParallelFlag, getNetcdfUseParallelFlag, \
@@ -39,31 +39,31 @@
3939
open = openDataset
4040

4141
# Database functions
42-
from .database import connect, Base, Onelevel, Subtree
42+
from database import connect, Base, Onelevel, Subtree
4343

44-
# Selectors
45-
from . import selectors
46-
from .selectors import longitude, latitude, time, level, required, \
47-
longitudeslice, latitudeslice, levelslice, timeslice
44+
#Selectors
45+
import selectors
46+
from selectors import longitude, latitude, time, level, required, \
47+
longitudeslice, latitudeslice, levelslice, timeslice
4848

49-
from .avariable import order2index, orderparse, setNumericCompatibility, getNumericCompatibility
49+
from avariable import order2index, orderparse, setNumericCompatibility, getNumericCompatibility
5050
# TV
51-
from .tvariable import asVariable, createVariable, isVariable
51+
from tvariable import asVariable, createVariable, isVariable
5252

53-
from .mvSphereMesh import SphereMesh
54-
from .mvBaseWriter import BaseWriter
55-
from .mvVsWriter import VsWriter
56-
from .mvVTKSGWriter import VTKSGWriter
57-
from .mvVTKUGWriter import VTKUGWriter
58-
from .mvCdmsRegrid import CdmsRegrid
53+
from mvSphereMesh import SphereMesh
54+
from mvBaseWriter import BaseWriter
55+
from mvVsWriter import VsWriter
56+
from mvVTKSGWriter import VTKSGWriter
57+
from mvVTKUGWriter import VTKUGWriter
58+
from mvCdmsRegrid import CdmsRegrid
5959

6060
# Gridspec is not installed by default so just pass on if it isn't installed
6161
try:
62-
from .gsStaticVariable import StaticFileVariable
63-
from .gsTimeVariable import TimeFileVariable
62+
from gsStaticVariable import StaticFileVariable
63+
from gsTimeVariable import TimeFileVariable
6464
except:
6565
pass
6666

67-
from .restApi import esgfConnection, esgfDataset, FacetConnection
67+
from restApi import esgfConnection,esgfDataset,FacetConnection
6868

6969
MV = MV2

Packages/cdms2/Lib/auxcoord.py

Lines changed: 29 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,80 +4,62 @@
44
Note: In contrast to Axis objects (concrete classes subclassed from AbstractAxis), auxiliary coordinate variables are not monotonic in value, and do not share a name with the dimension.
55
"""
66

7-
# import internattr
8-
from .error import CDMSError
9-
from .coord import AbstractCoordinateAxis
10-
from .fvariable import FileVariable
11-
from .variable import DatasetVariable
12-
from .tvariable import TransientVariable
13-
from .avariable import AbstractVariable
14-
7+
## import internattr
8+
from error import CDMSError
9+
from coord import AbstractCoordinateAxis
10+
from fvariable import FileVariable
11+
from variable import DatasetVariable
12+
from tvariable import TransientVariable
13+
from avariable import AbstractVariable
1514

1615
class AbstractAuxAxis1D(AbstractCoordinateAxis):
1716

18-
def __init__(self, parent=None, variableNode=None, bounds=None):
19-
AbstractCoordinateAxis.__init__(
20-
self,
21-
parent,
22-
variableNode,
23-
bounds=bounds)
17+
def __init__ (self, parent=None, variableNode=None, bounds=None):
18+
AbstractCoordinateAxis.__init__(self, parent, variableNode, bounds=bounds)
2419

25-
def clone(self, copyData=1):
20+
def clone (self, copyData=1):
2621
"""clone (self, copyData=1)
2722
Return a copy of self as a transient axis.
2823
If copyData is 1, make a separate copy of the data."""
29-
result = TransientAuxAxis1D(
30-
self[:],
31-
copy=copyData,
32-
axes=self.getAxisList(),
33-
attributes=self.attributes,
34-
bounds=self.getBounds())
24+
result = TransientAuxAxis1D(self[:], copy=copyData, axes=self.getAxisList(), attributes=self.attributes, bounds=self.getBounds())
3525
return result
3626

3727
def setBounds(self, bounds):
3828
if bounds is not None:
39-
if len(bounds.shape) != 2:
40-
raise CDMSError('Bounds must have rank=2')
41-
if bounds.shape[0:1] != self.shape:
42-
raise CDMSError(
43-
'Bounds shape %s is inconsistent with axis shape %s' %
44-
(repr(bounds.shape), repr(self.shape)))
29+
if len(bounds.shape)!=2:
30+
raise CDMSError, 'Bounds must have rank=2'
31+
if bounds.shape[0:1]!=self.shape:
32+
raise CDMSError, 'Bounds shape %s is inconsistent with axis shape %s'%(`bounds.shape`,`self.shape`)
4533
AbstractCoordinateAxis.setBounds(self, bounds)
4634

47-
def subSlice(self, *specs, **keys):
35+
def subSlice (self, *specs, **keys):
4836
# Take a subslice, returning a TransientAuxAxis1D
4937
avar = AbstractVariable.subSlice(self, *specs, **keys)
5038
bounds = self.getBounds()
5139
if bounds is None:
5240
newbounds = None
5341
else:
54-
newbounds = bounds[
55-
specs] # bounds can be a numarray or DatasetVariable
42+
newbounds = bounds[specs] # bounds can be a numarray or DatasetVariable
5643

57-
# Note: disable axis copy to preserve identity of grid and variable
58-
# domains
59-
result = TransientAuxAxis1D(avar, bounds=newbounds, copyaxes=0)
44+
# Note: disable axis copy to preserve identity of grid and variable domains
45+
result = TransientAuxAxis1D(avar, bounds=newbounds, copyaxes=0)
6046
return result
6147

62-
6348
class DatasetAuxAxis1D(AbstractAuxAxis1D, DatasetVariable):
6449

6550
# Note: node is a VariableNode
66-
6751
def __init__(self, parent, id=None, variableNode=None, bounds=None):
6852
AbstractAuxAxis1D.__init__(self, parent, variableNode, bounds=bounds)
6953
DatasetVariable.__init__(self, parent, id, variableNode)
7054
self._data_ = None # Cached values
7155

7256
def __repr__(self):
7357
if self.parent is not None:
74-
return "<DatasetAuxAxis1D: %s, file: %s, shape: %s>" % (self.id, self.parent.id, repr(self.shape))
58+
return "<DatasetAuxAxis1D: %s, file: %s, shape: %s>"%(self.id, self.parent.id, `self.shape`)
7559
else:
76-
return "<DatasetAuxAxis1D: %s, file: **CLOSED**>" % self.id
77-
78-
# internattr.initialize_internal_attributes(DatasetAuxAxis1D) # Copy
79-
# internal attrs from parents
60+
return "<DatasetAuxAxis1D: %s, file: **CLOSED**>"%self.id
8061

62+
## internattr.initialize_internal_attributes(DatasetAuxAxis1D) # Copy internal attrs from parents
8163

8264
class FileAuxAxis1D(AbstractAuxAxis1D, FileVariable):
8365

@@ -88,31 +70,27 @@ def __init__(self, parent, id, obj=None, bounds=None):
8870

8971
def __repr__(self):
9072
if self.parent is not None:
91-
return "<FileAuxAxis1D: %s, file: %s, shape: %s>" % (self.id, self.parent.id, repr(self.shape))
73+
return "<FileAuxAxis1D: %s, file: %s, shape: %s>"%(self.id, self.parent.id, `self.shape`)
9274
else:
93-
return "<FileAuxAxis1D: %s, file: **CLOSED**>" % self.id
94-
95-
# internattr.initialize_internal_attributes(FileAuxAxis1D) # Copy internal
96-
# attrs from parents
75+
return "<FileAuxAxis1D: %s, file: **CLOSED**>"%self.id
9776

77+
## internattr.initialize_internal_attributes(FileAuxAxis1D) # Copy internal attrs from parents
9878

9979
class TransientAuxAxis1D(AbstractAuxAxis1D, TransientVariable):
10080

101-
def __init__(
102-
self, data, typecode=None, copy=0, savespace=0, mask=None, fill_value=None,
81+
def __init__(self, data, typecode=None, copy=0, savespace=0, mask=None, fill_value=None,
10382
axes=None, attributes=None, id=None, copyaxes=1, bounds=None):
10483
"""Create a transient, auxiliary 1-D axis.
10584
All arguments are as for TransientVariable.
10685
'bounds' is the bounds array, having shape (m,nvert) where data.shape is (m,) and
10786
nvert is the max number of vertices per cell.
10887
"""
10988
AbstractAuxAxis1D.__init__(self, None, None, bounds=bounds)
110-
TransientVariable.__init__(
111-
self, data, typecode=typecode, copy=copy, savespace=savespace,
89+
TransientVariable.__init__(self, data, typecode=typecode, copy=copy, savespace=savespace,
11290
mask=mask, fill_value=fill_value, axes=axes, attributes=attributes,
11391
id=id, copyaxes=copyaxes)
11492
if axes is not None:
11593
self.setBounds(bounds)
11694

117-
# internattr.initialize_internal_attributes(TransientAuxAxis1D) # Copy
118-
# internal attrs from parents
95+
## internattr.initialize_internal_attributes(TransientAuxAxis1D) # Copy internal attrs from parents
96+

0 commit comments

Comments
 (0)