Feature request: Units
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.
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.
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.nameandattrs.units(if available) to label the axes. The nameslong_name,standard_nameandunitsare copied from the CF-conventions spec. When choosing names, the order of precedence islong_name,standard_nameand finallyDataArray.name.
A quick update:
- There is a new feature in xarray to better support units
- 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 #215)