Changeset 1740


Ignore:
Timestamp:
Aug 23, 2005, 2:42:43 PM (19 years ago)
Author:
ole
Message:

Recovered data_manager as it was on 18 Aug and test_data_manager as it was on 16 Aug

Location:
inundation/pyvolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/data_manager.py

    r1690 r1740  
    358358        from os import stat
    359359
     360        minimum_allowed_depth = 0.001
     361        #minimum_allowed_depth = 0.0  #FIXME pass in or read from domain
     362        from Numeric import choose
    360363
    361364        #Get NetCDF
     
    449452                # Get quantity
    450453                Q = domain.quantities[name]
    451                 A,V = Q.get_vertex_values(xy=False,
    452                                       precision = self.precision)
     454                A,V = Q.get_vertex_values(xy = False,
     455                                          precision = self.precision)
    453456
    454457                #FIXME: Make this general (see below)
    455458                if name == 'stage':
     459                    z = fid.variables['elevation']
     460                    #print z[:]
     461                    #print A-z[:]
     462                    A = choose( A-z[:] >= minimum_allowed_depth, (z[:], A))
    456463                    stage[i,:] = A.astype(self.precision)
    457464                elif name == 'xmomentum':
     
    932939            #easting_min=None, easting_max=None,
    933940            #northing_min=None, northing_max=None,
     941            stride = 1,           
    934942            attribute_name = 'elevation',
    935943            z_func = None):
     
    970978    attribute = []
    971979    for i, line in enumerate(infile.readlines()):
     980
     981        if i % stride != 0: continue
     982       
    972983        fields = line.split()
    973984
     
    10551066    import os
    10561067    from Scientific.IO.NetCDF import NetCDFFile
    1057     from Numeric import Float, zeros
     1068    from Numeric import Float, zeros, reshape
    10581069
    10591070    root = basename_in
     
    11381149    elevation = outfile.variables['elevation']
    11391150
     1151    dem_elevation_r = reshape(dem_elevation, (nrows, ncols))
     1152
    11401153    #Store data
    11411154    #FIXME: Could perhaps be faster using array operations (Fixed 27/7/05)
     
    11551168               northing_min <= y <= northing_max:
    11561169                tpoints[local_index, :] = [x-easting_min,y-northing_min]
    1157                 telev[local_index] = dem_elevation[i, j]
     1170                telev[local_index] = dem_elevation_r[i, j]
    11581171                global_index += 1
    11591172                local_index += 1
  • inundation/pyvolution/test_data_manager.py

    r1669 r1740  
    20002000#-------------------------------------------------------------
    20012001if __name__ == "__main__":
    2002     #suite = unittest.makeSuite(Test_Data_Manager,'test')
     2002    suite = unittest.makeSuite(Test_Data_Manager,'test')
    20032003    #suite = unittest.makeSuite(Test_Data_Manager,'test_dem2pts_bounding_box')
    20042004    #suite = unittest.makeSuite(Test_Data_Manager,'test_decimate_dem')
    2005     suite = unittest.makeSuite(Test_Data_Manager,'test_decimate_dem_NODATA')
     2005    #suite = unittest.makeSuite(Test_Data_Manager,'test_decimate_dem_NODATA')
    20062006    runner = unittest.TextTestRunner()
    20072007    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.