Changeset 994


Ignore:
Timestamp:
Mar 3, 2005, 4:03:23 PM (20 years ago)
Author:
ole
Message:

Removed generated garbage from testings

Location:
inundation/ga/storm_surge/pyvolution
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/data_manager.py

    r982 r994  
    12381238    #print file_h.variables.keys()   
    12391239
     1240    file_h.close()
     1241    file_u.close()
     1242    file_v.close()   
     1243
     1244
    12401245    if verbose: print 'Store to SWW file %s' %swwname
    12411246    # NetCDF file definition
     
    14041409    #print "min(stage.flat), mpythonax(stage.flat)",min(stage.flat), max(stage.flat)
    14051410    #print "min(stage)",min(stage)
     1411
     1412    fid.close()
     1413   
    14061414    return [min(x),max(x),min(y),max(y),min(stage.flat),max(stage.flat)]
    14071415
  • inundation/ga/storm_surge/pyvolution/test_data_manager.py

    r991 r994  
    135135        from Scientific.IO.NetCDF import NetCDFFile       
    136136
    137         self.domain.filename = 'datatest' + str(time.time())
     137        self.domain.filename = 'datatest' + str(id(self))
    138138        self.domain.format = 'sww'
    139139        self.domain.smooth = False
     
    182182        from Scientific.IO.NetCDF import NetCDFFile       
    183183
    184         self.domain.filename = 'datatest' + str(time.time())
     184        self.domain.filename = 'datatest' + str(id(self))       
    185185        self.domain.format = 'sww'
    186186        self.domain.smooth = True
     
    239239        from Scientific.IO.NetCDF import NetCDFFile       
    240240
    241         self.domain.filename = 'datatest' + str(time.time())
     241        self.domain.filename = 'datatest' + str(id(self))
    242242        self.domain.format = 'sww'
    243243        self.domain.smooth = True
     
    294294        from Scientific.IO.NetCDF import NetCDFFile
    295295
    296         self.domain.filename = 'datatest' + str(time.time())
     296        self.domain.filename = 'datatest' + str(id(self))       
    297297        self.domain.format = 'sww'
    298298        self.domain.smooth = True
     
    352352        from Scientific.IO.NetCDF import NetCDFFile
    353353
    354         self.domain.filename = 'datatest' + str(time.time())
     354        self.domain.filename = 'datatest' + str(id(self))       
    355355        self.domain.format = 'sww'
    356356        self.domain.smooth = True
     
    444444        from Scientific.IO.NetCDF import NetCDFFile       
    445445
    446         self.domain.filename = 'datatest' + str(time.time())
     446        self.domain.filename = 'datatest' + str(id(self))               
    447447        self.domain.format = 'sww'
    448448        self.domain.smooth = True
     
    489489#         print "****************************"
    490490
    491 
    492        
    493491       
    494492        fid.close()
     
    634632        #Check fourth value
    635633        assert allclose(stage[0,3], fourth_value/100)  #Meters       
     634
     635        fid.close()
     636
     637        #Cleanup
     638        import os
     639        os.remove('small.sww')
     640
    636641       
    637642
     
    692697        assert allclose(stage[time_index, linear_point_index], test_value/100)
    693698
     699        fid.close()
     700
     701        #Cleanup
     702        import os
     703        os.remove('small.sww')
     704
     705
     706
    694707       
    695708    def test_sww_extent(self):
     
    701714        from Scientific.IO.NetCDF import NetCDFFile       
    702715
    703         self.domain.filename = 'datatest' + str(time.time())
     716        self.domain.filename = 'datatest' + str(id(self))                       
    704717        self.domain.format = 'sww'
    705718        self.domain.smooth = True
     
    723736        [xmin, xmax, ymin, ymax, stagemin, stagemax] = \
    724737               extent_sww(file_and_extension_name )
    725         #print "[xmin, xmax, ymin, ymax, stagemin, stagemax]",[xmin, xmax, ymin, ymax, stagemin, stagemax]
     738       
    726739        assert allclose(xmin, 0.0)
    727740        assert allclose(xmax, 1.0)
     
    730743        assert allclose(stagemin, -0.85)
    731744        assert allclose(stagemax, 0.15)
     745
     746
     747        #Cleanup
     748        os.remove(sww.filename)
     749       
    732750       
    733751    def test_ferret2sww_nz_origin(self):
     
    738756        ferret2sww('small', verbose=False,
    739757                   origin = (56, 100000, 200000, 500000, 10000000))
    740  
     758
    741759
    742760        #Work out the UTM coordinates for first point
     
    744762
    745763        #Read output file 'small.sww'
    746         fid = NetCDFFile('small.sww')
     764        fid = NetCDFFile('small.sww', 'r')
    747765
    748766        x = fid.variables['x'][:]
     
    753771        assert allclose(y[0], n-200000)
    754772
     773        fid.close()
     774
     775        #Cleanup
     776        import os
     777        os.remove('small.sww')
    755778
    756779       
  • inundation/ga/storm_surge/pyvolution/test_least_squares.py

    r979 r994  
    10571057        os.remove(mesh_file)
    10581058        os.remove(point_file)
     1059        os.remove(mesh_output_file)       
    10591060       
    10601061    def test_fit_to_mesh_fileII(self):
  • inundation/ga/storm_surge/pyvolution/test_util.py

    r984 r994  
    536536        domain1.store = True   
    537537        domain1.set_datadir('.')
    538         domain1.set_name('spatio_temporal_boundary_source' + str(time.time()))
     538        domain1.set_name('spatio_temporal_boundary_source_%d' %(id(self)))
    539539        domain1.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
    540540               
     
    696696       
    697697        fid.close()
    698 
     698        import os
     699        os.remove(filename)
     700       
    699701
    700702    def test_xya_ascii(self):
  • inundation/ga/storm_surge/pyvolution/util.py

    r989 r994  
    297297
    298298                   
    299                 print '  Interpolation points (xi, eta):'
    300                 print '    xi in [%f, %f], len(xi) == %d'\
    301                       %(min(P[:,0]), max(P[:,0]), P.shape[0])
    302                 print '    eta in [%f, %f], len(eta) == %d'\
    303                       %(min(P[:,1]), max(P[:,1]), P.shape[1])
     299                print '  Interpolation points (xi, eta):'\
     300                      'number of points == %d ' %P.shape[0]
     301                print '    xi in [%f, %f]' %(min(P[:,0]), max(P[:,0]))
     302                print '    eta in [%f, %f]' %(min(P[:,1]), max(P[:,1]))
    304303                print '  Interpolated quantities:'
    305304                for name in self.quantities:
Note: See TracChangeset for help on using the changeset viewer.