PySport/kloppy

Different unit used for shot_event.result_coordinates.z dimension for Opta vs StatsBomb

DriesDeprest opened this issue · 3 comments

Opta: The ground is 0 and the (middle of the) crossbar is at 40
StatsBomb: The ground is 0 and the (middle of the) crossbar is at 2.7

I assume StatsBomb expresses it in yards, for Opta I don't know.

How should we enable users to easily obtain standardized units for the result coordinates of a shot?

I believe the Opta coordinates don't really have a unit. According to their documentation, Opta uses values on a 0 to 100 scale for the z coordinate and distinguishes between three zones to which different scaling factors apply to obtain coordinates in meters. They assume the crossbar is 12 centimeters wide.

  • Zone 1; below crossbar: 0 <= z < 38 - 2.44 / 38.
  • Zone 2; crossbar: 38 <= z < 42 - 0.12 / 4.
  • Zone 3; above crossbar: 42 <= z < 100 - 5.04 / 58.

Thanks for sharing.

Should the result coordinates z value of events in our kloppy events dataset be in the same unit regardless of the data provider we used as input? Or do we by default just take over the values used by the provider and only if the user specifies what unit (or provider) he wants to use, the values are adapted?

I implemented it like this on purpose. By default, all coordinates are in the data provider's standard coordinate system. Typically, this means that the x, y and z-coordinates are all in the same unit. Obviously, this breaks as soon as you apply a transformation since the CoordinateSystem currently does not have a z-axis. It seems logical to me to add a z-axis to the coordinate system.

The alternative, that is using a default unit for the z-coordinate, could have strange side effects. For example, having x-and y-coordinates in yards, but z-coordinates in meters would be confusing.

Also, this applies both to goalmouth coordinates in event data and ball z-coordinates in tracking data.