Skip to content

Commit 369e71c

Browse files
committed
Merge branch 'baagaard/fix-uniformdb-errormsg'
* baagaard/fix-uniformdb-errormsg: Update version info. Include spatial database label in error messages. Added UniformDB label to error mesasge.
2 parents 4eb9a85 + 1a47ffd commit 369e71c

File tree

7 files changed

+19
-21
lines changed

7 files changed

+19
-21
lines changed

CHANGES

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
1+
2017/06/19 (version 1.9.9)
22

33
BUGFIX: Improved Python interface to SimpleGridDB to make it
44
possible to write 1-D and 2-D files.
55

6+
Improve validation error messages; some error messages were missing
7+
spatial database label.
8+
69
2017/03/24 (version 1.9.8)
710

811
Added temperature scale to Nondimensional.

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616

1717
AC_PREREQ(2.59)
18-
AC_INIT([spatialdata], [1.9.8], [[email protected]])
18+
AC_INIT([spatialdata], [1.9.9], [[email protected]])
1919
AC_CONFIG_HEADER([portinfo])
2020
AC_CONFIG_AUX_DIR([./aux-config])
2121
AC_CONFIG_MACRO_DIR([m4])

spatialdata/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
##
1919
## @brief Python top-level SpatialData module initialization
2020

21-
__version__ = "1.9.8"
21+
__version__ = "1.9.9"
2222

2323
__all__ = ['geocoords',
2424
'spatialdb',

spatialdata/spatialdb/GravityField.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,11 @@ def _validateParameters(self, params):
102102
Validate parameters.
103103
"""
104104
if (len(params.gravityDir) != 3):
105-
raise ValueError, \
106-
"Gravity direction must be a 3 component list or tuple."
105+
raise ValueError("Gravity direction must be a 3 component list or tuple.")
107106
try:
108107
dirFloat = map(float, params.gravityDir)
109108
except:
110-
raise ValueError, \
111-
"'gravityDir' must contain floating point values."
109+
raise ValueError("Gravity direction must contain floating point values.")
112110
return
113111

114112

spatialdata/spatialdb/SimpleGridDB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def _parseQueryString(self, label):
104104
elif label.lower() == "linear":
105105
value = ModuleSimpleGridDB.LINEAR
106106
else:
107-
raise ValueError("Unknown value for query type '%s'." % label)
107+
raise ValueError("Unknown value for query type '%s' in spatial database %s." % (label, self.label))
108108
return value
109109

110110

spatialdata/spatialdb/SimpleIO.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ def _validateData(self, data):
105105
(numLocs, spaceDim) = data['points'].shape
106106
cs = data['coordsys']
107107
if spaceDim != cs.spaceDim():
108-
raise ValueError, \
109-
"Simple database space-dim (%d) does not agree with spatial "\
110-
"dimension of coordinate system (%d)." % \
111-
(spaceDim, cs.spaceDim())
108+
raise ValueError("Simple database '%s' space-dim (%d) does not agree with spatial "\
109+
"dimension of coordinate system (%d)." % \
110+
(self.label, spaceDim, cs.spaceDim()))
112111
return
113112

114113

spatialdata/spatialdb/UniformDB.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,14 @@ def _validateParameters(self, params):
111111
Validate parameters.
112112
"""
113113
if len(params.values) == 0:
114-
raise ValueError("Values in UniformDB not specified.")
114+
raise ValueError("Values in UniformDB '%s' not specified.", self.inventory.label)
115115
if len(params.data) == 0:
116-
raise ValueError("Data for UniformDB not specified.")
116+
raise ValueError("Data for UniformDB '%s' not specified." % self.inventory.label)
117117
if len(params.values) != len(params.data):
118-
raise ValueError, \
119-
"Incompatible settings for uniform spatial database '%s'.\n"\
120-
"'values' and 'data' must be lists of the same size.\n"\
121-
"'values' has size of %d but 'data' has size of %d." \
122-
% (self.label, len(params.values), len(params.data))
118+
raise ValueError("Incompatible settings for uniform spatial database '%s'.\n"\
119+
"'values' and 'data' must be lists of the same size.\n"\
120+
"'values' has size of %d but 'data' has size of %d." \
121+
% (self.inventory.label, len(params.values), len(params.data)))
123122
try:
124123
for x in params.data:
125124
if len(str(x).split("*")) > 1:
@@ -128,8 +127,7 @@ def _validateParameters(self, params):
128127
else:
129128
dataFloat = float(x)
130129
except:
131-
raise ValueError, \
132-
"'data' list must contain dimensioned or nondimensional values."
130+
raise ValueError("'data' list for UniformDB '%s' must contain dimensioned or nondimensional values." % self.inventory.label)
133131
return
134132

135133

0 commit comments

Comments
 (0)