Fhir.Metrics
Fhir.Metrics copied to clipboard
Cel/K conversion fails
I am trying to convert Celsius to its base unit Kelvin using the following code:
SystemOfUnits system = UCUM.Load();
Quantity quantity = new Quantity(39m, system.Metric("Cel"));
quantity = system.Canonical(quantity);
But it fails with the exception "Quantity could not be converted to base units" on the method call system.Canonical.
Debugging Fhir.Metrics I see that an exception is thrown on the following line UcumReader.cs#L132 since the unit definition in ucum-essence.xml#L311 is deviating a bit from the other unit definitions, lacking the value attribute on the node unit/value, maybe by design. Still the conversion is not loaded into memory, as far as I can see, because of the exception.