-
Notifications
You must be signed in to change notification settings - Fork 3
Description
parse_unit (from sasdata/quantities/unit_parser.py) throws errors when given a unit it is not familiar with. This behavior can be reproduced by running parse_unit('foo') where the input string is any string that is not recognized.
A consistent policy should be developed for handling unfamiliar units.
My opinion: There should be some way of accommodating unknown units without crashing. This is important because, for example, metadata from different instruments may have either non-standard ways of representing units or non-standard units. It is important to include as much metadata as completely as possible under the FAIR data principle.
It is impractical to assume though that we can accommodate every single unit and all their conversions, and indeed sometimes it is necessary to work with a nonstandard unit.
My suggestion is that a non-standard unit should be treated as a new type of unit, entirely separate from the base SI classes. For example, if I have a pressure that is saved in metadata as "mm of mercury", if it is not included in _build_tables.py that 1 mmHg = 133.322387415 pascals, then treat "mm of mercury" as its own separate dimensional unit. It would not be equivalent to any other units. If you do math with it, you will get a derived quantity, so [1 mm of mercury] x [1 kg] = [1 mm of mercury x kg] and so on. Even [1 mm of mercury] x [1 pascal] = [1 mm of mercury / pascal]. This approach allows the unit to be included as metadata with a reported unit of some kind (so that it can be reported and plotted appropriately), and other values can be derived from it still if necessary.