Closed JakeColor closed 2 years ago
Is a shot allowed from the defensive part of the rink? because I thought that a goal or shot is done from half of the rink so I just flipped all the (x,y) that happens in the other half (e.g. when x is [-100,0]) If a shot/goal can be done from every spot in the rink then we should go your way and see if the home/away will be flipped at anytime.
and shouldn't the coord_y
also be flipped in the case of period%2=0
?
@saraEbrahim answering your q's:
Is a shot allowed from the defensive part of the rink?
yes
and shouldn't the coord_y also be flipped in the case of period%2=0?
good observation, i agree!
solved by #13
Summary
download_data
style pipeline to filter the raw play data, apply the above logic, convert to pandas, and write out CSVs to atidy/
data directoryDescription
As I explore the data generated by Sara's original
shot_maps
/tidy_data
work, I realized we haven't properly accounted for how teams switch sides during hockey games.We also didn't actually apply the tidy data transformation to generate a cleaned dataset (in
/data/tidy/
), so this is a good opportunity to go back and put in place a cleaner foundation for the visualization work we have ahead of us.Context
Teams switch sides during hockey games: during the 2nd period, they skate in the opposite direction that they did in the 1st and 3rd periods. This is obvious if we look at median shot coordinates for the first period:
Action
We need to clean our data by transforming event coordinates to always be positive when the event takes place in the event-producing team's offensive zone, and negative when they occur in the defensive zone.
As a first pass, i think we should go rule-based:
home
team (metadata available in JSON) andperiod%2 == 0
, thencoord_x = - coord_x
away
teamNote: It's also possible that some team's arenas built the "home" side on the opposite-side of normal, which we would also have to account for because the logic above would be inverted.
But i'm 100% sure this happens in the NHL, or is already accounted for. If so, It will jump out when we check ourselves after applyg the naive rule-based transformation