Skip to content
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

Refactored coordinate serialization #354

Merged
merged 3 commits into from
Jun 28, 2023

Conversation

aniketsinghrawat
Copy link
Contributor

As we are performing json serialization on coordinates in get_coordinates() here

to_json_serializable_type(v)

Indexing by dimension coordinate labels fails for coordinates that are serialized to types not index-able by xarray (eg datetime.timedelta is serialized to floats; so when timedelta is a coordinate, .loc[] fails as it gives type mis match error)

for it in coordinates:
# Use those index values to select a Dataset containing one row of data.
row_ds = data_ds.loc[it]

This is fixed by performing json serialization after the indexing is done.

@mahrsee1997 mahrsee1997 requested a review from alxmrs June 28, 2023 10:37
Copy link
Collaborator

@alxmrs alxmrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@alxmrs alxmrs merged commit ed62877 into google:main Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants