[5634] | 1 | import project_slide, os |
---|
| 2 | import sys |
---|
| 3 | |
---|
| 4 | from anuga.shallow_water.data_manager import sww2dem |
---|
| 5 | from os import sep |
---|
| 6 | |
---|
| 7 | #time_dir = '20061211_071516' #bulli |
---|
| 8 | #time_dir = '20061212_012705' #shovel |
---|
| 9 | #time_dir = '20061212_064807' #yacaaba |
---|
| 10 | # correct depths |
---|
| 11 | #time_dir = '20070121_213509' #shovel |
---|
| 12 | #time_dir = '20070119_055222' #yacaaba |
---|
| 13 | #time_dir = '20070121_213444' #bulli |
---|
| 14 | #corrected yacaaba and birubi |
---|
| 15 | #time_dir = '20070322_035214' # yacaaba |
---|
| 16 | time_dir = '20070322_035135' # birubi |
---|
| 17 | |
---|
| 18 | directory = project_slide.outputdir |
---|
| 19 | name = directory + time_dir + sep + project_slide.basename |
---|
| 20 | #name = 'test500000.035000' |
---|
| 21 | #name = 'test' |
---|
| 22 | |
---|
| 23 | is_parallel = False |
---|
| 24 | if is_parallel == True: nodes = 4 |
---|
| 25 | print 'output dir:', name |
---|
| 26 | |
---|
| 27 | which_var = 2 |
---|
| 28 | if which_var == 0: # Stage |
---|
| 29 | outname = name + '_stage-eq-thurs-test' |
---|
| 30 | quantityname = 'stage' |
---|
| 31 | |
---|
| 32 | if which_var == 1: # Absolute Momentum |
---|
| 33 | outname = name + '_momentum_i1' |
---|
| 34 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5' |
---|
| 35 | |
---|
| 36 | if which_var == 2: # Depth |
---|
| 37 | outname = name + '_depth' |
---|
| 38 | quantityname = 'stage-elevation' |
---|
| 39 | |
---|
| 40 | if which_var == 3: # Speed |
---|
| 41 | outname = name + '_speed_i0' |
---|
| 42 | quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed |
---|
| 43 | |
---|
| 44 | if which_var == 4: # Elevation |
---|
| 45 | outname = name + '_elevation' |
---|
| 46 | quantityname = 'elevation' #Elevation |
---|
| 47 | |
---|
| 48 | if is_parallel == True: |
---|
| 49 | for i in range(0,nodes): |
---|
| 50 | namei = name + '_P%d_%d' %(i,nodes) |
---|
| 51 | outnamei = outname + '_P%d_%d' %(i,nodes) |
---|
| 52 | print 'start sww2dem for sww file %d' %(i) |
---|
| 53 | sww2dem(namei, basename_out = outnamei, |
---|
| 54 | quantity = quantityname, |
---|
| 55 | timestep = 1, |
---|
| 56 | cellsize = 100, |
---|
| 57 | #easting_min = project.e_min_area, |
---|
| 58 | #easting_max = project.e_max_area, |
---|
| 59 | #northing_min = project.n_min_area, |
---|
| 60 | #northing_max = project.n_max_area, |
---|
| 61 | reduction = max, |
---|
| 62 | verbose = True, |
---|
| 63 | format = 'asc') |
---|
| 64 | else: |
---|
| 65 | print 'start sww2dem' |
---|
| 66 | sww2dem(name, basename_out = outname, |
---|
| 67 | quantity = quantityname, |
---|
| 68 | timestep = 0, |
---|
| 69 | cellsize = 50, |
---|
| 70 | easting_min = project_slide.eastingmin, |
---|
| 71 | easting_max = project_slide.eastingmax, |
---|
| 72 | northing_min = project_slide.northingmin, |
---|
| 73 | northing_max = project_slide.northingmax, |
---|
| 74 | reduction = max, |
---|
| 75 | verbose = True, |
---|
| 76 | format = 'asc') |
---|