source: anuga_work/production/perth/export_results.py @ 5569

Last change on this file since 5569 was 5569, checked in by kristy, 14 years ago

updated scripts for polyline boundary

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