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 | # Create report directory |
---|
20 | reportdir = getcwd()+sep+'report'+sep |
---|
21 | if access(reportdir,F_OK) == 0: |
---|
22 | mkdir (reportdir) |
---|
23 | |
---|
24 | # sww file created from URS boundary |
---|
25 | production_dirs = {#'20070206_005106_run': '10000 yr wave height'} |
---|
26 | '20070223_031527_run': 'URS boundary condition'} |
---|
27 | |
---|
28 | is_parallel = False |
---|
29 | if is_parallel == True: |
---|
30 | nodes = 2 |
---|
31 | |
---|
32 | # Generate figures |
---|
33 | swwfiles = {} |
---|
34 | |
---|
35 | if is_parallel == True: |
---|
36 | |
---|
37 | for i in range(nodes): |
---|
38 | print 'Sending node %d of %d' %(i,nodes) |
---|
39 | swwfiles = {} |
---|
40 | #reportname = report_name + '_%s' %(i) |
---|
41 | for label_id in production_dirs.keys(): |
---|
42 | if label_id == 'boundaries': |
---|
43 | file_loc = project.boundaries_in_dir |
---|
44 | swwfile = file_loc + sep + '20070223_031527_run' + sep + 'dampier.sww' |
---|
45 | print 'hi' |
---|
46 | #else: |
---|
47 | #file_loc = project.output_dir + label_id + sep |
---|
48 | #sww_extra = '_P%s_%s' %(i,nodes) |
---|
49 | #swwfile = file_loc + project.scenario_name + sww_extra + '.sww' |
---|
50 | swwfiles[swwfile] = label_id |
---|
51 | |
---|
52 | texname, elev_output = sww2timeseries(swwfiles, |
---|
53 | project.gauges_dir_name_test, |
---|
54 | production_dirs, |
---|
55 | report = False, |
---|
56 | #reportname = reportname, |
---|
57 | plot_quantity = ['stage', 'momentum'], |
---|
58 | generate_fig = False, |
---|
59 | surface = False, |
---|
60 | time_min = None, |
---|
61 | time_max = None, |
---|
62 | title_on = False, |
---|
63 | verbose = True) |
---|
64 | |
---|
65 | #latex_output.append(texname) |
---|
66 | |
---|
67 | else: |
---|
68 | |
---|
69 | for label_id in production_dirs.keys(): |
---|
70 | |
---|
71 | if label_id == 'boundaries': |
---|
72 | file_loc = project.boundaries_in_dir |
---|
73 | swwfile = file_loc + sep + '20070223_031527_run' + sep + 'dampier.sww' |
---|
74 | else: |
---|
75 | file_loc = project.output_dir + label_id + sep |
---|
76 | swwfile = file_loc + project.scenario_name + '.sww' |
---|
77 | swwfiles[swwfile] = label_id |
---|
78 | |
---|
79 | texname, elev_output = sww2timeseries(swwfiles, |
---|
80 | project.gauges_dir_name_test, |
---|
81 | production_dirs, |
---|
82 | report = False, |
---|
83 | #reportname = report_name, |
---|
84 | plot_quantity = ['stage', 'momentum'], |
---|
85 | surface = False, |
---|
86 | time_min = None, |
---|
87 | time_max = None, |
---|
88 | title_on = False, |
---|
89 | verbose = True) |
---|