Ensure that all base quantity units are BaseUnits#1488
Conversation
| new UnitInfo<TemperatureChangeRateUnit>(TemperatureChangeRateUnit.DegreeKelvinPerSecond, "DegreesKelvinPerSecond", new BaseUnits(time: DurationUnit.Second, temperature: TemperatureUnit.Kelvin), "TemperatureChangeRate"), | ||
| new UnitInfo<TemperatureChangeRateUnit>(TemperatureChangeRateUnit.HectodegreeCelsiusPerSecond, "HectodegreesCelsiusPerSecond", BaseUnits.Undefined, "TemperatureChangeRate"), | ||
| new UnitInfo<TemperatureChangeRateUnit>(TemperatureChangeRateUnit.KilodegreeCelsiusPerSecond, "KilodegreesCelsiusPerSecond", new BaseUnits(time: DurationUnit.Millisecond, temperature: TemperatureUnit.DegreeCelsius), "TemperatureChangeRate"), | ||
| new UnitInfo<TemperatureChangeRateUnit>(TemperatureChangeRateUnit.MicrodegreeCelsiusPerSecond, "MicrodegreesCelsiusPerSecond", BaseUnits.Undefined, "TemperatureChangeRate"), |
There was a problem hiding this comment.
Ok check this out, I found another limitation of the UnitPrefixBuilder - given that the Temperature now has a the BaseUnit set for MillidegreesCelsius, you'd think that this would get resolved here. However, the reason it doesn't is because there is nothing in Temperature.json that links the MillidegreesCelsius to the prefix Milli (outside the name). The same applies to the TemperatureDelta.g.cs where the MillidegreesCelsius doesn't have any BaseUnits, as it is prefixed, while the base quantity isn't.
I've checked for other conventionally defined prefixes in the base quantities, and found just the Microinch (as well as the Mil, if this is supposed to be Kilo). There isn't anything stopping us from making the Microinch a simple prefix unit:
{
"SingularName": "Inch",
"PluralName": "Inches",
"BaseUnits": {
"L": "Inch"
},
"FromUnitToBaseFunc": "{x} * 2.54e-2",
"FromBaseToUnitFunc": "{x} / 2.54e-2",
"Prefixes": [ "Micro" ],
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "in", "\\\"", "″" ],
"AbbreviationsForPrefixes": { "Micro": "µin" }
},
{
"Culture": "ru-RU",
"Abbreviations": [ "дюйм" ],
"AbbreviationsForPrefixes": { "Micro": "микродюйм" }
},
{
"Culture": "zh-CN",
"Abbreviations": [ "英寸" ],
"AbbreviationsForPrefixes": { "Micro": "微英寸" }
}
]
}, I tested it locally, hoping to see some other quantity picking up on the newly available prefix, but there weren't any (I think there should be some, but are probably just missing their BaseUnits).
For the Mil yeah, not gonna happen.. And the Temperature, we cannot have it as Prefix since it is an affine quantity. I could of course, hard-code them in the BaseUnitPrefixes 😄
Ensure that all base quantity units are
BaseUnits:Length,Massetc.) that ensures that all of their units have validBaseUnitsdefinitionBaseUnitsdefinitions:Acceleration.StandardGravityandTemperature.MillidegreeCelsiusBaseUnitsdefinitions:Length,TemperatureandTemperatureChangeRate(removing 3 out of its 4[Skip]-ed tests)