[6461] | 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 = '20081210_163235_run_final_3.6_27283_alpha0.1_jgriffin' |
---|
| 8 | |
---|
| 9 | cellsize = 20 |
---|
| 10 | #cellsize = 150 |
---|
| 11 | timestep = 0 |
---|
| 12 | directory = project.output_dir |
---|
| 13 | name = directory+time_dir+sep+project.scenario_name |
---|
| 14 | |
---|
| 15 | from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | is_parallel = False |
---|
| 19 | #is_parallel = True |
---|
| 20 | |
---|
| 21 | if is_parallel == True: nodes = 4 |
---|
| 22 | print 'output dir:', name |
---|
| 23 | |
---|
| 24 | #var = [3,4] # depth and speed |
---|
| 25 | #var = [2] # depth |
---|
| 26 | #var = [0] #stage |
---|
| 27 | #var = [0,4] # stage and elevation |
---|
| 28 | var = [4] #elevation |
---|
| 29 | |
---|
| 30 | for which_var in var: |
---|
| 31 | if which_var == 0: # Stage |
---|
| 32 | outname = name + '_stage' |
---|
| 33 | quantityname = 'stage' |
---|
| 34 | |
---|
| 35 | if which_var == 1: # Absolute Momentum |
---|
| 36 | outname = name + '_momentum' |
---|
| 37 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
| 38 | |
---|
| 39 | if which_var == 2: # Depth |
---|
| 40 | outname = name + '_depth' |
---|
| 41 | quantityname = 'stage-elevation' |
---|
| 42 | |
---|
| 43 | if which_var == 3: # Speed |
---|
| 44 | outname = name + '_speed' |
---|
| 45 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
| 46 | |
---|
| 47 | if which_var == 4: # Elevation |
---|
| 48 | outname = name + '_elevation' |
---|
| 49 | quantityname = 'elevation' #Elevation |
---|
| 50 | |
---|
| 51 | if is_parallel == True: |
---|
| 52 | # print 'is_parallel',is_parallel |
---|
| 53 | for i in range(0,nodes): |
---|
| 54 | namei = name + '_P%d_%d' %(i,nodes) |
---|
| 55 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
| 56 | print 'start sww2dem for sww file %d' %(i) |
---|
| 57 | sww2dem(namei, basename_out = outnamei, |
---|
| 58 | quantity = quantityname, |
---|
| 59 | timestep = timestep, |
---|
| 60 | cellsize = cellsize, |
---|
| 61 | easting_min = project_grad.e_min_area, |
---|
| 62 | easting_max = project_grad.e_max_area, |
---|
| 63 | northing_min = project_grad.n_min_area, |
---|
| 64 | northing_max = project_grad.n_max_area, |
---|
| 65 | reduction = max, |
---|
| 66 | verbose = True, |
---|
| 67 | format = 'asc') |
---|
| 68 | else: |
---|
| 69 | print 'start sww2dem' |
---|
| 70 | sww2dem(name, basename_out = outname, |
---|
| 71 | quantity = quantityname, |
---|
| 72 | #timestep = timestep, |
---|
| 73 | cellsize = cellsize, |
---|
| 74 | #easting_min = project_grad.e_min_area, |
---|
| 75 | #easting_max = project_grad.e_max_area, |
---|
| 76 | #northing_min = project_grad.n_min_area, |
---|
| 77 | #northing_max = project_grad.n_max_area, |
---|
| 78 | reduction = max, |
---|
| 79 | verbose = True, |
---|
| 80 | format = 'asc') |
---|
| 81 | |
---|