source: anuga_work/development/momentum_sink/scripts/convert.py @ 5587

Last change on this file since 5587 was 2927, checked in by nicholas, 18 years ago

final update of all relavent data

File size: 4.2 KB
Line 
1
2"""    File used for interegating *report.csv  files generated from CCS.py script
3        Mainly used to get errors of non best fit friction values."""
4
5### INPUTS ------------------------------------------------------------------------
6
7input_files  = ['buildings_straight_5_100_sec__report.csv',
8                'buildings_straight_5_200_sec__report.csv',
9                'buildings_straight_5_300_sec__report.csv',
10                'buildings_straight_5_500_sec__report.csv']  # <name of .csv report file>
11
12### mannings and widths of Datum file # best fit frictions files from datum 5m wave at 1000s
13
14mannings    = [0.125, 0.125, 0.15, 0.175, 0.2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 8, 8, 8, 9]             # straight 5m wave
15#mannings    = [0.1, 0.125, 0.15, 0.15, 0.2, 2, 3, 4, 4, 5, 5, 6, 7, 8, 9, 11, 14, 17, 23, 16, 18]          # Str_half_off 5m wave
16#mannings    = [0.125, 0.125, 0.15, 0.175, 0.2, 2, 3, 4, 5, 5, 7, 8, 9, 11, 12, 11, 14, 15, 16, 16, 18]     # Str_Off 5m wave
17#mannings    = [0.1, 0.125, 0.15, 0.175, 0.225, 2, 3, 4, 5, 6, 7, 8, 12, 26]                                 # rot(45) 5m wave
18#mannings    = [0.1, 0.125, 0.15, 0.2, 0.225, 2, 3, 4, 5, 5, 6, 8, 13, 26]                                  # rot(45)_Off 5m wave
19#mannings     = [0.175, 0.2, 0.225, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4]                    # straight 10m 300 secs bestfit
20#mannings    = [0.125, 0.15, 0.175, 0.175, 0.2, 0.2, 0.225, 0.225, 0.225, 0.25, 0.275, 0.275, 0.3, 0.325,0.35, 0.35, 0.375, 0.35, 0.375, 0.4, 0.4]
21                # straight 5m 100 sec
22#mannings     = [0.1,0.125, 0.15, 0.85, 0.9, 0.95, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]              # straight 5 m 300 secs
23#mannings    = [0.1, 0.125, 0.425, 0.475, 0.5, 0.525, 0.55, 0.575, 0.575, 0.6, 0.625, 0.625, 0.65, 0.65, 0.65, 0.675, 0.7, 0.675, 0.7, 0.7, 0.725]
24                # straight 5m 200 sec
25#mannings    = [0.1, 0.125, 0.15, 0.175, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]                  # straight 5m 500 secs
26
27
28
29widths      = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] 
30#widths      = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]                                            # Rotated buildings only
31
32### ---------------------------------------------------------------------------------
33   
34
35
36norm = [] 
37
38List=[]
39newFD = open('5m_str_1000sec_fric_extrd_time_comp.csv', 'w')
40newFD.write('This file pulls 5m datum friction values from specified file to find RMS of using that value instead' + '\n' )
41
42
43
44for input_file in input_files:
45    fd = open(input_file,'r')
46    line = fd.readline()
47    newFD.write('5m friction values and RMS errors extracted from >> ' + input_file + '\n' )
48    newFD.write('B.L. (m), 5m bestfit n, RMS error,' + '\n' )
49    for i,width in enumerate(widths):
50        while not line[0] == '<' or line.find(str(width)) == -1:
51            #print "not line",line
52            line = fd.readline()
53            #print "next line",line
54        #print "***line",line
55        line = fd.readline() # skips gauge locations
56        #line = fd.readline() # skips labels
57        line = fd.readline() # should read line with numbers in it
58        numbers = line.split(',') # (Manning's n), (Rel. RMS value)
59        #print "numbers[0]",numbers[0], "type ", type(numbers[0])
60        # raw_input(" <><><> Correct number should have been found!! <><><>")
61        #print 'float(numbers[0])',float(numbers[0])
62        #print "mannings",mannings [i]
63        while not (numbers[0]) == str(mannings[i]):
64            #print "not numbers",numbers
65            line = fd.readline()
66            #print 'float(numbers[0])',float(numbers[0])
67            #print "mannings",mannings [i]
68            numbers = line.split(',')
69        print "[", width, "], > This is it numbers",numbers
70        norm.append(float(numbers[1]))
71        List.append(width)
72        List.append(mannings[i])
73        List.append(float(numbers[1]))
74        newFD.write(str(width) + ', ' + str(mannings[i]) + ', ' + str(numbers[1]) )
75   
76print "*********************8"
77print "norm", norm
78print "length >> ", len(norm)
79print List
80
81newFD.close
82#---------------------------------------------------------------------------------
83
84   
85
Note: See TracBrowser for help on using the repository browser.