Docstrings in `basicShapes` classes erroneously include units
See original GitHub issueMany of the method docstrings of various classes within the basicShapes
and complexShapes
module include units when the methods are actually unit-agnostic. For instance, the getComponentArea
method of the Circle
class says “Computes the area for the circle component in cm^2”. Similar statements exist for other ShapedComponent
area and perimeter methods.
The units in these docstrings should be removed because they are potentially confusing and do not describe anything about the method itself. Yes, when used in the way expected, wherein the user provides the underlying dimensions to a ShapedComponent
in units of cm, the method returns area in units of cm^2. But the method itself has no idea what the units of its arguments are, and therefore the computed area is returned in whatever units are passed to the method (i.e. no checks or conversions are performed to ensure that the value returned is in units of cm^2). It also does not matter that the dimensions can be thermally expanded, because getThermalExpansionFactor
returns a unitless expansion factor and so unit compatibility is not an issue.
Because ARMI has an API, methods like getComponentArea
are likely to be used in unexpected ways wherein it cannot be assumed that the dimensions passed to it are in a given set of units without additional checks being implemented.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
You’d think that. cm for length is about the only well-standardized unit in ARMI, so we don’t have a big doc page with flashing lights telling everyone what all of the official units are like you might see in, say, MOOSE. If we had a page it wouldn’t be able to say much more than “ARMI uses centimeters for all Component dimensions,” and most people probably wouldn’t see it. So I feel that repeating the assertion throughout the docstrings where length and length-derives values are returned is beneficial.
That said, if there are examples where this isn’t the case, it would more improve the code to add units to docstrings than to remove them.
Thanks @john-science . I only very briefly looked around for similar occurrences, but didn’t find any. I’ll post on here if I see any more in the near term.