Skip to content

defaultUnit returns undefined when the default is a derived unit #851

Description

@VisLab

In HED 8.5.0 a unit class may name a derived unit as its default. currentUnits lists only ampere and A but has defaultUnits=mA; likewise powerUnits (mW), resistanceUnits (kOhm), and electricPotentialUnits (uV, now that the explicit uV entry is removed).

Current behavior: SchemaUnitClass.defaultUnit (src/schema/entries.js) looks the default up among the explicitly listed units only, so it returns undefined for all four classes.

Expected behavior: return the listed unit from which the default derives (A for mA, W for mW, Ohm for kOhm, V for uV). For 8.4.0 nothing changes, since every default there is listed explicitly.

Nothing in src/ calls this getter today, but tests/otherTests/schema.spec.js does, and that test also hard-codes the 8.4.0 unit lists. When it is updated for 8.5.0 it needs the eight new unit classes and should compare the default by derivation rather than by name.

Same change is needed in hed-typescript (src/schema/entries/unitClass.ts).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions