- Timestamp:
- Jul 2, 2008, 4:34:48 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/Hinwood_2008/prepare_time_boundary.py
r5455 r5459 15 15 from Scientific.IO.NetCDF import NetCDFFile 16 16 from Numeric import array, zeros, Float 17 from os.path import join 17 18 18 19 from anuga.utilities.numerical_tools import ensure_numeric … … 20 21 from interp import interp 21 22 22 from os.path import join 23 24 import project 23 25 24 26 # from os import getenv … … 115 117 116 118 # Read velocity file 119 #print "*********************" 120 #print "velocity_file", velocity_file 117 121 vfid = open(velocity_file) 118 122 lines = vfid.readlines() … … 133 137 134 138 # Read the depth file 139 #print "depth_file", depth_file 135 140 dfid = open(depth_file) 136 141 lines = dfid.readlines() … … 159 164 #print "len(dtimes)", len(vtimes) 160 165 #print "len(depths_at_vtimes)", len(depths_at_vtimes) 161 # for i in range(len(depths_at_vtimes)): 166 #print "metadata_dic['scenario_id']", metadata_dic['scenario_id'] 167 # for i in range(len(depths_at_vtimes)): 162 168 # print "i", i 163 169 # print "vtimes[i]", vtimes[i] 164 170 # print "depths_at_vtimes[i]", depths_at_vtimes[i] 165 # print "depths_at_vtimes", depths_at_vtimes 171 172 #print "depths_at_vtimes", depths_at_vtimes 166 173 depths_at_vtimes = depths_at_vtimes/1000.00 # convert from mm to m 167 174 missing=missing/1000.00 # Do to missing what is done to depths_at_vtimes … … 192 199 193 200 fid.close() 201 print "The start time for is", start_time 202 if not start_time == metadata_dic['ANUGA_start_time']: 203 raise ValueError, "The calc'ed and recorded start times are different" 204 # Modify the sensor array to reflect the new start time 205 sensors[:,0] -= start_time 194 206 195 207 # Since there is a new time reference save the depth info using this 196 208 # new reference. 197 209 fid = open(depth_file[:-4] + '_exp_depth.csv','w') 198 sensors[:,0] -= start_time199 210 #print "depth_file", depth_file 200 211 #print "start_time", start_time … … 226 237 # new reference. 227 238 fid = open(depth_file[:-4] + '_exp_stage.csv','w') 228 sensors[:,0] -= start_time229 239 230 240 # Write a header … … 248 258 def prepare_time_boundary(metadata_dic, raw_data_dir, output_dir): 249 259 """ 260 Use this if a project instance has already been created. 250 261 """ 251 262 scenario_id = metadata_dic['scenario_id'] … … 256 267 257 268 final_time = combine_velocity_depth(velocity_file, depth_file, out_file, 258 metadata_dic) 269 metadata_dic) 270 #print "metadata_dic['xleft'][1]", metadata_dic['xleft'][1] 259 271 if metadata_dic['xleft'][1] >= 0.0: 260 272 # This should be a -ve value, since the still water level is the … … 264 276 csv2tms(tsm_file, metadata_dic['xleft'][1]) 265 277 return final_time 278 279 # Don't do this, since run-dam changes the metadata_dic['xleft'][1], 280 # which is used by this function 281 def prepare_time_boundary_for_scenarios_warning(scenarios, 282 outputdir_tag): 283 284 for run_data in scenarios: 285 id = run_data['scenario_id'] 286 outputdir_name = id + outputdir_tag 287 pro_instance = project.Project(['data','flumes','Hinwood_2008'], 288 outputdir_name=outputdir_name) 289 prepare_time_boundary(run_data, 290 pro_instance.raw_data_dir, 291 pro_instance.boundarydir) 292 266 293 267 294 #------------------------------------------------------------------- 268 295 if __name__ == "__main__": 269 pass 296 297 import sys; sys.exit() 298 299 from scenarios import scenarios 300 outputdir_tag = "XXXX" 301 prepare_time_boundary_for_scenarios(scenarios, 302 outputdir_tag)
Note: See TracChangeset
for help on using the changeset viewer.