-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add StatsBomb shot result coordinates #232
Add StatsBomb shot result coordinates #232
Conversation
The "result_coordinates" field of ShotEvent now contains the shot's end coordinates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Would it be possible to also add a test for this change?
I've added a test and it also deserializes the z-coordinate now. One thing I'm not sure about is how to deal with the cell-based coordinates here. It probably makes sense to put the y-coordinates of shots at 120 instead of 119.95 and I don't know whether the (same) cell-based coordinates are also used for the z-coordinate. |
According to StatsBomb's shot fidelity specification, the y-coordinates and z-coordinates of shot end locations are expressed in tenths of a yard, regardless of the shot fidelity version. Moreover, as of shot fidelity version 2, all coordinates associated with shots and events paired with shots are expressed in tenths of a yard. |
ded7460
to
61b137e
Compare
🤔 This shot fidelity thing is getting complicated. Is this correct:
Note that this does not correspond to what is stated in the docs of the open data:
And clarifying my doubt regarding the y-coordinate of the end location of a shot:
|
Could you please remind me what the rationale behind the cell-based approach is? If my understanding is correct, StatsBomb rounds coordinates either to the nearest yard or to the nearest tenth of a yard. Intuitively, it would make sense to me to keep the original coordinates for events such as goals, penalty kicks and corner kicks. According to the Shot Fidelity V2 specification, which seems to be only available to StatsBomb customers, the situation is as follows.
|
https://twitter.com/lemonwatcher/status/1267784042776154112 According to the docs StatsBomb coordinates are rounded to the nearest (tenth of) a yard, according to Thom they are rounded up. |
My idea was that when (0,1] is rounded up to 1, it would mean the cell ((0,1], (0,1]) is indicated by the point (1,1). I guess the “estimate position in cell” needs to take the type of event into account and switch to something else than average in certain cases. |
f41c9f2
to
375b8d6
Compare
I've looked at some data and this seems to be accurate indeed. I've implemented it like this now.
We've implemented it like that in socceraction too. I think it is the best approach.
I agree. It makes sense to do this for kick-offs, corners, penalties, goal-kicks, and shot end coordinates. However, I do not plan to do it in this PR since it would require some more extensive changes to the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The changes look good to me.
The "result_coordinates" field of ShotEvent now contains the shot's end coordinates.