""" File used for interegating *report.csv files generated from CCS.py script Mainly used to get errors of non best fit friction values.""" ### INPUTS ------------------------------------------------------------------------ input_files = ['buildings_straight_5_100_sec__report.csv', 'buildings_straight_5_200_sec__report.csv', 'buildings_straight_5_300_sec__report.csv', 'buildings_straight_5_500_sec__report.csv'] # ### mannings and widths of Datum file # best fit frictions files from datum 5m wave at 1000s mannings = [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 #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 #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 #mannings = [0.1, 0.125, 0.15, 0.175, 0.225, 2, 3, 4, 5, 6, 7, 8, 12, 26] # rot(45) 5m wave #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 #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 #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] # straight 5m 100 sec #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 #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] # straight 5m 200 sec #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 widths = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23] #widths = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] # Rotated buildings only ### --------------------------------------------------------------------------------- norm = [] List=[] newFD = open('5m_str_1000sec_fric_extrd_time_comp.csv', 'w') newFD.write('This file pulls 5m datum friction values from specified file to find RMS of using that value instead' + '\n' ) for input_file in input_files: fd = open(input_file,'r') line = fd.readline() newFD.write('5m friction values and RMS errors extracted from >> ' + input_file + '\n' ) newFD.write('B.L. (m), 5m bestfit n, RMS error,' + '\n' ) for i,width in enumerate(widths): while not line[0] == '<' or line.find(str(width)) == -1: #print "not line",line line = fd.readline() #print "next line",line #print "***line",line line = fd.readline() # skips gauge locations #line = fd.readline() # skips labels line = fd.readline() # should read line with numbers in it numbers = line.split(',') # (Manning's n), (Rel. RMS value) #print "numbers[0]",numbers[0], "type ", type(numbers[0]) # raw_input(" <><><> Correct number should have been found!! <><><>") #print 'float(numbers[0])',float(numbers[0]) #print "mannings",mannings [i] while not (numbers[0]) == str(mannings[i]): #print "not numbers",numbers line = fd.readline() #print 'float(numbers[0])',float(numbers[0]) #print "mannings",mannings [i] numbers = line.split(',') print "[", width, "], > This is it numbers",numbers norm.append(float(numbers[1])) List.append(width) List.append(mannings[i]) List.append(float(numbers[1])) newFD.write(str(width) + ', ' + str(mannings[i]) + ', ' + str(numbers[1]) ) print "*********************8" print "norm", norm print "length >> ", len(norm) print List newFD.close #---------------------------------------------------------------------------------