[5409] | 1 | import project, os |
---|
| 2 | import sys |
---|
| 3 | |
---|
| 4 | from anuga.shallow_water.data_manager import sww2dem |
---|
| 5 | from os import sep |
---|
| 6 | |
---|
| 7 | #time_dir = '20080526_104946_run_final_0.6_test_kvanputt' |
---|
[5415] | 8 | #time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt' |
---|
[5492] | 9 | #time_dir = '20080619_115643_run_trial_0.6_exmouth_kvanputt' |
---|
[5569] | 10 | #time_dir = '20080714_095738_run_final_0.6_exmouth_kvanputt' |
---|
| 11 | #time_dir = '20080714_134935_run_final_0_exmouth_kvanputt' |
---|
[5592] | 12 | #time_dir = '20080718_112228_run_final_0_exmouth_kvanputt' |
---|
| 13 | #time_dir = '20080725_173911_run_final_0.6_polyline_alpha0.1_kvanputt' |
---|
| 14 | #time_dir = '20080728_112519_run_final_0.6_polyline_alpha0.2_kvanputt' |
---|
| 15 | time_dir = '20080728_154123_run_final_0.6_polyline_alpha0.15_kvanputt' |
---|
[5409] | 16 | |
---|
| 17 | cellsize = 25 |
---|
| 18 | #cellsize = 150 |
---|
[5498] | 19 | timestep = 0 |
---|
[5409] | 20 | directory = project.output_dir |
---|
| 21 | name = directory+time_dir+sep+project.scenario_name |
---|
| 22 | |
---|
| 23 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | is_parallel = False |
---|
| 27 | #is_parallel = True |
---|
| 28 | |
---|
| 29 | if is_parallel == True: nodes = 4 |
---|
| 30 | print 'output dir:', name |
---|
| 31 | |
---|
[5492] | 32 | #var = [2,3,4] # depth and speed |
---|
[5409] | 33 | #var = [2] # depth |
---|
[5498] | 34 | var = [0,4] # stage and elevation |
---|
[5409] | 35 | |
---|
[5492] | 36 | |
---|
[5409] | 37 | for which_var in var: |
---|
| 38 | if which_var == 0: # Stage |
---|
| 39 | outname = name + '_stage' |
---|
| 40 | quantityname = 'stage' |
---|
| 41 | |
---|
| 42 | if which_var == 1: # Absolute Momentum |
---|
| 43 | outname = name + '_momentum' |
---|
| 44 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
| 45 | |
---|
| 46 | if which_var == 2: # Depth |
---|
| 47 | outname = name + '_depth' |
---|
| 48 | quantityname = 'stage-elevation' |
---|
| 49 | |
---|
| 50 | if which_var == 3: # Speed |
---|
| 51 | outname = name + '_speed' |
---|
| 52 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
| 53 | |
---|
| 54 | if which_var == 4: # Elevation |
---|
| 55 | outname = name + '_elevation' |
---|
| 56 | quantityname = 'elevation' #Elevation |
---|
| 57 | |
---|
| 58 | if is_parallel == True: |
---|
| 59 | # print 'is_parallel',is_parallel |
---|
| 60 | for i in range(0,nodes): |
---|
| 61 | namei = name + '_P%d_%d' %(i,nodes) |
---|
| 62 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
| 63 | print 'start sww2dem for sww file %d' %(i) |
---|
| 64 | sww2dem(namei, basename_out = outnamei, |
---|
| 65 | quantity = quantityname, |
---|
| 66 | #timestep = timestep, |
---|
| 67 | cellsize = cellsize, |
---|
| 68 | easting_min = project_grad.e_min_area, |
---|
| 69 | easting_max = project_grad.e_max_area, |
---|
| 70 | northing_min = project_grad.n_min_area, |
---|
| 71 | northing_max = project_grad.n_max_area, |
---|
| 72 | reduction = max, |
---|
| 73 | verbose = True, |
---|
| 74 | format = 'asc') |
---|
| 75 | else: |
---|
| 76 | print 'start sww2dem' |
---|
| 77 | sww2dem(name, basename_out = outname, |
---|
| 78 | quantity = quantityname, |
---|
[5498] | 79 | timestep = timestep, |
---|
[5409] | 80 | cellsize = cellsize, |
---|
| 81 | #easting_min = project_grad.e_min_area, |
---|
| 82 | #easting_max = project_grad.e_max_area, |
---|
| 83 | #northing_min = project_grad.n_min_area, |
---|
| 84 | #northing_max = project_grad.n_max_area, |
---|
| 85 | reduction = max, |
---|
| 86 | verbose = True, |
---|
| 87 | format = 'asc') |
---|
| 88 | |
---|