Index: /anuga_core/source/anuga/anuga_exceptions.py
===================================================================
--- /anuga_core/source/anuga/anuga_exceptions.py	(revision 7743)
+++ /anuga_core/source/anuga/anuga_exceptions.py	(revision 7743)
@@ -0,0 +1,19 @@
+"""Exceptions used by ANUGA
+"""
+
+import exceptions
+
+class TitleError(exceptions.IOError): pass
+class ParsingError(exceptions.IOError): pass
+class ShapeError(exceptions.IOError): pass
+
+class ANUGAError(Exception):
+    def __init__(self, args=None):
+        self.args = args
+
+class DataMissingValuesError(exceptions.Exception): pass
+class DataFileNotOpenError(exceptions.Exception): pass
+class DataTimeError(exceptions.Exception): pass
+class DataDomainError(exceptions.Exception): pass
+class NewQuantity(exceptions.Exception): pass
+class TitleValueError(exceptions.Exception): pass
Index: /anuga_core/source/anuga/damage_modelling/exposure.py
===================================================================
--- /anuga_core/source/anuga/damage_modelling/exposure.py	(revision 7743)
+++ /anuga_core/source/anuga/damage_modelling/exposure.py	(revision 7743)
@@ -0,0 +1,241 @@
+import csv
+
+from anuga.anuga_exceptions import TitleValueError, \
+                                    DataMissingValuesError
+
+from anuga.utilities.file_utils import load_csv_as_dict
+
+from anuga.geospatial_data.geospatial_data import Geospatial_data,\
+     ensure_absolute
+
+LAT_TITLE = 'LATITUDE'
+LONG_TITLE = 'LONGITUDE'
+X_TITLE = 'x'
+Y_TITLE = 'y'
+
+
+
+class Exposure:
+    '''
+    Class for National Exposure Database storage (NEXIS).
+    Returns a csv file handle
+    '''
+    def __init__(self,file_name, latitude_title=LAT_TITLE,
+                 longitude_title=LONG_TITLE, is_x_y_locations=None,
+                 x_title=X_TITLE, y_title=Y_TITLE,
+                 refine_polygon=None, title_check_list=None):
+        """
+        This class is for handling the exposure csv file.
+        It reads the file in and converts the lats and longs to a geospatial
+        data object.
+        Use the methods to read and write columns.
+
+        The format of the csv files it reads is;
+           The first row is a title row.
+           comma's are the delimiters
+           each column is a 'set' of data
+
+        Feel free to use/expand it to read other csv files.
+
+        It is not for adding and deleting rows
+
+        Can geospatial handle string attributes? It's not made for them.
+        Currently it can't load and save string att's.
+
+        So just use geospatial to hold the x, y and georef? Bad, since
+        different att's are in diferent structures.  Not so bad, the info
+        to write if the .csv file is saved is in attribute_dic
+
+        The location info is in the geospatial attribute.
+        """
+
+        self._file_name = file_name
+        self._geospatial = None #
+
+        # self._attribute_dic is a dictionary.
+        #The keys are the column titles.
+        #The values are lists of column data
+
+        # self._title_index_dic is a dictionary.
+        #The keys are the column titles.
+        #The values are the index positions of file columns.
+        self._attribute_dic, self._title_index_dic = \
+            load_csv_as_dict(self._file_name, \
+            title_check_list=title_check_list)
+        try:
+            #Have code here that handles caps or lower
+            lats = self._attribute_dic[latitude_title]
+            longs = self._attribute_dic[longitude_title]
+        except KeyError:
+            # maybe a warning..
+            #Let's see if this works..
+            if False != is_x_y_locations:
+                is_x_y_locations = True
+            pass
+        else:
+            self._geospatial = Geospatial_data(latitudes=lats,
+                                               longitudes=longs)
+
+        if is_x_y_locations is True:
+            if self._geospatial is not None:
+                pass #fixme throw an error
+            try:
+                xs = self._attribute_dic[x_title]
+                ys = self._attribute_dic[y_title]
+                points = [[float(i),float(j)] for i,j in map(None,xs,ys)]
+            except KeyError:
+                # maybe a warning..
+                msg = "Could not find location information."
+                raise TitleValueError, msg
+            else:
+                self._geospatial = Geospatial_data(data_points=points)
+
+        # create a list of points that are in the refining_polygon
+        # described by a list of indexes representing the points
+
+    ##
+    # @brief Create a comparison method.
+    # @param self This object.
+    # @param other The other object.
+    # @return True if objects are 'same'.
+    def __cmp__(self, other):
+        #check that 'other' is an instance of this class
+        if isinstance(self, type(other)):
+            result = cmp(self._attribute_dic, other._attribute_dic)
+            if result <> 0:
+                return result
+
+            # The order of the columns is important. Therefore..
+            result = cmp(self._title_index_dic, other._title_index_dic)
+            if result <> 0:
+                return result
+            for self_ls, other_ls in map(None, self._attribute_dic,
+                                         other._attribute_dic):
+                result = cmp(self._attribute_dic[self_ls],
+                             other._attribute_dic[other_ls])
+                if result <> 0:
+                    return result
+            return 0
+        else:
+            return 1
+
+    ##
+    # @brief Get a list of column values given a column name.
+    # @param column_name The name of the column to get values from.
+    # @param use_refind_polygon Unused??
+    def get_column(self, column_name, use_refind_polygon=False):
+        """
+        Given a column name return a list of the column values
+
+        Note, the type of the values will be String!
+        do this to change a list of strings to a list of floats
+        time = [float(x) for x in time]
+
+        Not implemented:
+        if use_refind_polygon is True, only return values in the
+        refined polygon
+        """
+
+        if not self._attribute_dic.has_key(column_name):
+            msg = 'There is no column called %s!' % column_name
+            raise TitleValueError, msg
+
+        return self._attribute_dic[column_name]
+
+    ##
+    # @brief ??
+    # @param value_column_name ??
+    # @param known_column_name ??
+    # @param known_values ??
+    # @param use_refind_polygon ??
+    def get_value(self, value_column_name, known_column_name,
+                  known_values, use_refind_polygon=False):
+        """
+        Do linear interpolation on the known_colum, using the known_value,
+        to return a value of the column_value_name.
+        """
+
+        pass
+
+    ##
+    # @brief Get a geospatial object that describes the locations.
+    # @param use_refind_polygon Unused??
+    def get_location(self, use_refind_polygon=False):
+        """
+        Return a geospatial object which describes the
+        locations of the location file.
+
+        Note, if there is not location info, this returns None.
+
+        Not implemented:
+        if use_refind_polygon is True, only return values in the
+        refined polygon
+        """
+
+        return self._geospatial
+
+    ##
+    # @brief Add column to 'end' of CSV data.
+    # @param column_name The new column name.
+    # @param column_values The new column values.
+    # @param overwrite If True, overwrites last column, doesn't add at end.
+    def set_column(self, column_name, column_values, overwrite=False):
+        """
+        Add a column to the 'end' (with the right most column being the end)
+        of the csv file.
+
+        Set overwrite to True if you want to overwrite a column.
+
+        Note, in column_name white space is removed and case is not checked.
+        Precondition
+        The column_name and column_values cannot have comma's in it.
+        """
+
+        # sanity checks
+        value_row_count = \
+                len(self._attribute_dic[self._title_index_dic.keys()[0]])
+        if len(column_values) <> value_row_count:
+            msg = 'The number of column values must equal the number of rows.'
+            raise DataMissingValuesError, msg
+
+        # check new column name isn't already used, and we aren't overwriting
+        if self._attribute_dic.has_key(column_name):
+            if not overwrite:
+                msg = 'Column name %s already in use!' % column_name
+                raise TitleValueError, msg
+        else:
+            # New title.  Add it to the title index.
+            self._title_index_dic[column_name] = len(self._title_index_dic)
+
+        self._attribute_dic[column_name] = column_values
+
+    ##
+    # @brief Save the exposure CSV  file.
+    # @param file_name If supplied, use this filename, not original.
+    def save(self, file_name=None):
+        """
+        Save the exposure csv file
+        """
+
+        if file_name is None:
+            file_name = self._file_name
+
+        fd = open(file_name, 'wb')
+        writer = csv.writer(fd)
+
+        #Write the title to a cvs file
+        line = [None] * len(self._title_index_dic)
+        for title in self._title_index_dic.iterkeys():
+            line[self._title_index_dic[title]] = title
+        writer.writerow(line)
+
+        # Write the values to a cvs file
+        value_row_count = \
+                len(self._attribute_dic[self._title_index_dic.keys()[0]])
+        for row_i in range(value_row_count):
+            line = [None] * len(self._title_index_dic)
+            for title in self._title_index_dic.iterkeys():
+                line[self._title_index_dic[title]] = \
+                     self._attribute_dic[title][row_i]
+            writer.writerow(line)
+
Index: /anuga_core/source/anuga/damage_modelling/inundation_damage.py
===================================================================
--- /anuga_core/source/anuga/damage_modelling/inundation_damage.py	(revision 7742)
+++ /anuga_core/source/anuga/damage_modelling/inundation_damage.py	(revision 7743)
@@ -31,5 +31,5 @@
 
 from anuga.utilities.numerical_tools import ensure_numeric
