# This file defines all units daisy knows about. # Each unit is an entry in the `unit` array. # # # Basic properties: # enum_name: unique capitalized string. The name of this unit's enum element. # base: if true, this is a base unit. Optional, false if omitted. # no_space: if true, don't put a space between this unit and its number. Optional, false if omitted. # strings: array of arrays of strings. Specifies what strings are interpreted as this unit. # Each entry looks like ["s", ...], where the first item is a string and ... is an optional list of valid prefixes. See `prefix.rs`. # Note that the empty string must be in the list of prefixes if you want the string to be available without a prefix. # Units with no prefix must be a one-element array. # The first string in this array will be the string we print when displaying this unit. # # # Base units (only apply if base = false): # base_value_type: one of "exact", "approx", "fract" # base_value: Depends on value type. # if exact or approx: string representing a number # if fract: two-element array that looks like [1, 7]. # both entries must be integers. The above array is interpreted as 1/7. # # "exact" implies that this is an exact decimal conversion factor # "approx" implies that this is an approximate decimal conversion factor # "fract" implies that this is an exact fractional conversion factor. # # # base_units: Array of tables, looks like {u = "Second", p = 1} # u = base unit enum name # p = base unit power # Any unit included here MUST have `base = true`. THIS IS NOT CHECKED, THINGS WILL BREAK! [[unit]] enum_name = "Second" strings = [ ["s", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["sec"], ["second"], ["seconds"] ] base = true [[unit]] enum_name = "Gram" strings = [ ["g", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["gram"], ["grams"], ["gramme"], ["grammes"] ] base = true [[unit]] enum_name = "Meter" strings = [ ["m", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["meter"], ["meters"] ] base = true [[unit]] enum_name = "Ampere" strings = [ ["A", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["ampere"], ["amperes"], ["amp"] ] base = true [[unit]] enum_name = "Kelvin" strings = [ ["K", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["Kelvin"], ["kelvin"] ] base = true [[unit]] enum_name = "Mole" strings = [ ["mol", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["mole"] ] base = true [[unit]] enum_name = "Candela" strings = [ ["cd", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["candela"] ] base = true # Time Units [[unit]] enum_name = "Minute" strings = [ ["min"], ["minute"], ["minutes"] ] base_value_type = "exact" base_value = "60" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Hour" strings = [ ["h"], ["hour"], ["hours"] ] base_value_type = "exact" base_value = "3600" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Day" strings = [ ["d"], ["day"], ["days"] ] base_value_type = "exact" base_value = "86400" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Week" strings = [ ["w"], ["week"], ["weeks"] ] base_value_type = "exact" base_value = "604800" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Month" strings = [ ["month"], ["months"] ] base_value_type = "exact" base_value = "2629746" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Fortnight" strings = [ ["fortnight"], ["fortnights"] ] base_value_type = "exact" base_value = "1209600" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "GregorianYear" strings = [ ["year"], ["years"] ] base_value_type = "exact" base_value = "31557000" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "JulianYear" strings = [ ["julianYear"], ["julianYears"], ["julianyear"], ["julianyears"] ] base_value_type = "exact" base_value = "31557600" base_units = [ { u = "Second", p = 1} ] # Length Units [[unit]] enum_name = "Angstrom" strings = [ ["Å"], ["angstrom"] ] base_value_type = "exact" base_value = "1e-10" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Thou" strings = [ ["thou"] ] base_value_type = "exact" base_value = "0.0000254" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Point" strings = [ ["pt"], ["point"] ] base_value_type = "exact" base_value = "0.0003514598" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Inch" strings = [ ["in"], ["inch"], ["inches"] ] base_value_type = "exact" base_value = "0.0254" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Foot" strings = [ ["ft"], ["foot"], ["feet"] ] base_value_type = "exact" base_value = "0.3048" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Yard" strings = [ ["yd"], ["yard"], ["yards"] ] base_value_type = "exact" base_value = "0.9144" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Furlong" strings = [ ["furlong"], ["furlongs"] ] base_value_type = "exact" base_value = "201.17" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Rod" strings = [ ["rod"], ["rods"] ] base_value_type = "exact" base_value = "5.0292" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Mile" strings = [ ["mi"], ["mile"], ["miles"] ] base_value_type = "exact" base_value = "1609.344" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "AstronomicalUnit" strings = [ ["au"], ["AU"], ["astronomicalUnit"], ["astronomicalUnits"], ["astronomicalunit"], ["astronomicalunits"] ] base_value_type = "exact" base_value = "149597870700" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Lightyear" strings = [ ["ly"], ["lightyear"], ["lightyears"] ] base_value_type = "exact" base_value = "9460730472580800" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Parsec" strings = [ ["pc"], ["parsec"], ["parsecs"] ] base_value_type = "exact" base_value = "3.085677581e16" base_units = [ { u = "Meter", p = 1} ] # Area units [[unit]] enum_name = "Barn" strings = [ ["barn"] ] base_value_type = "exact" base_value = "1e-28" base_units = [ { u = "Meter", p = 2} ] [[unit]] enum_name = "Hectare" strings = [ ["ha"], ["hectare"], ["hectares"] ] base_value_type = "exact" base_value = "10000" base_units = [ { u = "Meter", p = 2} ] [[unit]] enum_name = "Acre" strings = [ ["acre"], ["acres"] ] base_value_type = "exact" base_value = "4046.8564224" base_units = [ { u = "Meter", p = 2} ] # Volume units [[unit]] enum_name = "Liter" strings = [ ["l", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["L", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["liter"], ["liters"], ["litre"], ["litres"] ] base_value_type = "exact" base_value = "0.001" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "USGallon" strings = [ ["gal"], ["gals"], ["usgal"], ["gallon"], ["gallons"] ] base_value_type = "exact" base_value = "0.003785411784" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Quart" strings = [ ["qt"], ["quart"], ["quarts"] ] base_value_type = "exact" base_value = "0.000946352946" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "ImperialGallon" strings = [ ["impgal"], ["imperialGallon"], ["imperialGallons"] ] base_value_type = "exact" base_value = "0.00454609" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Hogshead" strings = [ ["hogshead"], ["hogsheads"] ] base_value_type = "exact" base_value = "0.2385" # 63 gallons base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Cup" strings = [ ["cup"] ] base_value_type = "exact" base_value = "0.0002365882365" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Floz" strings = [ ["floz"] ] base_value_type = "exact" base_value = "0.0000295735295625" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Pint" strings = [ ["pint"], ["pints"] ] base_value_type = "exact" base_value = "0.00056826125" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Tablespoon" strings = [ ["tbsp"], ["Tbsp"], ["tablespoon"], ["Tablespoon"] ] base_value_type = "exact" base_value = "0.00001478676478125" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Teaspoon" strings = [ ["tsp"], ["Tsp"], ["teaspoon"], ["teaspoons"] ] base_value_type = "exact" base_value = "0.000005" base_units = [ { u = "Meter", p = 3} ] # Pressure units [[unit]] enum_name = "Pascal" strings = [ ["Pa", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["pascal"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "Atmosphere" strings = [ ["atm"], ["atmosphere"], ["atmospheres"] ] base_value_type = "exact" base_value = "101325000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "Bar" strings = [ ["bar", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ] base_value_type = "exact" base_value = "100000000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "Barye" strings = [ ["Ba"], ["Barye"] ] base_value_type = "exact" base_value = "100" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "Psi" strings = [ ["psi"] ] base_value_type = "exact" base_value = "6894757.2931783" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "MillimeterMercury" strings = [ ["mmhg"], ["mmHg"] ] base_value_type = "exact" base_value = "133322.387415" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "Torr" strings = [ ["torr"], ["Torr"] ] base_value_type = "fract" base_value = [101325000, 760] base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "MeterSeaWater" strings = [ ["MSW"], ["msw"] ] base_value_type = "exact" base_value = "10000000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] [[unit]] enum_name = "FootSeaWater" strings = [ ["FSW"], ["fsw"] ] base_value_type = "exact" base_value = "3064330" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = -1}, { u = "Second", p = -2} ] # Electrical, Power, Etc [[unit]] enum_name = "Gauss" strings = [ ["G"], ["gauss"] ] base_value_type = "exact" base_value = "0.1" base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Ampere", p = -1} ] [[unit]] enum_name = "Tesla" strings = [ ["T", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["tesla"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Ampere", p = -1} ] [[unit]] enum_name = "Joule" strings = [ ["J", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["joule"], ["joules"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Meter", p = 2} ] [[unit]] enum_name = "Calorie" strings = [ ["cal"], ["calorie"], ["calories"] ] base_value_type = "exact" base_value = "4184" base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Meter", p = 2} ] [[unit]] enum_name = "BTU" strings = [ ["btu"], ["BTU"] ] base_value_type = "exact" base_value = "1055100" base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Meter", p = 2} ] [[unit]] enum_name = "Hertz" strings = [ ["Hz", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["hertz"], ["Hertz"] ] base_value_type = "exact" base_value = "1" base_units = [ { u = "Second", p = -1} ] [[unit]] enum_name = "Ohm" strings = [ ["Ω", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["ohm", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["ohms", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 2}, { u = "Ampere", p = -2}, { u = "Second", p = -3} ] [[unit]] enum_name = "Siemens" strings = [ ["S", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["℧"], ["mho"], ["mhos"], ["siemens"] ] base_value_type = "exact" base_value = "0.001" base_units = [ { u = "Gram", p = -1}, { u = "Meter", p = -2}, { u = "Ampere", p = 2}, { u = "Second", p = 3} ] [[unit]] enum_name = "Coulomb" strings = [ ["C", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["coulomb"], ["coulombs"] ] base_value_type = "exact" base_value = "0.001" base_units = [ { u = "Ampere", p = 1}, { u = "Second", p = 1} ] [[unit]] enum_name = "Watt" strings = [ ["W", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["watt"], ["Watt"], ["Watts"], ["watts"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 2}, { u = "Second", p = -3} ] [[unit]] enum_name = "Volt" strings = [ ["V", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["volt"], ["volts"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 2}, { u = "Second", p = -3}, { u = "Ampere", p = -1} ] [[unit]] enum_name = "Henry" strings = [ ["H", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["henry"], ["henries"], ["henrys"], ["Henry"], ["Henries"], ["Henrys"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 2}, { u = "Second", p = -2}, { u = "Ampere", p = -2} ] [[unit]] enum_name = "Farad" strings = [ ["F", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["farad"], ["Farad"], ["farads"], ["Farads"] ] base_value_type = "exact" base_value = "0.001" base_units = [ { u = "Gram", p = -1}, { u = "Meter", p = -2}, { u = "Second", p = 4}, { u = "Ampere", p = 2} ] [[unit]] enum_name = "ElectronVolt" strings = [ ["eV", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["electronvolt"], ["electronVolt"] ] base_value_type = "exact" base_value = "1.602176634e-16" base_units = [ { u = "Gram", p = 1}, { u = "Second", p = -2}, { u = "Meter", p = 2} ] [[unit]] enum_name = "Weber" strings = [ ["Wb", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["weber"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 2}, { u = "Second", p = -2}, { u = "Ampere", p = -1} ] # Mass and Force [[unit]] enum_name = "Tonne" strings = [ ["t"], ["tonne"], ["tonnes"], ["ton"], ["tons"] ] base_value_type = "exact" base_value = "1000000" base_units = [ { u = "Gram", p = 1} ] [[unit]] enum_name = "Ounce" strings = [ ["oz"], ["ounce"], ["ounces"] ] base_value_type = "exact" base_value = "28.349523125" base_units = [ { u = "Gram", p = 1} ] [[unit]] enum_name = "Pound" strings = [ ["lb"], ["lbs"], ["pound"], ["pounds"] ] base_value_type = "exact" base_value = "453.59237" base_units = [ { u = "Gram", p = 1} ] [[unit]] enum_name = "PoundForce" strings = [ ["lbf"], ["poundforce"] ] base_value_type = "exact" base_value = "4448.2216152605" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 1}, { u = "Second", p = -2} ] [[unit]] enum_name = "Newton" strings = [ ["N", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["newton"], ["newtons"], ["Newton"], ["Newtons"] ] base_value_type = "exact" base_value = "1000" base_units = [ { u = "Gram", p = 1}, { u = "Meter", p = 1}, { u = "Second", p = -2} ] # Misc Units [[unit]] enum_name = "Katal" strings = [ ["kat", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["katal"] ] base_value_type = "exact" base_value = "1" base_units = [ { u = "Mole", p = 1}, { u = "Second", p = -1} ] [[unit]] enum_name = "Degree" strings = [ ["°"], ["deg"], ["degree"], ["degrees"] ] base = true no_space = true [[unit]] enum_name = "Radian" strings = [ ["r"], ["radian"], ["radians"] ] base_value_type = "approx" base_value = "57.295779513" base_units = [ { u = "Degree", p = 1} ] [[unit]] enum_name = "RPM" strings = [ ["rpm"] ] base_value_type = "exact" base_value = "360" base_units = [ { u = "Degree", p = 1}, { u = "Second", p = -1} ] # Radioactivity [[unit]] enum_name = "Becquerel" strings = [ ["Bq", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["becquerel"] ] base_value_type = "exact" base_value = "1" base_units = [ { u = "Second", p = -1} ] [[unit]] enum_name = "Gray" strings = [ ["Gy", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["gray"] ] base_value_type = "exact" base_value = "1" base_units = [ { u = "Meter", p = 2}, { u = "Second", p = -2} ] [[unit]] # Not radian, radioactivity unit enum_name = "Rad" strings = [ ["rad", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ] base_value_type = "exact" base_value = "0.01" base_units = [ { u = "Meter", p = 2}, { u = "Second", p = -2} ] # Computing, Information [[unit]] enum_name = "Bit" strings = [ ["bit"], ["bits"] ] base = true [[unit]] enum_name = "Frame" strings = [ ["frame"], ["frames"] ] base = true [[unit]] enum_name = "Pixel" strings = [ ["px"], ["pixel"], ["pixels"], ["Pixel"], ["Pixels"] ] base = true [[unit]] enum_name = "Dot" strings = [ ["dot"], ["dots"] ] base = true [[unit]] enum_name = "Byte" strings = [ ["B", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["b", "","Q","R","Y","Z","E","P","T","G","M","k","h","da","d","c","m","u","n","p","f","a","z","y","r","q"], ["B", "Ei","Pi","Ti","Gi","Mi","Ki"], ["b", "Ei","Pi","Ti","Gi","Mi","Ki"], ["Bytes"], ["bytes"], ["Byte"], ["byte"], ["Octet"], ["Octets"], ["octets"], ["octet"] ] base_value_type = "exact" base_value = "8" base_units = [ { u = "Bit", p = 1} ]