Skip to content
Newer
Older
100755 35 lines (28 sloc) 919 Bytes
f6a92ce @wdenton Added scripts
authored
1 #!/usr/bin/env ruby
2
3 data_file = ARGV[0]
4
5 # First, make a hash that maps LC class letters to numbers
6 map_file = 'lc-map.txt'
7
8 lcmap = {}
9
10 # Write out a 0 entry for each LC class letter,
11 # so that the number of things on the x-axis is
12 # constant for all libraries. (If a library only
13 # has things in Q, then they need to line up with
14 # what other libraries have in Q, not be all jammed
15 # up against the y-axis because there's nothing from
16 # A-P.)
17 File.open(map_file).each_with_index do |class_letters, i|
18 lcmap[class_letters.chomp] = i
19 puts "#{i} 0"
20 end
21
22 # Mark the y-axis all the way out to 10,000
23 10000.times do |i|
24 puts "0 #{i}"
25 end
26 #puts "0 10000"
27
28 File.open(data_file).each do |lc|
29 callNum = lc.split
30 next unless lcmap[callNum[0]] # Avoid K and strange letters
31 next unless callNum[1]
32 next unless callNum[1].to_i < 10000 # Avoid strangely large numbers
33 puts "#{lcmap[callNum[0]]} #{callNum[1]}"
34 end
Something went wrong with that request. Please try again.