-
Notifications
You must be signed in to change notification settings - Fork 67
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
[DataTransformer] Updating metadata does not behave as expected #407
Comments
I was trying to wrap my head around why this does not work. If I run your code example, it indeed does not update the metadata. On the other hand, in the tests it seems to work fine. See for example here. Any idea why this fails? It's not related to tracking vs event data. Same issue when transforming Stats Perform tracking data. |
The only thing I can think of is that The reason I say this is because I think the replace function is used to replace frozen objects, but I can't remember where I read that. Why it does work in the tests, I have no idea. I would not be surprised if this is a bug in the dataclass library, simply because it seems to behave irrationally, but I have not gone so far as to check that. |
I've found it! It's the |
Ha, it's always obvious in hindsight! I read something in de the docs the hinted at this last night, but you solved it already before I could say anything 👍 |
What result did you actually expect to get from the code above?
Footnotes
|
I think answer 2. I load event data with the default coordinates, then I transform them to a custom coordinate system with pitch dimensions in meters. Then I expect the dataset.metadata to reflect this change in coordinate system. |
Fixes PySport#407: Transforming the pitch dimensions of a dataset with a coordinate system will now change the dataset's coordinate system to a `CustomCoordinateSystem` with the specified pitch dimensions. As a side effect, makes it easier to create a custom coordinate system: ``` from kloppy.domain import CustomCoordinateSystem my_coordinate_system = CustomCoordinateSystem( origin=..., vertical_orientation=..., pitch_dimensions=..., ) ```
Let's assume I want to update the default Opta pitch coordinates, something like:
If I now look at the actual coordinates, they are transformed correctly. However, the
dataset.metadata
does not seem to get updated accordingly.We have something in place inside the DataTransformer that should handle this, namely at line #403.
Unfortunately, this replace does not seem to actually replace anything, and the new
metadata
object still contains the old pitch dimensions.The text was updated successfully, but these errors were encountered: