[cig-commits] r18710 - in cs/spatialdata/trunk: . spatialdata/spatialdb

brad at geodynamics.org brad at geodynamics.org
Thu Jul 7 16:04:05 PDT 2011


Author: brad
Date: 2011-07-07 16:04:05 -0700 (Thu, 07 Jul 2011)
New Revision: 18710

Modified:
   cs/spatialdata/trunk/CHANGES
   cs/spatialdata/trunk/README
   cs/spatialdata/trunk/configure.ac
   cs/spatialdata/trunk/setup.py
   cs/spatialdata/trunk/spatialdata/spatialdb/SCECCVMH.py
   cs/spatialdata/trunk/spatialdata/spatialdb/SimpleIO.py
   cs/spatialdata/trunk/spatialdata/spatialdb/SpatialDBObj.py
Log:
Added validation to insure SimpleDB filename is specified and spatial database label is not the empty string. Set version to 1.7.1.

Modified: cs/spatialdata/trunk/CHANGES
===================================================================
--- cs/spatialdata/trunk/CHANGES	2011-07-07 20:38:33 UTC (rev 18709)
+++ cs/spatialdata/trunk/CHANGES	2011-07-07 23:04:05 UTC (rev 18710)
@@ -1,3 +1,12 @@
+2011/07/07 (version 1.7.1)
+
+  Require labels for spatial databases.
+
+  Check for empty filenames.
+
+  Improve error messages.
+
+
 2011/05/06 (version 0.7.0)
 
   Added check for more than one point in SimpleDB with zero data

Modified: cs/spatialdata/trunk/README
===================================================================
--- cs/spatialdata/trunk/README	2011-07-07 20:38:33 UTC (rev 18709)
+++ cs/spatialdata/trunk/README	2011-07-07 23:04:05 UTC (rev 18710)
@@ -18,11 +18,11 @@
  *
  * @author Brad Aagaard
  * @date 2011/05/06
- * @version 0.7.0
+ * @version 1.7.1
  *
  * @section summary Summary
  *
- * This directory tree contains SpatialData version 0.7.0. This package
+ * This directory tree contains SpatialData version 1.7.1. This package
  * provides an interface to Proj.4 (cartographic projections library)
  * for converting coordinates among a variety of geographic projects
  * and local Cartesian coordinates and defines an interface for

Modified: cs/spatialdata/trunk/configure.ac
===================================================================
--- cs/spatialdata/trunk/configure.ac	2011-07-07 20:38:33 UTC (rev 18709)
+++ cs/spatialdata/trunk/configure.ac	2011-07-07 23:04:05 UTC (rev 18710)
@@ -15,7 +15,7 @@
 #
 
 AC_PREREQ(2.59)
-AC_INIT([spatialdata], [0.7.0], [baagaard at usgs.gov])
+AC_INIT([spatialdata], [1.7.1], [baagaard at usgs.gov])
 AC_CONFIG_HEADER([portinfo])
 AC_CONFIG_AUX_DIR([./aux-config])
 AC_CONFIG_MACRO_DIR([m4])

Modified: cs/spatialdata/trunk/setup.py
===================================================================
--- cs/spatialdata/trunk/setup.py	2011-07-07 20:38:33 UTC (rev 18709)
+++ cs/spatialdata/trunk/setup.py	2011-07-07 23:04:05 UTC (rev 18710)
@@ -20,7 +20,7 @@
 setup(
     
     name = 'spatialdata', 
-    version = '0.7.0',
+    version = '1.7.1',
 
     zip_safe = False,
     packages = find_packages(),

Modified: cs/spatialdata/trunk/spatialdata/spatialdb/SCECCVMH.py
===================================================================
--- cs/spatialdata/trunk/spatialdata/spatialdb/SCECCVMH.py	2011-07-07 20:38:33 UTC (rev 18709)
+++ cs/spatialdata/trunk/spatialdata/spatialdb/SCECCVMH.py	2011-07-07 23:04:05 UTC (rev 18710)
@@ -70,6 +70,11 @@
     squashLimit.meta['tip'] = "Elevation above which topography is squashed."
 
 
+    # Set label if not already done so.
+    if 0 == len(SpatialObj.Inventory.label):
+      SpatialObj.Inventory.label = "SCEC CVM-H"
+
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="sceccvmh"):