-from anuga.shallow_water.data_manager import Exposure_csv
+from exposure import Exposure
 from anuga.abstract_2d_finite_volumes.util import file_function
 from anuga.geospatial_data.geospatial_data import ensure_absolute
@@ -73,5 +73,5 @@
 
     for exposure_file_in in exposure_files_in:
-        csv = Exposure_csv(exposure_file_in,
+        csv = Exposure(exposure_file_in,
                            title_check_list=[SHORE_DIST_LABEL,WALL_TYPE_LABEL,
                                              STR_VALUE_LABEL,CONT_VALUE_LABEL])
@@ -118,5 +118,5 @@
     """
 
-    csv = Exposure_csv(exposure_file_in)
+    csv = Exposure(exposure_file_in)
     geospatial = csv.get_location()
     max_depths, max_momentums = calc_max_depth_and_momentum(sww_base_name,
Index: /anuga_core/source/anuga/damage_modelling/test_exposure.py
===================================================================
--- /anuga_core/source/anuga/damage_modelling/test_exposure.py	(revision 7743)
+++ /anuga_core/source/anuga/damage_modelling/test_exposure.py	(revision 7743)
@@ -0,0 +1,325 @@
+import csv
+import unittest, os
+import tempfile
+import numpy as num
+import sys
+
+
+from exposure import Exposure
+
+from anuga.anuga_exceptions import TitleValueError, \
+                                    DataMissingValuesError
+
+class Test_Exposure(unittest.TestCase):
+    def test_exposure_csv_loading(self):
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
+115.0, -21.0, splat, 0.0\n\
+114.0, -21.7, pow, 10.0\n\
+114.5, -21.4, bang, 40.0\n")
+        file.close()
+        exposure = Exposure(file_name, title_check_list = ['speed','sound'])
+        exposure.get_column("sound")
+       
+        self.failUnless(exposure._attribute_dic['sound'][2]==' bang',
+                        'FAILED!')
+        self.failUnless(exposure._attribute_dic['speed'][2]==' 40.0',
+                        'FAILED!')
+        
+        os.remove(file_name)
+        
+    def test_exposure_csv_loadingII(self):
+        
+
+        file_name = tempfile.mktemp(".txt")
+        file = open(file_name,"w")
+        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
+115.0, -21.0, splat, 0.0\n\
+114.0, -21.7, pow, 10.0\n\
+114.5, -21.4, bang, 40.0\n")
+        file.close()
+        exposure = Exposure(file_name)
+        exposure.get_column("sound")
+       
+        self.failUnless(exposure._attribute_dic['sound'][2]==' bang',
+                        'FAILED!')
+        self.failUnless(exposure._attribute_dic['speed'][2]==' 40.0',
+                        'FAILED!')
+        
+        os.remove(file_name)
+        
+    def test_exposure_csv_loading_title_check_list(self):
+
+        # I can't get cvs.reader to close the exposure file
+        # The hacks below are to get around this.        
+        if sys.platform == 'win32':
+            file_name = tempfile.gettempdir() + \
+                    "test_exposure_csv_loading_title_check_list.csv"
+        else:
+            file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
+115.0, -21.0, splat, 0.0\n\
+114.0, -21.7, pow, 10.0\n\
+114.5, -21.4, bang, 40.0\n")
+        file.close()
+        try:
+            exposure = Exposure(file_name, title_check_list = ['SOUND'])
+        except IOError:
+            pass
+        else:
+            self.failUnless(0 ==1,  'Assertion not thrown error!')
+            
+        if not sys.platform == 'win32':
+            os.remove(file_name)
+        
+    def test_exposure_csv_cmp(self):
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
+115.0, -21.0, splat, 0.0\n\
+114.0, -21.7, pow, 10.0\n\
+114.5, -21.4, bang, 40.0\n")
+        file.close()
+        
+        e1 = Exposure(file_name)
+        e2 = Exposure(file_name)
+        os.remove(file_name)
+
+        self.failUnless(cmp(e1,e2)==0,
+                        'FAILED!')
+        
+        self.failUnless(cmp(e1,"hey")==1,
+                        'FAILED!')
+        
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        # Note, this has less spaces in the title,
+        # the instances will be the same.
+        file.write("LATITUDE,LONGITUDE ,sound, speed \n\
+115.0, -21.0, splat, 0.0\n\
+114.0, -21.7, pow, 10.0\n\
+114.5, -21.4, bang, 40.0\n")
+        file.close()
+        e3 = Exposure(file_name)
+        os.remove(file_name)
+
+        self.failUnless(cmp(e3,e2)==0,
+                        'FAILED!')
+        
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        # Note, 40 changed to 44 .
+        file.write("LATITUDE,LONGITUDE ,sound, speed \n\
+115.0, -21.0, splat, 0.0\n\
+114.0, -21.7, pow, 10.0\n\
+114.5, -21.4, bang, 44.0\n")
+        file.close()
+        e4 = Exposure(file_name)
+        os.remove(file_name)
+        #print "e4",e4._attribute_dic 
+        #print "e2",e2._attribute_dic 
+        self.failUnless(cmp(e4,e2)<>0,
+                        'FAILED!')
+        
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        # Note, the first two columns are swapped.
+        file.write("LONGITUDE,LATITUDE ,sound, speed \n\
+ -21.0,115.0, splat, 0.0\n\
+ -21.7,114.0, pow, 10.0\n\
+ -21.4,114.5, bang, 40.0\n")
+        file.close()
+        e5 = Exposure(file_name)
+        os.remove(file_name)
+
+        self.failUnless(cmp(e3,e5)<>0,
+                        'FAILED!')
+        
+    def test_exposure_csv_saving(self):
+        
+
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
+115.0, -21.0, splat, 0.0\n\
+114.0, -21.7, pow, 10.0\n\
+114.5, -21.4, bang, 40.0\n")
+        file.close()
+        e1 = Exposure(file_name)
+        
+        file_name2 = tempfile.mktemp(".csv")
+        e1.save(file_name = file_name2)
+        e2 = Exposure(file_name2)
+       
+        self.failUnless(cmp(e1,e2)==0,
+                        'FAILED!')
+        os.remove(file_name)
+        os.remove(file_name2)
+
+    def test_exposure_csv_get_location(self):
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("LONGITUDE , LATITUDE, sound  , speed \n\
+150.916666667, -34.5, splat, 0.0\n\
+150.0, -34.0, pow, 10.0\n")
+        file.close()
+        e1 = Exposure(file_name)
+
+        gsd = e1.get_location()
+        
+        points = gsd.get_data_points(absolute=True)
+        
+        assert num.allclose(points[0][0], 308728.009)
+        assert num.allclose(points[0][1], 6180432.601)
+        assert num.allclose(points[1][0],  222908.705)
+        assert num.allclose(points[1][1], 6233785.284)
+        self.failUnless(gsd.get_geo_reference().get_zone() == 56,
+                        'Bad zone error!')
+
+        os.remove(file_name)
+        
+    def test_exposure_csv_set_column_get_column(self):
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("LONGITUDE , LATITUDE, sound  , speed \n\
+150.916666667, -34.5, splat, 0.0\n\
+150.0, -34.0, pow, 10.0\n")
+        file.close()
+        e1 = Exposure(file_name)      
+        os.remove(file_name)
+
+        new_title = "feast"
+        new_values = ["chicken","soup"]
+        e1.set_column(new_title, new_values)
+        returned_values = e1.get_column(new_title)
+        self.failUnless(returned_values == new_values,
+                        ' Error!')
+        
+        file_name2 = tempfile.mktemp(".csv")
+        e1.save(file_name = file_name2)
+        e2 = Exposure(file_name2)
+        returned_values = e2.get_column(new_title)
+        self.failUnless(returned_values == new_values,
+                        ' Error!')       
+        os.remove(file_name2)
+
+    def test_exposure_csv_set_column_get_column_error_checking(self):
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("LONGITUDE , LATITUDE, sound  , speed \n\
+150.916666667, -34.5, splat, 0.0\n\
+150.0, -34.0, pow, 10.0\n")
+        file.close()
+        e1 = Exposure(file_name)      
+        os.remove(file_name)
+
+        new_title = "sound"
+        new_values = [12.5,7.6]
+        try:
+            e1.set_column(new_title, new_values)
+        except TitleValueError:
+            pass
+        else:
+            self.failUnless(0 ==1,  'Error not thrown error!')
+            
+        e1.set_column(new_title, new_values, overwrite=True)
+        returned_values = e1.get_column(new_title)
+        self.failUnless(returned_values == new_values,
+                        ' Error!')       
+        
+        new2_title = "short list"
+        new2_values = [12.5]
+        try:
+            e1.set_column(new2_title, new2_values)
+        except DataMissingValuesError:
+            pass
+        else:
+            self.failUnless(0 ==1,  'Error not thrown error!')
+            
+        new2_title = "long list"
+        new2_values = [12.5, 7,8]
+        try:
+            e1.set_column(new2_title, new2_values)
+        except DataMissingValuesError:
+            pass
+        else:
+            self.failUnless(0 ==1,  'Error not thrown error!')
+        file_name2 = tempfile.mktemp(".csv")
+        e1.save(file_name = file_name2)
+        e2 = Exposure(file_name2)
+        returned_values = e2.get_column(new_title)
+        for returned, new in map(None, returned_values, new_values):
+            self.failUnless(returned == str(new), ' Error!')
+        #self.failUnless(returned_values == new_values, ' Error!')       
+        os.remove(file_name2)
+        
+        try:
+            e1.get_column("toe jam")
+        except TitleValueError:
+            pass
+        else:
+            self.failUnless(0 ==1,  'Error not thrown error!')
+            
+    def test_exposure_csv_loading_x_y(self):
+        
+
+        file_name = tempfile.mktemp(".csv")
+        file = open(file_name,"w")
+        file.write("x, y ,sound  , speed \n\
+115.0, 7, splat, 0.0\n\
+114.0, 8.0, pow, 10.0\n\
+114.5, 9., bang, 40.0\n")
+        file.close()
+        e1 = Exposure(file_name, is_x_y_locations=True)
+        gsd = e1.get_location()
+        
+        points = gsd.get_data_points(absolute=True)
+        
+        assert num.allclose(points[0][0], 115)
+        assert num.allclose(points[0][1], 7)
+        assert num.allclose(points[1][0], 114)
+        assert num.allclose(points[1][1], 8)
+        assert num.allclose(points[2][0], 114.5)
+        assert num.allclose(points[2][1], 9)
+        self.failUnless(gsd.get_geo_reference().get_zone() == -1,
+                        'Bad zone error!')
+
+        os.remove(file_name)
+
+           
+    def test_exposure_csv_loading_x_y2(self):
+        
+        csv_file = tempfile.mktemp(".csv")
+        fd = open(csv_file,'wb')
+        writer = csv.writer(fd)
+        writer.writerow(['x','y','STR_VALUE','C_VALUE','ROOF_TYPE','WALLS', 'SHORE_DIST'])
+        writer.writerow([5.5,0.5,'199770','130000','Metal','Timber',20])
+        writer.writerow([4.5,1.0,'150000','76000','Metal','Double Brick',20])
+        writer.writerow([4.5,1.5,'150000','76000','Metal','Brick Veneer',20])
+        fd.close()
+
+        e1 = Exposure(csv_file)
+        gsd = e1.get_location()
+        
+        points = gsd.get_data_points(absolute=True)
+        assert num.allclose(points[0][0], 5.5)
+        assert num.allclose(points[0][1], 0.5)
+        assert num.allclose(points[1][0], 4.5)
+        assert num.allclose(points[1][1], 1.0)
+        assert num.allclose(points[2][0], 4.5)
+        assert num.allclose(points[2][1], 1.5)
+        self.failUnless(gsd.get_geo_reference().get_zone() == -1,
+                        'Bad zone error!')
+
+        os.remove(csv_file)
+
+
+#-------------------------------------------------------------
+
+if __name__ == "__main__":
+    suite = unittest.makeSuite(Test_Exposure,'test')
+    runner = unittest.TextTestRunner()
+    runner.run(suite)
+
Index: /anuga_core/source/anuga/damage_modelling/test_inundation_damage.py
===================================================================
--- /anuga_core/source/anuga/damage_modelling/test_inundation_damage.py	(revision 7742)
+++ /anuga_core/source/anuga/damage_modelling/test_inundation_damage.py	(revision 7743)
@@ -305,5 +305,5 @@
         inundation_damage(sww_file, csv_file, verbose=False)
 
-        csv_handle = Exposure_csv(csv_file)
+        csv_handle = Exposure(csv_file)
         struct_loss = csv_handle.get_column(EventDamageModel.STRUCT_LOSS_TITLE)
         #print "struct_loss",struct_loss
@@ -392,5 +392,5 @@
 
         # Test one file
-        csv_handle = Exposure_csv(csv_file[:-4]+marker+extension)
+        csv_handle = Exposure(csv_file[:-4]+marker+extension)
         struct_loss = csv_handle.get_column(EventDamageModel.STRUCT_LOSS_TITLE)
         #print "struct_loss",struct_loss
@@ -403,5 +403,5 @@
        
         # Test another file
-        csv_handle = Exposure_csv(csv_fileII[:-4]+marker+extension)
+        csv_handle = Exposure(csv_fileII[:-4]+marker+extension)
         struct_loss = csv_handle.get_column(EventDamageModel.STRUCT_LOSS_TITLE)
         #print "struct_loss",struct_loss
Index: /anuga_core/source/anuga/file_conversion/ferret2sww.py
===================================================================
--- /anuga_core/source/anuga/file_conversion/ferret2sww.py	(revision 7742)
+++ /anuga_core/source/anuga/file_conversion/ferret2sww.py	(revision 7743)
@@ -14,5 +14,5 @@
 
 #local modules
-from file_conversion import get_min_max_indexes                            
+from anuga.file_conversion.file_conversion import get_min_max_indices                            
 
 
@@ -97,5 +97,5 @@
     longitudes = file_h.variables[dim_h_longitude]
 
-    kmin, kmax, lmin, lmax = get_min_max_indexes(latitudes[:],
+    kmin, kmax, lmin, lmax = get_min_max_indices(latitudes[:],
                                                   longitudes[:],
                                                   minlat, maxlat,
@@ -153,5 +153,5 @@
         jmax = int(jmax)        
 
-    kmin, kmax, lmin, lmax = get_min_max_indexes(latitudes[:],
+    kmin, kmax, lmin, lmax = get_min_max_indices(latitudes[:],
                                                   longitudes[:],
                                                   minlat, maxlat,
Index: /anuga_core/source/anuga/file_conversion/file_conversion.py
===================================================================
--- /anuga_core/source/anuga/file_conversion/file_conversion.py	(revision 7742)
+++ /anuga_core/source/anuga/file_conversion/file_conversion.py	(revision 7743)
@@ -416,5 +416,5 @@
     latitudes.reverse()
 
-    kmin, kmax, lmin, lmax = get_min_max_indexes(latitudes[:],longitudes[:],
+    kmin, kmax, lmin, lmax = get_min_max_indices(latitudes[:],longitudes[:],
                                                   minlat=minlat, maxlat=maxlat,
                                                   minlon=minlon, maxlon=maxlon)
@@ -890,5 +890,5 @@
 # @param maxlon Maximum longitude of specified area.
 # @return Tuple (lat_min_index, lat_max_index, lon_min_index, lon_max_index)
-def get_min_max_indexes(latitudes_ref, longitudes_ref,
+def get_min_max_indices(latitudes_ref, longitudes_ref,
                          minlat=None, maxlat=None,
                          minlon=None, maxlon=None):
Index: /anuga_core/source/anuga/file_conversion/test_file_conversion.py
===================================================================
--- /anuga_core/source/anuga/file_conversion/test_file_conversion.py	(revision 7742)
+++ /anuga_core/source/anuga/file_conversion/test_file_conversion.py	(revision 7743)
@@ -1597,5 +1597,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -10,4,-10,31)
@@ -1612,5 +1612,5 @@
 
         ## 2nd test
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             0.5,2.5,5,25)
@@ -1627,5 +1627,5 @@
 
         ## 3rd test
-        kmin, kmax, lmin, lmax = get_min_max_indexes(\
+        kmin, kmax, lmin, lmax = get_min_max_indices(\
             latitudes,
             longitudes,
@@ -1644,5 +1644,5 @@
 
         ## 4th test
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
                                                       -0.1,1.9,-2,17)
@@ -1658,5 +1658,5 @@
                          'failed')
         ## 5th test
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             0.1,1.9,2,17)
@@ -1674,5 +1674,5 @@
         ## 6th test
 
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             1.5,4,18,32)
@@ -1691,5 +1691,5 @@
         ## 7th test
         m2d = num.array([[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]], num.int)    #array default#
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             1.5,1.5,15,15)
@@ -1715,5 +1715,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -10,4,-10,31)
@@ -1730,5 +1730,5 @@
 
         ## 3rd test
-        kmin, kmax, lmin, lmax = get_min_max_indexes(\
+        kmin, kmax, lmin, lmax = get_min_max_indices(\
             latitudes,
             longitudes,
@@ -1753,5 +1753,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -37,-27,147,149.5)
@@ -1782,5 +1782,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -43,-37,148.5,149.5)
@@ -1806,5 +1806,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes)
 
Index: /anuga_core/source/anuga/shallow_water/data_manager.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 7742)
+++ /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 7743)
@@ -54,5 +54,4 @@
 import os, sys
 import csv
-import exceptions
 import string
 import shutil
@@ -80,5 +79,4 @@
 from anuga.utilities.numerical_tools import ensure_numeric,  mean
 from anuga.caching.caching import myhash
-from anuga.utilities.anuga_exceptions import ANUGAError
 from anuga.shallow_water import Domain
 from anuga.abstract_2d_finite_volumes.pmesh2domain import \
@@ -98,18 +96,11 @@
 from sww_file import Read_sww, Write_sww
 
+from anuga.anuga_exceptions import DataMissingValuesError, \
+                DataFileNotOpenError, DataTimeError, DataDomainError, \
+                NewQuantity
+
 
 # Default block size for sww2dem()
 DEFAULT_BLOCK_SIZE = 10000
-
-######
-# Exception classes
-######
-
-class TitleValueError(exceptions.Exception): pass
-class DataMissingValuesError(exceptions.Exception): pass
-class DataFileNotOpenError(exceptions.Exception): pass
-class DataTimeError(exceptions.Exception): pass
-class DataDomainError(exceptions.Exception): pass
-class NewQuantity(exceptions.Exception): pass
 
 
@@ -124,242 +115,5 @@
 
 
-##
-# @brief Class for National Exposure Database storage (NEXIS).
-
-LAT_TITLE = 'LATITUDE'
-LONG_TITLE = 'LONGITUDE'
-X_TITLE = 'x'
-Y_TITLE = 'y'
-
-class Exposure_csv:
-
-    ##
-    # @brief Instantiate this instance.
-    # @param file_name Name of underlying data file.
-    # @param latitude_title ??
-    # @param longitude_title ??
-    # @param is_x_y_locations ??
-    # @param x_title ??
-    # @param y_title ??
-    # @param refine_polygon ??
-    # @param title_check_list ??
-    def __init__(self,file_name, latitude_title=LAT_TITLE,
-                 longitude_title=LONG_TITLE, is_x_y_locations=None,
-                 x_title=X_TITLE, y_title=Y_TITLE,
-                 refine_polygon=None, title_check_list=None):
-        """
-        This class is for handling the exposure csv file.
-        It reads the file in and converts the lats and longs to a geospatial
-        data object.
-        Use the methods to read and write columns.
-
-        The format of the csv files it reads is;
-           The first row is a title row.
-           comma's are the delimiters
-           each column is a 'set' of data
-
-        Feel free to use/expand it to read other csv files.
-
-        It is not for adding and deleting rows
-
-        Can geospatial handle string attributes? It's not made for them.
-        Currently it can't load and save string att's.
-
-        So just use geospatial to hold the x, y and georef? Bad, since
-        different att's are in diferent structures.  Not so bad, the info
-        to write if the .csv file is saved is in attribute_dic
-
-        The location info is in the geospatial attribute.
-        """
-
-        self._file_name = file_name
-        self._geospatial = None #
-
-        # self._attribute_dic is a dictionary.
-        #The keys are the column titles.
-        #The values are lists of column data
-
-        # self._title_index_dic is a dictionary.
-        #The keys are the column titles.
-        #The values are the index positions of file columns.
-        self._attribute_dic, self._title_index_dic = \
-            load_csv_as_dict(self._file_name, \
-            title_check_list=title_check_list)
-        try:
-            #Have code here that handles caps or lower
-            lats = self._attribute_dic[latitude_title]
-            longs = self._attribute_dic[longitude_title]
-        except KeyError:
-            # maybe a warning..
-            #Let's see if this works..
-            if False != is_x_y_locations:
-                is_x_y_locations = True
-            pass
-        else:
-            self._geospatial = Geospatial_data(latitudes=lats,
-                                               longitudes=longs)
-
-        if is_x_y_locations is True:
-            if self._geospatial is not None:
-                pass #fixme throw an error
-            try:
-                xs = self._attribute_dic[x_title]
-                ys = self._attribute_dic[y_title]
-                points = [[float(i),float(j)] for i,j in map(None,xs,ys)]
-            except KeyError:
-                # maybe a warning..
-                msg = "Could not find location information."
-                raise TitleValueError, msg
-            else:
-                self._geospatial = Geospatial_data(data_points=points)
-
-        # create a list of points that are in the refining_polygon
-        # described by a list of indexes representing the points
-
-    ##
-    # @brief Create a comparison method.
-    # @param self This object.
-    # @param other The other object.
-    # @return True if objects are 'same'.
-    def __cmp__(self, other):
-        #check that 'other' is an instance of this class
-        if isinstance(self, type(other)):
-            result = cmp(self._attribute_dic, other._attribute_dic)
-            if result <> 0:
-                return result
-
-            # The order of the columns is important. Therefore..
-            result = cmp(self._title_index_dic, other._title_index_dic)
-            if result <> 0:
-                return result
-            for self_ls, other_ls in map(None, self._attribute_dic,
-                                         other._attribute_dic):
-                result = cmp(self._attribute_dic[self_ls],
-                             other._attribute_dic[other_ls])
-                if result <> 0:
-                    return result
-            return 0
-        else:
-            return 1
-
-    ##
-    # @brief Get a list of column values given a column name.
-    # @param column_name The name of the column to get values from.
-    # @param use_refind_polygon Unused??
-    def get_column(self, column_name, use_refind_polygon=False):
-        """
-        Given a column name return a list of the column values
-
-        Note, the type of the values will be String!
-        do this to change a list of strings to a list of floats
-        time = [float(x) for x in time]
-
-        Not implemented:
-        if use_refind_polygon is True, only return values in the
-        refined polygon
-        """
-
-        if not self._attribute_dic.has_key(column_name):
-            msg = 'There is no column called %s!' % column_name
-            raise TitleValueError, msg
-
-        return self._attribute_dic[column_name]
-
-    ##
-    # @brief ??
-    # @param value_column_name ??
-    # @param known_column_name ??
-    # @param known_values ??
-    # @param use_refind_polygon ??
-    def get_value(self, value_column_name, known_column_name,
-                  known_values, use_refind_polygon=False):
-        """
-        Do linear interpolation on the known_colum, using the known_value,
-        to return a value of the column_value_name.
-        """
-
-        pass
-
-    ##
-    # @brief Get a geospatial object that describes the locations.
-    # @param use_refind_polygon Unused??
-    def get_location(self, use_refind_polygon=False):
-        """
-        Return a geospatial object which describes the
-        locations of the location file.
-
-        Note, if there is not location info, this returns None.
-
-        Not implemented:
-        if use_refind_polygon is True, only return values in the
-        refined polygon
-        """
-
-        return self._geospatial
-
-    ##
-    # @brief Add column to 'end' of CSV data.
-    # @param column_name The new column name.
-    # @param column_values The new column values.
-    # @param overwrite If True, overwrites last column, doesn't add at end.
-    def set_column(self, column_name, column_values, overwrite=False):
-        """
-        Add a column to the 'end' (with the right most column being the end)
-        of the csv file.
-
-        Set overwrite to True if you want to overwrite a column.
-
-        Note, in column_name white space is removed and case is not checked.
-        Precondition
-        The column_name and column_values cannot have comma's in it.
-        """
-
-        # sanity checks
-        value_row_count = \
-                len(self._attribute_dic[self._title_index_dic.keys()[0]])
-        if len(column_values) <> value_row_count:
-            msg = 'The number of column values must equal the number of rows.'
-            raise DataMissingValuesError, msg
-
-        # check new column name isn't already used, and we aren't overwriting
-        if self._attribute_dic.has_key(column_name):
-            if not overwrite:
-                msg = 'Column name %s already in use!' % column_name
-                raise TitleValueError, msg
-        else:
-            # New title.  Add it to the title index.
-            self._title_index_dic[column_name] = len(self._title_index_dic)
-
-        self._attribute_dic[column_name] = column_values
-
-    ##
-    # @brief Save the exposure CSV  file.
-    # @param file_name If supplied, use this filename, not original.
-    def save(self, file_name=None):
-        """
-        Save the exposure csv file
-        """
-
-        if file_name is None:
-            file_name = self._file_name
-
-        fd = open(file_name, 'wb')
-        writer = csv.writer(fd)
-
-        #Write the title to a cvs file
-        line = [None] * len(self._title_index_dic)
-        for title in self._title_index_dic.iterkeys():
-            line[self._title_index_dic[title]] = title
-        writer.writerow(line)
-
-        # Write the values to a cvs file
-        value_row_count = \
-                len(self._attribute_dic[self._title_index_dic.keys()[0]])
-        for row_i in range(value_row_count):
-            line = [None] * len(self._title_index_dic)
-            for title in self._title_index_dic.iterkeys():
-                line[self._title_index_dic[title]] = \
-                     self._attribute_dic[title][row_i]
-            writer.writerow(line)
+
 
 
Index: /anuga_core/source/anuga/shallow_water/data_manager_joaquims_patch.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/data_manager_joaquims_patch.py	(revision 7742)
+++ /anuga_core/source/anuga/shallow_water/data_manager_joaquims_patch.py	(revision 7743)
@@ -2716,5 +2716,5 @@
     #print "latitudes[:]",latitudes[:]
     #print "longitudes[:]",longitudes [:]
-    kmin, kmax, lmin, lmax = _get_min_max_indexes(latitudes[:],
+    kmin, kmax, lmin, lmax = get_min_max_indices(latitudes[:],
                                                   longitudes[:],
                                                   minlat, maxlat,
@@ -3649,5 +3649,5 @@
     latitudes.reverse()
 
-    kmin, kmax, lmin, lmax = _get_min_max_indexes(latitudes[:],longitudes[:],
+    kmin, kmax, lmin, lmax = get_min_max_indices(latitudes[:],longitudes[:],
                                                  minlat=minlat, maxlat=maxlat,
                                                  minlon=minlon, maxlon=maxlon)
@@ -3850,5 +3850,5 @@
     outfile.close()
 
-def _get_min_max_indexes(latitudes_ref,longitudes_ref,
+def get_min_max_indices(latitudes_ref,longitudes_ref,
                         minlat=None, maxlat=None,
                         minlon=None, maxlon=None):
Index: /anuga_core/source/anuga/shallow_water/test_data_manager.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 7742)
+++ /anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 7743)
@@ -25,5 +25,5 @@
 from anuga.utilities.system_tools import get_pathname_from_package
 from anuga.utilities.file_utils import del_dir, load_csv_as_dict
-from anuga.utilities.anuga_exceptions import ANUGAError
+from anuga.anuga_exceptions import ANUGAError
 from anuga.utilities.numerical_tools import ensure_numeric, mean
 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a
@@ -3404,310 +3404,4 @@
         os.remove(filename)
 
-
-
-########## testing nbed class ##################
-    def test_exposure_csv_loading(self):
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
-115.0, -21.0, splat, 0.0\n\
-114.0, -21.7, pow, 10.0\n\
-114.5, -21.4, bang, 40.0\n")
-        file.close()
-        exposure = Exposure_csv(file_name, title_check_list = ['speed','sound'])
-        exposure.get_column("sound")
-       
-        self.failUnless(exposure._attribute_dic['sound'][2]==' bang',
-                        'FAILED!')
-        self.failUnless(exposure._attribute_dic['speed'][2]==' 40.0',
-                        'FAILED!')
-        
-        os.remove(file_name)
-        
-    def test_exposure_csv_loadingII(self):
-        
-
-        file_name = tempfile.mktemp(".txt")
-        file = open(file_name,"w")
-        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
-115.0, -21.0, splat, 0.0\n\
-114.0, -21.7, pow, 10.0\n\
-114.5, -21.4, bang, 40.0\n")
-        file.close()
-        exposure = Exposure_csv(file_name)
-        exposure.get_column("sound")
-       
-        self.failUnless(exposure._attribute_dic['sound'][2]==' bang',
-                        'FAILED!')
-        self.failUnless(exposure._attribute_dic['speed'][2]==' 40.0',
-                        'FAILED!')
-        
-        os.remove(file_name)
-        
-    def test_exposure_csv_loading_title_check_list(self):
-
-        # I can't get cvs.reader to close the exposure file
-        # The hacks below are to get around this.        
-        if sys.platform == 'win32':
-            file_name = tempfile.gettempdir() + \
-                    "test_exposure_csv_loading_title_check_list.csv"
-        else:
-            file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
-115.0, -21.0, splat, 0.0\n\
-114.0, -21.7, pow, 10.0\n\
-114.5, -21.4, bang, 40.0\n")
-        file.close()
-        try:
-            exposure = Exposure_csv(file_name, title_check_list = ['SOUND'])
-        except IOError:
-            pass
-        else:
-            self.failUnless(0 ==1,  'Assertion not thrown error!')
-            
-        if not sys.platform == 'win32':
-            os.remove(file_name)
-        
-    def test_exposure_csv_cmp(self):
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
-115.0, -21.0, splat, 0.0\n\
-114.0, -21.7, pow, 10.0\n\
-114.5, -21.4, bang, 40.0\n")
-        file.close()
-        
-        e1 = Exposure_csv(file_name)
-        e2 = Exposure_csv(file_name)
-        os.remove(file_name)
-
-        self.failUnless(cmp(e1,e2)==0,
-                        'FAILED!')
-        
-        self.failUnless(cmp(e1,"hey")==1,
-                        'FAILED!')
-        
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        # Note, this has less spaces in the title,
-        # the instances will be the same.
-        file.write("LATITUDE,LONGITUDE ,sound, speed \n\
-115.0, -21.0, splat, 0.0\n\
-114.0, -21.7, pow, 10.0\n\
-114.5, -21.4, bang, 40.0\n")
-        file.close()
-        e3 = Exposure_csv(file_name)
-        os.remove(file_name)
-
-        self.failUnless(cmp(e3,e2)==0,
-                        'FAILED!')
-        
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        # Note, 40 changed to 44 .
-        file.write("LATITUDE,LONGITUDE ,sound, speed \n\
-115.0, -21.0, splat, 0.0\n\
-114.0, -21.7, pow, 10.0\n\
-114.5, -21.4, bang, 44.0\n")
-        file.close()
-        e4 = Exposure_csv(file_name)
-        os.remove(file_name)
-        #print "e4",e4._attribute_dic 
-        #print "e2",e2._attribute_dic 
-        self.failUnless(cmp(e4,e2)<>0,
-                        'FAILED!')
-        
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        # Note, the first two columns are swapped.
-        file.write("LONGITUDE,LATITUDE ,sound, speed \n\
- -21.0,115.0, splat, 0.0\n\
- -21.7,114.0, pow, 10.0\n\
- -21.4,114.5, bang, 40.0\n")
-        file.close()
-        e5 = Exposure_csv(file_name)
-        os.remove(file_name)
-
-        self.failUnless(cmp(e3,e5)<>0,
-                        'FAILED!')
-        
-    def test_exposure_csv_saving(self):
-        
-
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("LATITUDE, LONGITUDE ,sound  , speed \n\
-115.0, -21.0, splat, 0.0\n\
-114.0, -21.7, pow, 10.0\n\
-114.5, -21.4, bang, 40.0\n")
-        file.close()
-        e1 = Exposure_csv(file_name)
-        
-        file_name2 = tempfile.mktemp(".csv")
-        e1.save(file_name = file_name2)
-        e2 = Exposure_csv(file_name2)
-       
-        self.failUnless(cmp(e1,e2)==0,
-                        'FAILED!')
-        os.remove(file_name)
-        os.remove(file_name2)
-
-    def test_exposure_csv_get_location(self):
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("LONGITUDE , LATITUDE, sound  , speed \n\
-150.916666667, -34.5, splat, 0.0\n\
-150.0, -34.0, pow, 10.0\n")
-        file.close()
-        e1 = Exposure_csv(file_name)
-
-        gsd = e1.get_location()
-        
-        points = gsd.get_data_points(absolute=True)
-        
-        assert num.allclose(points[0][0], 308728.009)
-        assert num.allclose(points[0][1], 6180432.601)
-        assert num.allclose(points[1][0],  222908.705)
-        assert num.allclose(points[1][1], 6233785.284)
-        self.failUnless(gsd.get_geo_reference().get_zone() == 56,
-                        'Bad zone error!')
-
-        os.remove(file_name)
-        
-    def test_exposure_csv_set_column_get_column(self):
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("LONGITUDE , LATITUDE, sound  , speed \n\
-150.916666667, -34.5, splat, 0.0\n\
-150.0, -34.0, pow, 10.0\n")
-        file.close()
-        e1 = Exposure_csv(file_name)      
-        os.remove(file_name)
-
-        new_title = "feast"
-        new_values = ["chicken","soup"]
-        e1.set_column(new_title, new_values)
-        returned_values = e1.get_column(new_title)
-        self.failUnless(returned_values == new_values,
-                        ' Error!')
-        
-        file_name2 = tempfile.mktemp(".csv")
-        e1.save(file_name = file_name2)
-        e2 = Exposure_csv(file_name2)
-        returned_values = e2.get_column(new_title)
-        self.failUnless(returned_values == new_values,
-                        ' Error!')       
-        os.remove(file_name2)
-
-    def test_exposure_csv_set_column_get_column_error_checking(self):
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("LONGITUDE , LATITUDE, sound  , speed \n\
-150.916666667, -34.5, splat, 0.0\n\
-150.0, -34.0, pow, 10.0\n")
-        file.close()
-        e1 = Exposure_csv(file_name)      
-        os.remove(file_name)
-
-        new_title = "sound"
-        new_values = [12.5,7.6]
-        try:
-            e1.set_column(new_title, new_values)
-        except TitleValueError:
-            pass
-        else:
-            self.failUnless(0 ==1,  'Error not thrown error!')
-            
-        e1.set_column(new_title, new_values, overwrite=True)
-        returned_values = e1.get_column(new_title)
-        self.failUnless(returned_values == new_values,
-                        ' Error!')       
-        
-        new2_title = "short list"
-        new2_values = [12.5]
-        try:
-            e1.set_column(new2_title, new2_values)
-        except DataMissingValuesError:
-            pass
-        else:
-            self.failUnless(0 ==1,  'Error not thrown error!')
-            
-        new2_title = "long list"
-        new2_values = [12.5, 7,8]
-        try:
-            e1.set_column(new2_title, new2_values)
-        except DataMissingValuesError:
-            pass
-        else:
-            self.failUnless(0 ==1,  'Error not thrown error!')
-        file_name2 = tempfile.mktemp(".csv")
-        e1.save(file_name = file_name2)
-        e2 = Exposure_csv(file_name2)
-        returned_values = e2.get_column(new_title)
-        for returned, new in map(None, returned_values, new_values):
-            self.failUnless(returned == str(new), ' Error!')
-        #self.failUnless(returned_values == new_values, ' Error!')       
-        os.remove(file_name2)
-        
-        try:
-            e1.get_column("toe jam")
-        except TitleValueError:
-            pass
-        else:
-            self.failUnless(0 ==1,  'Error not thrown error!')
-            
-    def test_exposure_csv_loading_x_y(self):
-        
-
-        file_name = tempfile.mktemp(".csv")
-        file = open(file_name,"w")
-        file.write("x, y ,sound  , speed \n\
-115.0, 7, splat, 0.0\n\
-114.0, 8.0, pow, 10.0\n\
-114.5, 9., bang, 40.0\n")
-        file.close()
-        e1 = Exposure_csv(file_name, is_x_y_locations=True)
-        gsd = e1.get_location()
-        
-        points = gsd.get_data_points(absolute=True)
-        
-        assert num.allclose(points[0][0], 115)
-        assert num.allclose(points[0][1], 7)
-        assert num.allclose(points[1][0], 114)
-        assert num.allclose(points[1][1], 8)
-        assert num.allclose(points[2][0], 114.5)
-        assert num.allclose(points[2][1], 9)
-        self.failUnless(gsd.get_geo_reference().get_zone() == -1,
-                        'Bad zone error!')
-
-        os.remove(file_name)
-
-           
-    def test_exposure_csv_loading_x_y2(self):
-        
-        csv_file = tempfile.mktemp(".csv")
-        fd = open(csv_file,'wb')
-        writer = csv.writer(fd)
-        writer.writerow(['x','y','STR_VALUE','C_VALUE','ROOF_TYPE','WALLS', 'SHORE_DIST'])
-        writer.writerow([5.5,0.5,'199770','130000','Metal','Timber',20])
-        writer.writerow([4.5,1.0,'150000','76000','Metal','Double Brick',20])
-        writer.writerow([4.5,1.5,'150000','76000','Metal','Brick Veneer',20])
-        fd.close()
-
-        e1 = Exposure_csv(csv_file)
-        gsd = e1.get_location()
-        
-        points = gsd.get_data_points(absolute=True)
-        assert num.allclose(points[0][0], 5.5)
-        assert num.allclose(points[0][1], 0.5)
-        assert num.allclose(points[1][0], 4.5)
-        assert num.allclose(points[1][1], 1.0)
-        assert num.allclose(points[2][0], 4.5)
-        assert num.allclose(points[2][1], 1.5)
-        self.failUnless(gsd.get_geo_reference().get_zone() == -1,
-                        'Bad zone error!')
-
-        os.remove(csv_file)
 
     #### TESTS FOR URS 2 SWW  ###     
Index: /anuga_core/source/anuga/shallow_water/test_file_conversion.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/test_file_conversion.py	(revision 7742)
+++ /anuga_core/source/anuga/shallow_water/test_file_conversion.py	(revision 7743)
@@ -1597,5 +1597,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -10,4,-10,31)
@@ -1612,5 +1612,5 @@
 
         ## 2nd test
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             0.5,2.5,5,25)
@@ -1627,5 +1627,5 @@
 
         ## 3rd test
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(\
+        kmin, kmax, lmin, lmax = get_min_max_indices(\
             latitudes,
             longitudes,
@@ -1644,5 +1644,5 @@
 
         ## 4th test
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
                                                       -0.1,1.9,-2,17)
@@ -1658,5 +1658,5 @@
                          'failed')
         ## 5th test
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             0.1,1.9,2,17)
@@ -1674,5 +1674,5 @@
         ## 6th test
 
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             1.5,4,18,32)
@@ -1691,5 +1691,5 @@
         ## 7th test
         m2d = num.array([[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]], num.int)    #array default#
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             1.5,1.5,15,15)
@@ -1715,5 +1715,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -10,4,-10,31)
@@ -1730,5 +1730,5 @@
 
         ## 3rd test
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(\
+        kmin, kmax, lmin, lmax = get_min_max_indices(\
             latitudes,
             longitudes,
@@ -1753,5 +1753,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -37,-27,147,149.5)
@@ -1782,5 +1782,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes,
             -43,-37,148.5,149.5)
@@ -1806,5 +1806,5 @@
         # k - lat
         # l - lon
-        kmin, kmax, lmin, lmax = _get_min_max_indexes(
+        kmin, kmax, lmin, lmax = get_min_max_indices(
             latitudes,longitudes)
 
Index: /anuga_core/source/anuga/shallow_water/test_forcing_terms.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/test_forcing_terms.py	(revision 7742)
+++ /anuga_core/source/anuga/shallow_water/test_forcing_terms.py	(revision 7743)
@@ -20,5 +20,5 @@
 from boundaries import Reflective_boundary
 from forcing import Wind_stress, Inflow, Rainfall
-from file_conversion import timefile2netcdf
+from anuga.file_conversion.file_conversion import timefile2netcdf
 
 import numpy as num
Index: uga_core/source/anuga/utilities/anuga_exceptions.py
===================================================================
--- /anuga_core/source/anuga/utilities/anuga_exceptions.py	(revision 7742)
+++ 	(revision )
@@ -1,13 +1,0 @@
-"""Exceptions used by ANUGA
-"""
-
-import exceptions
-class TitleError(exceptions.IOError): pass
-class ParsingError(exceptions.IOError): pass
-class ShapeError(exceptions.IOError): pass
-
-
-class ANUGAError(Exception):
-    def __init__(self, args=None):
-        self.args = args
-        
