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

Feature request: Units #184

Open
cmichelenstrofer opened this issue Jul 28, 2022 · 3 comments
Open

Feature request: Units #184

cmichelenstrofer opened this issue Jul 28, 2022 · 3 comments

Comments

@cmichelenstrofer
Copy link
Contributor

It would be helpful if the results Included units as attributes for the different data variables and coordinates, e.g. , for ds.added_mass, ds.omega, etc.

@mancellin
Copy link
Collaborator

Yes, it would be nice.
It is not straightfoward though: even for a single rigid body, the translation and rotation dofs have different units in the equation of motion. In other word, each component of e.g. the inertia matrix or the added mass matrix may have a different unit.

@cmichelenstrofer
Copy link
Contributor Author

cmichelenstrofer commented Jul 29, 2022

Oh right! That complicates things a bit. Maybe it can be added only for the rigid body DOFS. The code already deals with these (e.g., "Heave", "Pitch", etc) separately anyways. Would be a bit more work than I thought but it is doable and maybe worth it. One of the nice things about xarray is having that sort of metadata. In particular the name and units get used by the plotting functionality, which is really nice.

Xarray uses the coordinate name along with metadata attrs.long_name, attrs.standard_name, DataArray.name and attrs.units (if available) to label the axes.
The names long_name, standard_name and units are copied from the CF-conventions spec.
When choosing names, the order of precedence is long_name, standard_name and finally DataArray.name.

@mancellin
Copy link
Collaborator

A quick update:

  1. There is a new feature in xarray to better support units
  2. It might be possible to define the ampitude of motion of translation and rotation dof with the same unit to have a matrix that is dimensionnally homogeneous. What is missing in the documentation is a clear definition of the amplitude of the dofs and the motion. (Been thinking about that because of New data model for dofs #215)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants