# 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. # print: string. What this unit will print as. This string will NOT be parsed into this unit. # 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. # # # 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! # # # Parsing: # parse: array of strings. These strings will be parsed into this unit. # parse_with_prefix: string or string array. Prefixes will be generated for this string, including the null prefix. # Strings in `parse_with_prefix` MUST NOT be in `parse`. [[unit]] enum_name = "Second" print = "s" parse_with_prefix = "s" parse = ["sec", "second", "seconds"] base = true [[unit]] enum_name = "Gram" print = "g" parse_with_prefix = "g" parse = ["gram", "grams", "gramme", "grammes"] base = true [[unit]] enum_name = "Meter" print = "m" parse_with_prefix = "m" parse = ["meter", "meters"] base = true [[unit]] enum_name = "Ampere" print = "A" parse_with_prefix = "A" parse = ["ampere", "amperes"] base = true [[unit]] enum_name = "Kelvin" print = "K" parse_with_prefix = "K" parse = ["kelvin"] base = true [[unit]] enum_name = "Mole" print = "mol" parse_with_prefix = "mol" parse = ["mole"] base = true [[unit]] enum_name = "Candela" print = "cd" parse_with_prefix = "cd" parse = ["candela"] base = true # Time Units [[unit]] enum_name = "Minute" print = "min" parse = ["min", "minute", "minutes"] base_value_type = "exact" base_value = "60" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Hour" print = "h" parse = ["h", "hour", "hours"] base_value_type = "exact" base_value = "3600" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Day" print = "d" parse = ["d", "day", "days"] base_value_type = "exact" base_value = "86400" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Week" print = "w" parse = ["w", "week", "weeks"] base_value_type = "exact" base_value = "604800" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Month" print = "month" parse = ["month", "months"] base_value_type = "exact" base_value = "2629746" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "Fortnight" print = "fortnight" parse = ["fortnight", "fortnights"] base_value_type = "exact" base_value = "1209600" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "GregorianYear" print = "year" parse = ["year", "years"] base_value_type = "exact" base_value = "31557000" base_units = [ { u = "Second", p = 1} ] [[unit]] enum_name = "JulianYear" print = "julianYear" parse = ["julianYear", "julianYears"] base_value_type = "exact" base_value = "31557600" base_units = [ { u = "Second", p = 1} ] # Length Units [[unit]] enum_name = "Angstrom" print = "Å" parse = ["Å", "angstrom"] base_value_type = "exact" base_value = "1e-10" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Thou" print = "thou" parse = ["thou"] base_value_type = "exact" base_value = "0.0000254" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Point" print = "pt" parse = ["pt", "point"] base_value_type = "exact" base_value = "0.0003514598" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Inch" print = "in" parse = ["in", "inch", "inches"] base_value_type = "exact" base_value = "0.0254" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Foot" print = "ft" parse = ["ft", "foot", "feet"] base_value_type = "exact" base_value = "0.3048" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Yard" print = "yd" parse = ["yd", "yard", "yards"] base_value_type = "exact" base_value = "0.9144" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Furlong" print = "furlong" parse = ["furlong", "furlongs"] base_value_type = "exact" base_value = "201.17" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Rod" print = "rod" parse = ["rod", "rods"] base_value_type = "exact" base_value = "5.0292" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Mile" print = "mi" parse = ["mi", "mile", "miles"] base_value_type = "exact" base_value = "1609.344" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "AstronomicalUnit" print = "au" parse = ["au", "AU", "astronomicalUnit", "astronomicalUnits"] base_value_type = "exact" base_value = "149597870700" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Lightyear" print = "ly" parse = ["ly", "lightyear", "lightyears"] base_value_type = "exact" base_value = "9460730472580800" base_units = [ { u = "Meter", p = 1} ] [[unit]] enum_name = "Parsec" print = "pc" parse = ["pc", "parsec", "parsecs"] base_value_type = "exact" base_value = "3.085677581e16" base_units = [ { u = "Meter", p = 1} ] # Area units [[unit]] enum_name = "Barn" print = "b" parse = ["b", "barn"] base_value_type = "exact" base_value = "1e-28" base_units = [ { u = "Meter", p = 2} ] [[unit]] enum_name = "Hectare" print = "ha" parse = ["hectare", "hectares"] base_value_type = "exact" base_value = "10000" base_units = [ { u = "Meter", p = 2} ] [[unit]] enum_name = "Acre" print = "acre" parse = ["acres"] base_value_type = "exact" base_value = "4046.8564224" base_units = [ { u = "Meter", p = 2} ] # Volume units [[unit]] enum_name = "Liter" print = "l" parse_with_prefix = ["l", "L"] parse = ["liter", "liters", "litre", "litres"] base_value_type = "exact" base_value = "0.001" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "USGallon" print = "gal" parse = ["gal", "gals", "usgal", "gallon", "gallons", "Gallon", "Gallons"] base_value_type = "exact" base_value = "0.003785411784" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Quart" print = "qt" parse = ["quart", "quarts"] base_value_type = "exact" base_value = "0.000946352946" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "ImperialGallon" print = "impgal" parse = ["imperialGallon", "imperialGallons"] base_value_type = "exact" base_value = "0.00454609" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Hogshead" print = "hogshead" parse = ["hogshead", "hogsheads"] base_value_type = "exact" base_value = "0.2385" # 63 gallons base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Cup" print = "cup" parse = ["cup"] base_value_type = "exact" base_value = "0.0002365882365" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Floz" print = "floz" parse = ["floz"] base_value_type = "exact" base_value = "0.0000295735295625" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Pint" print = "pint" parse = ["pint", "pints"] base_value_type = "exact" base_value = "0.00056826125" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Tablespoon" print = "tbsp" parse = ["tbsp", "Tbsp", "tablespoon", "Tablespoon"] base_value_type = "exact" base_value = "0.00001478676478125" base_units = [ { u = "Meter", p = 3} ] [[unit]] enum_name = "Teaspoon" print = "tsp" parse = ["tsp", "Tsp", "teaspoon", "teaspoons"] base_value_type = "exact" base_value = "0.000005" base_units = [ { u = "Meter", p = 3} ] # Pressure units [[unit]] enum_name = "Pascal" print = "Pa" parse_with_prefix = "Pa" parse = ["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" print = "atm" parse = ["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" print = "bar" parse_with_prefix = "bar" 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" print = "Ba" parse = ["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" print = "psi" parse = ["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" print = "mmHg" parse = ["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" print = "torr" parse = ["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" print = "MSW" parse = ["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" print = "FSW" parse = ["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" print = "G" parse = ["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" print = "T" parse = ["tesla"] parse_with_prefix = "T" 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" print = "J" parse = ["joule", "joules"] parse_with_prefix = "J" 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" print = "cal" parse = ["calorie", "calories"] parse_with_prefix = "cal" 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" print = "BTU" parse = ["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" print = "Hz" parse = ["hertz"] parse_with_prefix = "Hz" base_value_type = "exact" base_value = "1" base_units = [ { u = "Second", p = -1} ] [[unit]] enum_name = "Ohm" print = "Ω" parse = ["ohms"] parse_with_prefix = ["ohm", "Ω"] 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" print = "S" parse = ["℧", "mho", "mhos", "siemens"] parse_with_prefix = "S" 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" print = "C" parse = ["coulomb", "coulombs"] parse_with_prefix = "C" base_value_type = "exact" base_value = "0.001" base_units = [ { u = "Ampere", p = 1}, { u = "Second", p = 1} ] [[unit]] enum_name = "Watt" print = "W" parse = ["watt", "Watt", "Watts", "watts"] parse_with_prefix = "W" 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" print = "V" parse = ["volt", "volts"] parse_with_prefix = "V" 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" print = "H" parse = ["henry", "henries", "henrys", "Henry", "Henries", "Henrys"] parse_with_prefix = "H" 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" print = "F" parse = ["farad", "Farad", "farads", "Farads"] parse_with_prefix = "F" 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" print = "eV" parse = ["electronvolt"] parse_with_prefix = "eV" 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" print = "Wb" parse = ["weber"] parse_with_prefix = "Wb" 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" print = "t" parse = ["t", "tonne", "tonnes", "ton", "tons"] base_value_type = "exact" base_value = "1000000" base_units = [ { u = "Gram", p = 1} ] [[unit]] enum_name = "Ounce" print = "oz" parse = ["oz", "ounce", "ounces"] base_value_type = "exact" base_value = "28.349523125" base_units = [ { u = "Gram", p = 1} ] [[unit]] enum_name = "Pound" print = "lb" parse = ["lb", "lbs", "pound", "pounds"] base_value_type = "exact" base_value = "453.59237" base_units = [ { u = "Gram", p = 1} ] [[unit]] enum_name = "PoundForce" print = "lbf" parse = ["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" print = "N" parse = ["newton", "newtons"] parse_with_prefix = "N" 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" print = "kat" parse = ["katal"] parse_with_prefix = "kat" base_value_type = "exact" base_value = "1" base_units = [ { u = "Mole", p = 1}, { u = "Second", p = -1} ] [[unit]] enum_name = "Degree" print = "°" parse = ["°", "deg", "degree", "degrees"] base = true no_space = true [[unit]] enum_name = "Radian" print = "r" parse = ["r", "radian", "radians"] base_value_type = "approx" base_value = "57.295779513" base_units = [ { u = "Degree", p = 1} ] [[unit]] enum_name = "RPM" print = "rpm" parse = ["rpm"] base_value_type = "exact" base_value = "360" base_units = [ { u = "Degree", p = 1}, { u = "Second", p = -1} ] # Radioactivity [[unit]] enum_name = "Becquerel" print = "Bq" parse = ["becquerel"] parse_with_prefix = "Bq" base_value_type = "exact" base_value = "1" base_units = [ { u = "Second", p = -1} ] [[unit]] enum_name = "Gray" print = "Gy" parse = ["gray"] parse_with_prefix = "Gy" 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" print = "rad" parse_with_prefix = "rad" base_value_type = "exact" base_value = "0.01" base_units = [ { u = "Meter", p = 2}, { u = "Second", p = -2} ] # Computing, Information [[unit]] enum_name = "Bit" print = "bit" parse = ["bit", "bits"] base = true [[unit]] enum_name = "Frame" print = "frame" parse = ["frame", "frames"] base = true [[unit]] enum_name = "Pixel" print = "px" parse = ["px", "pixel", "pixels", "Pixel", "Pixels"] base = true [[unit]] enum_name = "Dot" print = "dot" parse = ["dot", "dots"] base = true [[unit]] enum_name = "Byte" print = "B" parse = ["Bytes", "bytes", "Byte", "byte", "Octet", "Octets", "octets", "octet"] parse_with_prefix = "B" base_value_type = "exact" base_value = "8" base_units = [ { u = "Bit", p = 1} ]