Modified: cs/spatialdata/trunk/spatialdata/spatialdb/SimpleIO.py
===================================================================
--- cs/spatialdata/trunk/spatialdata/spatialdb/SimpleIO.py	2011-07-07 20:38:33 UTC (rev 18709)
+++ cs/spatialdata/trunk/spatialdata/spatialdb/SimpleIO.py	2011-07-07 23:04:05 UTC (rev 18710)
@@ -22,6 +22,16 @@
 
 from pyre.components.Component import Component
 
+# Validator for filename
+def validateFilename(value):
+  """
+  Validate filename.
+  """
+  if 0 == len(value):
+    raise ValueError("Filename for spatial database not specified.")
+  return value
+
+
 # SimpleIO class
 class SimpleIO(Component):
   """
@@ -48,7 +58,8 @@
 
     import pyre.inventory
 
-    filename = pyre.inventory.str("filename", default="")
+    filename = pyre.inventory.str("filename", default="", 
+                                  validator=validateFilename)
     filename.meta['tip'] = "Name of database file."
 
 
@@ -69,8 +80,13 @@
     """
     Set members using inventory.
     """
-    Component._configure(self)
-    self.filename(self.inventory.filename)
+    try:
+      Component._configure(self)
+      self.filename(self.inventory.filename)
+    except ValueError as err:
+      aliases = ", ".join(self.aliases)
+      raise ValueError("Error while configuring spatial database reader "
+                       "(%s):\n%s" % (aliases, err.message))
     return
 
 

Modified: cs/spatialdata/trunk/spatialdata/spatialdb/SpatialDBObj.py
===================================================================
--- cs/spatialdata/trunk/spatialdata/spatialdb/SpatialDBObj.py	2011-07-07 20:38:33 UTC (rev 18709)
+++ cs/spatialdata/trunk/spatialdata/spatialdb/SpatialDBObj.py	2011-07-07 23:04:05 UTC (rev 18710)
@@ -23,6 +23,16 @@
 from pyre.components.Component import Component
 from spatialdb import SpatialDB as ModuleSpatialDB
 
+# Validator for label
+def validateLabel(value):
+  """
+  Validate label for group/nodeset/pset.
+  """
+  if 0 == len(value):
+    raise ValueError("Descriptive label for spatial database not specified.")
+  return value
+
+
 # SpatialDBObj class
 class SpatialDBObj(Component, ModuleSpatialDB):
   """
@@ -42,15 +52,16 @@
     ## Python object for managing SpatialDBObj facilities and properties.
     ##
     ## \b Properties
-    ## @li \b label Label of database
+    ## @li \b label Descriprive label for database.
     ##
     ## \b Facilities
     ## @li None
 
     import pyre.inventory
 
-    label = pyre.inventory.str("label", default="spatial database")
-    label.meta['tip'] = "Label of database."
+    label = pyre.inventory.str("label", default="",
+                               validator=validateLabel)
+    label.meta['tip'] = "Descriptive label for database."
 
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
@@ -70,8 +81,13 @@
     """
     Set attributes based on inventory.
     """
-    Component._configure(self)
-    self.label(self.inventory.label)
+    try:
+      Component._configure(self)
+      self.label(self.inventory.label)
+    except ValueError as err:
+      aliases = ", ".join(self.aliases)
+      raise ValueError("Error while configuring spatial database "
+                       "(%s):\n%s" % (aliases, err.message))
     return
   
 



More information about the CIG-COMMITS mailing list