Skip to content

Multiple coordinates for same dimension? #5482

Answered by keewis
RubendeBruin asked this question in Q&A
Discussion options

You must be logged in to vote

It should be possible to use non-dimension coordinates but you would need to use distinct names like "frequency" and "angular_velocity". For example:

ds = (
    xr.Dataset(coords={"frequency": [1, 2, 3]})
    .assign_coords(angular_velocity=lambda ds: ("frequency", ds.frequency * 2 * np.pi))
)

I would also recommend to have a look at pint-xarray which should make working with units easier. It is still experimental, though, so I very much welcome feedback.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by RubendeBruin
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@keewis
Comment options

@niksirbi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants