Commit a2bbb10aafc6400a9a15fea8248dfc0b0137e66e

Authored by Jordi Inglada
1 parent 08fa64e5
Exists in master

BUG: sorting bands as integers

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
scripts/rsr_select_bands.py
... ... @@ -18,13 +18,15 @@ import string
18 18 import sys
19 19  
20 20 def rsr_select_bands(input_rsr_file, output_rsr_file, band_list):
21   - print "Selecting bands "+string.join(sorted(band_list),', ')
  21 + bl = [int(b) for b in band_list]
  22 + band_list = [str(b) for b in sorted(bl)]
  23 + print "Selecting bands "+string.join(band_list,', ')
22 24 with open(input_rsr_file, 'r') as irsr:
23 25 with open(output_rsr_file, 'w') as orsr:
24 26 for l in irsr.readlines():
25 27 fields = string.split(l)
26 28 ol = fields[0]+" "+fields[1]
27   - for b in sorted(band_list):
  29 + for b in band_list:
28 30 ol += " "+fields[int(b)+1]
29 31 orsr.write(ol+"\n")
30 32  
... ...