Changeset 947


Ignore:
Timestamp:
Feb 23, 2005, 9:54:56 AM (20 years ago)
Author:
duncan
Message:

added max and min of stage to extent_sww

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

Legend:

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

    r941 r947  
    13751375    x = fid.variables['x'][:]
    13761376    y = fid.variables['y'][:]
    1377     return [min(x),max(x),min(y),max(y)]
     1377    stage = fid.variables['stage'][:]
     1378    return [min(x),max(x),min(y),max(y),min(min(stage)),max(max(stage))]
    13781379
    13791380
  • inundation/ga/storm_surge/pyvolution/test_data_manager.py

    r930 r947  
    691691
    692692        assert allclose(stage[time_index, linear_point_index], test_value/100)
    693        
    694 
     693
     694       
     695    def test_sww_DSG(self):
     696        """Not a test, rather a look at the sww format
     697        """
     698
     699        import time, os
     700        from Numeric import array, zeros, allclose, Float, concatenate
     701        from Scientific.IO.NetCDF import NetCDFFile       
     702
     703        self.domain.filename = 'datatest' + str(time.time())
     704        self.domain.format = 'sww'
     705        self.domain.smooth = True
     706        self.domain.reduction = mean
     707        self.domain.set_datadir('.')
     708     
     709        sww = get_dataobject(self.domain)
     710        sww.store_connectivity()
     711        sww.store_timestep('stage')
     712        self.domain.time = 2.
     713        sww.store_timestep('stage')
     714        file_and_extension_name = self.domain.filename + ".sww"
     715        #print "file_and_extension_name",file_and_extension_name
     716        [xmin, xmax, ymin, ymax, stagemin, stagemax] = \
     717               extent_sww(file_and_extension_name )
     718        #print "[xmin, xmax, ymin, ymax, stagemin, stagemax",[xmin, xmax, ymin, ymax, stagemin, stagemax]
     719        assert allclose(xmin, 0.0)
     720        assert allclose(xmax, 1.0)
     721        assert allclose(ymin, 0.0)
     722        assert allclose(ymax, 1.0)
     723        assert allclose(stagemin, -0.88)
     724        assert allclose(stagemax, 0.12)
    695725       
    696726    def test_ferret2sww_nz_origin(self):
Note: See TracChangeset for help on using the changeset viewer.