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

Why spacing information is added as a new coordinate #124

Closed
lanougue opened this issue Nov 17, 2020 · 4 comments
Closed

Why spacing information is added as a new coordinate #124

lanougue opened this issue Nov 17, 2020 · 4 comments

Comments

@lanougue
Copy link
Contributor

When computing xrft.dft over dimension "x", a "freq_x_spacing" is added in the output as a new coordinates of dimension "1".
This new coord is disturbing since its not really a new dimension/coordinate.
Could it be better option to add this spacing information in output attributes instead of coordinates ?

@rabernat
Copy link
Collaborator

Could it be better option to add this spacing information in output attributes instead of coordinates ?

Yes, that would be fine with me! This was a somewhat random choice early on.

@lanougue
Copy link
Contributor Author

I think this spacing parameter should be a coordinate's attribute instead of an attribute of the dft itself.
The reason is that attributes are easily removed with simple operation such as
A = xr.dft(..., dim='x')
B = 3*A
B have lost spacing attributes.

However, if spacing is an attribute of freq_x in A, it will be kept in B. It will be removed only if some operation is realized on the freq_x coordinate vector (which is almost never happening).
The user can of course use xr.set_options(keep_attrs=True) but I don't think it is desirable.
And, spacing is, by definition, a coordinate attributes.
What do you think ?

@lanougue
Copy link
Contributor Author

I opened PR #126 to discuss about that

@lanougue
Copy link
Contributor Author

lanougue commented Dec 4, 2020

solved in PR #126

@lanougue lanougue closed this as completed Dec 4, 2020
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

No branches or pull requests

2 participants