source: anuga_work/development/momentum_sink/scripts/Sorter.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: 766 bytes
Line 
1""" Clunky sorting script to sort Nick Dando's sww files
2    in a folder before being put through the CCS.py"""
3
4import os
5import string
6import operator
7
8B_list_unsorted=os.listdir("buildings_Str_half_Off")
9B_strings=[]
10B_list=[]
11for B_L in B_list_unsorted:
12    A = B_L.split('=')[0] + '=' # first part of string
13    B = float(B_L.split('=')[1].split('_')[0]) # middle part of string
14    C = '_' + B_L.split('=')[1].split('_')[1] # last part of string
15    B_current = [A,B,C]; B_strings.append(B_current)
16
17B_strings.sort(key=operator.itemgetter(1))
18#B_strings.sort(lambda x, y: cmp(x[1],y[1]))
19
20for stt in B_strings:
21    stt[1]=str(stt[1])
22    final=string.join(stt).replace(' ','')
23    B_list.append(final)
24print B_list
25print "list sorted"
Note: See TracBrowser for help on using the repository browser.