- Timestamp:
- Jun 4, 2008, 2:44:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/Hinwood_2008/prepare_time_boundary.py
r5370 r5392 23 23 from interp import interp 24 24 25 def prepare_time_boundary(filename): 25 from os.path import join 26 27 # from os import getenv 28 # from os.path import join 29 # home = getenv('INUNDATIONHOME') 30 # Hinwood_dir = join(home,'data','flumes','Hinwood_2008') 31 # raw_data_dir = join(Hinwood_dir, 'raw_data') 32 33 def csv2tms(filename, offshore_bed_elevation): 26 34 """Convert benchmark 2 time series to NetCDF tms file. 35 the filename is the name of the output tms file, eg 'hi.tsm'. 36 There must be an equivalent .csv file, eg 'hi.csv'. 27 37 28 38 """ … … 50 60 51 61 T[i] = float(fields[0]) 52 Q[i] = depth = float(fields[1]) 62 Q[i] = float(fields[1]) 63 depth = Q[i] - offshore_bed_elevation 53 64 X[i] = float(fields[2]) * depth 54 65 try: … … 187 198 fid.close() 188 199 200 def prepare_time_boundary(metadata_dic, raw_data_dir, output_dir): 201 """ 202 """ 203 scenario_id = metadata_dic['scenario_id'] 204 velocity_file = join(raw_data_dir,scenario_id+'velfilt.txt') 205 depth_file = join(raw_data_dir,scenario_id+'pressfilt.txt') 206 out_file = join(output_dir, scenario_id+'_boundary.csv') 207 208 combine_velocity_depth(velocity_file, depth_file, out_file) 209 tsm_file = out_file[:-4] + '.tsm' 210 if metadata_dic['xleft'][1] >= 0.0: 211 # This should be a -ve value, since the still water level is the 212 # z origin. 213 print "Warning: The z origin seems incorrect." 214 215 csv2tms(tsm_file, metadata_dic['xleft'][1]) 189 216 190 217 191 218 #------------------------------------------------------------------- 192 219 if __name__ == "__main__": 193 from os import getenv 194 from os.path import join 195 home = getenv('INUNDATIONHOME') 196 Hinwood_dir = join(home,'data','flumes','Hinwood_2008') 197 raw_data_dir = join(Hinwood_dir, 'raw_data') 198 199 # Test 1 Run 5 200 combine_velocity_depth(join(raw_data_dir,'T1R5velfilt.txt'), 201 join(raw_data_dir,'T1R5pressfilt.txt'), 202 join(Hinwood_dir, 'T1R5_boundary.csv')) 203 # Create the tsm file 204 prepare_time_boundary(join(Hinwood_dir, 'T1R5_boundary.tsm')) 205 206 # Test 2 Run 7 207 combine_velocity_depth(join(raw_data_dir,'T2R7velfilt.txt'), 208 join(raw_data_dir,'T2R7pressfilt.txt'), 209 join(Hinwood_dir, 'T2R7_boundary.csv')) 210 # Create the tsm file 211 prepare_time_boundary(join(Hinwood_dir, 'T2R7_boundary.tsm')) 220 pass
Note: See TracChangeset
for help on using the changeset viewer.