Skip to content

Commit

Permalink
fix(SkillCorner): load data error for game ids 2269 and 3442
Browse files Browse the repository at this point in the history
Fixes #192
  • Loading branch information
probberechts committed Dec 17, 2024
1 parent dff0204 commit 340e5f6
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions kloppy/infra/serializers/tracking/skillcorner.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import json
import logging
from datetime import timedelta, timezone
from dateutil.parser import parse
import warnings
from typing import NamedTuple, IO, Optional, Union, Dict
from collections import Counter
import numpy as np
import json
from datetime import timedelta, timezone
from pathlib import Path
from typing import IO, Dict, NamedTuple, Optional, Union

import numpy as np
from dateutil.parser import parse

from kloppy.domain import (
attacking_direction_from_frame,
AttackingDirection,
DatasetFlag,
Frame,
Expand All @@ -18,14 +18,15 @@
Orientation,
Period,
Player,
PlayerData,
Point,
Point3D,
PositionType,
Provider,
Score,
Team,
TrackingDataset,
PlayerData,
attacking_direction_from_frame,
)
from kloppy.infra.serializers.tracking.deserializer import (
TrackingDataDeserializer,
Expand Down Expand Up @@ -133,15 +134,18 @@ def _get_frame_data(
track_id = frame_record.get("track_id", None)
group_name = frame_record.get("group_name", None)

if trackable_object == ball_id:
group_name = "ball"
if trackable_object == ball_id or group_name == "balls":
group_name = "balls"
z = frame_record.get("z")
if z is not None:
z = float(z)
ball_coordinates = Point3D(x=float(x), y=float(y), z=z)
continue

elif trackable_object in referee_dict.keys():
elif (
trackable_object in referee_dict.keys()
or group_name == "referee"
):
group_name = "referee"
continue # Skip Referee Coords

Expand Down

0 comments on commit 340e5f6

Please sign in to comment.