Changeset 1740
- Timestamp:
- Aug 23, 2005, 2:42:43 PM (19 years ago)
- Location:
- inundation/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/data_manager.py
r1690 r1740 358 358 from os import stat 359 359 360 minimum_allowed_depth = 0.001 361 #minimum_allowed_depth = 0.0 #FIXME pass in or read from domain 362 from Numeric import choose 360 363 361 364 #Get NetCDF … … 449 452 # Get quantity 450 453 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) 453 456 454 457 #FIXME: Make this general (see below) 455 458 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)) 456 463 stage[i,:] = A.astype(self.precision) 457 464 elif name == 'xmomentum': … … 932 939 #easting_min=None, easting_max=None, 933 940 #northing_min=None, northing_max=None, 941 stride = 1, 934 942 attribute_name = 'elevation', 935 943 z_func = None): … … 970 978 attribute = [] 971 979 for i, line in enumerate(infile.readlines()): 980 981 if i % stride != 0: continue 982 972 983 fields = line.split() 973 984 … … 1055 1066 import os 1056 1067 from Scientific.IO.NetCDF import NetCDFFile 1057 from Numeric import Float, zeros 1068 from Numeric import Float, zeros, reshape 1058 1069 1059 1070 root = basename_in … … 1138 1149 elevation = outfile.variables['elevation'] 1139 1150 1151 dem_elevation_r = reshape(dem_elevation, (nrows, ncols)) 1152 1140 1153 #Store data 1141 1154 #FIXME: Could perhaps be faster using array operations (Fixed 27/7/05) … … 1155 1168 northing_min <= y <= northing_max: 1156 1169 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] 1158 1171 global_index += 1 1159 1172 local_index += 1 -
inundation/pyvolution/test_data_manager.py
r1669 r1740 2000 2000 #------------------------------------------------------------- 2001 2001 if __name__ == "__main__": 2002 #suite = unittest.makeSuite(Test_Data_Manager,'test')2002 suite = unittest.makeSuite(Test_Data_Manager,'test') 2003 2003 #suite = unittest.makeSuite(Test_Data_Manager,'test_dem2pts_bounding_box') 2004 2004 #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') 2006 2006 runner = unittest.TextTestRunner() 2007 2007 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.