1 | """ |
---|
2 | Generate images of "gauges" for production run |
---|
3 | |
---|
4 | Inputs: |
---|
5 | |
---|
6 | production dirs: dictionary of production directories with a |
---|
7 | association to that simulation run, eg high tide, |
---|
8 | low tide and MSL. |
---|
9 | |
---|
10 | Outputs: |
---|
11 | |
---|
12 | * figures used for report stored in the report_figure directory |
---|
13 | |
---|
14 | """ |
---|
15 | from os import getcwd, sep, altsep, mkdir, access, F_OK |
---|
16 | import project |
---|
17 | from anuga.abstract_2d_finite_volumes.util import sww2timeseries |
---|
18 | |
---|
19 | production_dirs = {'20080619_115643_run_trial_0.6_exmouth_kvanputt': ''} |
---|
20 | |
---|
21 | is_parallel = False |
---|
22 | |
---|
23 | if is_parallel is True: |
---|
24 | no_nodes = 4 |
---|
25 | |
---|
26 | if is_parallel is False: |
---|
27 | |
---|
28 | swwfiles = {} |
---|
29 | for label_id in production_dirs.keys(): |
---|
30 | |
---|
31 | file_loc = project.output_dir + label_id + sep |
---|
32 | swwfile = file_loc + project.scenario_name + '.sww' |
---|
33 | swwfiles[swwfile] = label_id |
---|
34 | |
---|
35 | texname, elev_output = sww2timeseries(swwfiles, |
---|
36 | project.gauges_dir_name, |
---|
37 | production_dirs, |
---|
38 | report = False, |
---|
39 | plot_quantity = ['stage', 'speed', 'depth'], |
---|
40 | generate_fig = False, |
---|
41 | surface = False, |
---|
42 | time_min = None, |
---|
43 | time_max = None, |
---|
44 | time_unit = 'mins', |
---|
45 | title_on = False, |
---|
46 | use_cache = True, |
---|
47 | verbose = True) |
---|
48 | |
---|
49 | if is_parallel is True: |
---|
50 | |
---|
51 | for count in range(no_nodes): |
---|
52 | swwfiles = {} |
---|
53 | for label_id in production_dirs.keys(): |
---|
54 | |
---|
55 | file_loc = project.output_dir + label_id + sep |
---|
56 | extra = '_P%i_%i' %(count,no_nodes) |
---|
57 | swwfile = file_loc + project.scenario_name + extra + '.sww' |
---|
58 | swwfiles[swwfile] = label_id |
---|
59 | |
---|
60 | texname, elev_output = sww2timeseries(swwfiles, |
---|
61 | project.gauges_dir_name, |
---|
62 | production_dirs, |
---|
63 | report = False, |
---|
64 | plot_quantity = ['stage', 'speed'], |
---|
65 | generate_fig = False, |
---|
66 | surface = False, |
---|
67 | time_min = None, |
---|
68 | time_max = None, |
---|
69 | time_unit = 'mins', |
---|
70 | title_on = False, |
---|
71 | use_cache = True, |
---|
72 | verbose = True) |
---|
73 | |
---|