cwgame: Game information extractor¶
cwgame is a command-line tool which extracts summary
information about each game in the data file.
These fields
are grouped into two categories. There are 83 fields which are
compatible with the Retrosheet BGAME game descriptor tool. These
are specified using the -f
command-line flag. In addition, cwgame
offers a number “extended” fields which expand upon or give more
detailed information not easily accessed via the standard
fields. These are are specified using the -x
command-line flag.
Many of these extended fields are defined to match fields which appear
in the Retrosheet gamelogs.
Note
cwgame guarantees that the standard field numbers will match those used by BGAME. Standard field numbers therefore can be treated as stable, and it should be safe to write scripts referring to them. Extended fields are provisional, and extended fields may be added or withdrawn in future versions. Extended fields are assigned numbers to maintain a logical cohesion, with related fields being grouped. Therefore, extended field numbers are not promised to be stable. It is recommended to use the field labels instead in writing scripts to process the output of cwgame extended fields.
The following table gives the contents of each of the 84 fields cwgame outputs.
Field number |
Description |
Header |
---|---|---|
0 |
Game ID |
|
1 |
Date |
|
2 |
Game number |
|
3 |
Day of week |
|
4 |
Start time |
|
5 |
DH used flag |
|
6 |
Day/night flag |
|
7 |
Visiting team |
|
8 |
Home team |
|
9 |
Game site |
|
10 |
Visitors starting pitcher |
|
11 |
Home starting pitcher |
|
12 |
Home plate umpire |
|
13 |
First base umpire |
|
14 |
Second base umpire |
|
15 |
Third base umpire |
|
16 |
Left field umpire |
|
17 |
Right field umpire |
|
18 |
Attendance |
|
19 |
PS scorer |
|
20 |
Translator |
|
21 |
Inputter |
|
22 |
Input time |
|
23 |
Edit time |
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
Time of game |
|
33 |
Number of innings |
|
34 |
Visitor final score |
|
35 |
Home final score |
|
36 |
Visitor hits |
|
37 |
Home hits |
|
38 |
Visitor errors |
|
39 |
Home errors |
|
40 |
Visitor left on base |
|
41 |
Home left on base |
|
42 |
Winning pitcher |
|
43 |
Losing pitcher |
|
44 |
Save |
|
45 |
Game-winning RBI |
|
46 |
Visitor batter 1 |
|
47 |
Visitor batter 1 position |
|
48 |
Visitor batter 2 |
|
49 |
Visitor batter 2 position |
|
50 |
Visitor batter 3 |
|
51 |
Visitor batter 3 position |
|
52 |
Visitor batter 4 |
|
53 |
Visitor batter 4 position |
|
54 |
Visitor batter 5 |
|
55 |
Visitor batter 5 position |
|
56 |
Visitor batter 6 |
|
57 |
Visitor batter 6 position |
|
58 |
Visitor batter 7 |
|
59 |
Visitor batter 7 position |
|
60 |
Visitor batter 8 |
|
61 |
Visitor batter 8 position |
|
62 |
Visitor batter 9 |
|
63 |
Visitor batter 9 position |
|
64 |
Home batter 1 |
|
65 |
Home batter 1 position |
|
66 |
Home batter 2 |
|
67 |
Home batter 2 position |
|
68 |
Home batter 3 |
|
69 |
Home batter 3 position |
|
70 |
Home batter 4 |
|
71 |
Home batter 4 position |
|
72 |
Home batter 5 |
|
73 |
Home batter 5 position |
|
74 |
Home batter 6 |
|
75 |
Home batter 6 position |
|
76 |
Home batter 7 |
|
77 |
Home batter 7 position |
|
78 |
Home batter 8 |
|
79 |
Home batter 8 position |
|
80 |
Home batter 9 |
|
81 |
Home batter 9 position |
|
82 |
Visitor finishing pitcher |
|
83 |
Home finishing pitcher |
|
Field number |
Description |
Header |
---|---|---|
0 |
visiting team league |
|
1 |
home team league |
|
2 |
visiting team game number |
|
3 |
home team game number |
|
4 |
length of game in outs |
|
5 |
information on completion of game |
|
6 |
information on forfeit of game |
|
7 |
information on protest of game |
|
8 |
visiting team linescore |
|
9 |
home team linescore |
|
10 |
visiting team AB |
|
11 |
visiting team 2B |
|
12 |
visiting team 3B |
|
13 |
visiting team HR |
|
14 |
visiting team RBI |
|
15 |
visiting team SH |
|
16 |
visiting team SF |
|
17 |
visiting team HP |
|
18 |
visiting team BB |
|
19 |
visiting team IBB |
|
20 |
visiting team SO |
|
21 |
visiting team SB |
|
22 |
visiting team CS |
|
23 |
visiting team GDP |
|
24 |
visiting team reach on interference |
|
25 |
number of pitchers used by visiting team |
|
26 |
visiting team individual ER allowed |
|
27 |
visiting team team ER allowed |
|
28 |
visiting team WP |
|
29 |
visiting team BK |
|
30 |
visiting team PO |
|
31 |
visiting team A |
|
32 |
visiting team PB |
|
33 |
visiting team DP |
|
34 |
visiting team TP |
|
35 |
home team AB |
|
36 |
home team 2B |
|
37 |
home team 3B |
|
38 |
home team HR |
|
39 |
home team RBI |
|
40 |
home team SH |
|
41 |
home team SF |
|
42 |
home team HP |
|
43 |
home team BB |
|
44 |
home team IBB |
|
45 |
home team SO |
|
46 |
home team SB |
|
47 |
home team CS |
|
48 |
home team GDP |
|
49 |
home team reach on interference |
|
50 |
number of pitchers used by home team |
|
51 |
home team individual ER allowed |
|
52 |
home team team ER allowed |
|
53 |
home team WP |
|
54 |
home team BK |
|
55 |
home team PO |
|
56 |
home team A |
|
57 |
home team PB |
|
58 |
home team DP |
|
59 |
home team TP |
|
60 |
home plate umpire name |
|
61 |
first base umpire name |
|
62 |
second base umpire name |
|
63 |
third base umpire name |
|
64 |
left field umpire name |
|
65 |
right field umpire name |
|
66 |
visitors manager ID |
|
67 |
visitors manager name |
|
68 |
home manager ID |
|
69 |
home manager name |
|
70 |
winning pitcher name |
|
71 |
losing pitcher name |
|
72 |
save pitcher name |
|
73 |
batter with goahead RBI ID |
|
74 |
batter with goahead RBI |
|
75 |
visitor batter 1 name |
|
76 |
visitor batter 2 name |
|
77 |
visitor batter 3 name |
|
78 |
visitor batter 4 name |
|
79 |
visitor batter 5 name |
|
80 |
visitor batter 6 name |
|
81 |
visitor batter 7 name |
|
82 |
visitor batter 8 name |
|
83 |
visitor batter 9 name |
|
84 |
home batter 1 name |
|
85 |
home batter 2 name |
|
86 |
home batter 3 name |
|
87 |
home batter 4 name |
|
88 |
home batter 5 name |
|
89 |
home batter 6 name |
|
90 |
home batter 7 name |
|
91 |
home batter 8 name |
|
92 |
home batter 9 name |
|
93 |
additional information |
|
94 |
acquisition information |
|
How scored (field 24)¶
This field outputs a numeric code corresponding to the medium by which the play-by-play account was recorded.
Code |
Description |
---|---|
0 |
unknown |
1 |
park |
2 |
tv |
3 |
radio |
Pitches entered (field 25)¶
This field outputs a numeric code corresponding to the level of pitch detail in the file.
Code |
Description |
---|---|
0 |
unknown |
1 |
pitches |
2 |
count |
3 |
none |
Note
This field reports the contents of the info,pitches field in the game file. Some games with partial pitch information will have this field set to none or count.
Temperature (field 26)¶
The game-time temperature, in degrees Fahrenheit. The value 0 is used when the temperature is unknown.
Wind direction (field 27)¶
This field outputs a numeric code corresponding to the direction of the wind.
Code |
Description |
---|---|
0 |
unknown |
1 |
tolf |
2 |
tocf |
3 |
torf |
4 |
ltor |
5 |
fromlf |
6 |
fromcf |
7 |
fromrf |
8 |
rtol |
Wind speed (field 28)¶
The game time wind speed, in miles per hour. The value -1 is used when the wind speed is unknown.
Field condition (field 29)¶
This field outputs a numeric code corresponding to the condition of the field.
Code |
Description |
---|---|
0 |
unknown |
1 |
soaked |
2 |
wet |
3 |
damp |
4 |
dry |