From bf0d2507c066e386f51723eb4dec8987bb3b425a Mon Sep 17 00:00:00 2001 From: Hernan Grecco Date: Tue, 23 Feb 2016 02:35:55 -0300 Subject: [PATCH] Rewrote definitions file using NIST Handbook --- pint/default_en.txt | 186 +++++++++++++++++++++++--------------------- 1 file changed, 99 insertions(+), 87 deletions(-) diff --git a/pint/default_en.txt b/pint/default_en.txt index 989d1a8..e3e1095 100644 --- a/pint/default_en.txt +++ b/pint/default_en.txt @@ -19,7 +19,7 @@ micro- = 1e-6 = u- = µ- milli- = 1e-3 = m- centi- = 1e-2 = c- deci- = 1e-1 = d- -deca- = 1e+1 = da- +deca- = 1e+1 = da- = deka hecto- = 1e2 = h- kilo- = 1e3 = k- mega- = 1e6 = M- @@ -156,7 +156,6 @@ astronomical_unit = 149597870691 * meter = au carat = 200 * milligram metric_ton = 1000 * kilogram = t = tonne atomic_mass_unit = 1.660538782e-27 * kilogram = u = amu = dalton = Da -scruple = 20 * grain bag = 94 * lb # Textile @@ -207,7 +206,7 @@ standard_liter_per_minute = 1.68875 * Pa * m ** 3 / s = slpm = slm # Radiation Bq = Hz = becquerel curie = 3.7e10 * Bq = Ci -rutherford = 1e6*Bq = rd = Rd +rutherford = 1e6*Bq = Rd Gy = joule / kilogram = gray = Sv = sievert rem = 1e-2 * sievert rads = 1e-2 * gray @@ -246,6 +245,7 @@ work_month = work_year / 12 # Velocity [speed] = [length] / [time] +nautical_mile = 1852 m = nmi # exact knot = nautical_mile / hour = kt = knot_international = international_knot = nautical_miles_per_hour mph = mile / hour = MPH kph = kilometer / hour = KPH @@ -304,115 +304,127 @@ stere = meter ** 3 @end -@group Commonwealth1959 - # Length - point = yard / 216 / 12 = pp = printers_point - thou = yard / 36000 = th = mil - pica = yard / 216 = P̸ = printers_pica +# Most of the definitions that follows are derived from: +# See http://www.nist.gov/pml/wmd/pubs/hb44.cfm +@group USCSLengthInternational inch = yard / 36 = in = international_inch = inches = international_inches foot = yard / 3 = ft = international_foot = feet = international_feet - yard = 0.9144 * metres = international_yard - chain = 22 * yard = ch - furlong = 220 * yard = fur - mile = 1760 * yard = mi = international_mile - league = 5280 * yard = lea + yard = 0.9144 metres = yd = international_yard + mile = 1760 yard = mi = international_mile - # Length Maritime units - fathom = 2.0266 * yards = ftm - cable = 202.66 * yards - nautical_mile = 2026.6 * yards = nmi = NM + square_inch = 1 inch ** 2 = sq_in = square_inches + square_foot = 1 foot ** 2 = sq_ft = square_feet + square_yard = 1 yard ** 2 = sq_yd + square_mile = 1 mile ** 2 = sq_mi - # Area - square_foot = 1 * foot ** 2 = sq_ft = square_feet - square_yard = 1 * yard ** 2 = sq_yd - perch = 1 * rod ** 2 - rood = 1210 * yards ** 2 - acre = 4840 * yards ** 2 + cubic_inch = 1 in ** 3 = cu_in + cubic_foot = 1 ft ** 3 = cu_ft = cubic_feet + cubic_yard = 1 yd ** 3 = cu_yd - # Volume acre_foot = acre * foot = acre_feet - board_foot = foot ** 2 * inch = FBM @end -# https://en.wikipedia.org/wiki/Imperial_and_US_customary_measurement_systems -@group Avoirdupois - # Mass and weight - grain = 1 / 7000 pound = gr - drachm = 1 / 256 pound = dr = avoirdupois_dram - ounce = 1 /16 pound = oz = avoirdupois_ounce - # By definition - pound = 453.59237 * gram = lb = avoirdupois_pound - stone = 14 * pound = st - quarter = 28 * pound = qr = qtr +@group USCSLengthSurvey + link = 0.66 survey_foot = li = survey_link + survey_foot = foot / 0.999998 = sft + rod = 16.5 survey_foot = rd = pole = perch + chain = 66 survey_foot + survey_mile = 5280 survey_foot + + acre = 43560 survey_foot ** 2 + square_rod = 1 rod ** 2 = sq_rod = sq_pole = sq_perch + + fathom = 6 survey_foot + us_statute_mile = 5280 survey_foot + league = 3 us_statute_mile + furlong = us_statute_mile / 8 @end -@group AvoirdupoisUS using Avoirdupois - US_hundredweight = 100 * pound = US_cwt = short_hundredweight - US_ton = 2000 * pound = short_ton +@group USCSDryVolume + dry_pint = 33.6003125 cubic_inch = dpi = US_dry_pint + dry_quart = 2 dry_pint = dqt = US_dry_quart + dry_gallon = 8 dry_pint = dgal = US_dry_gallon + peck = 16 dry_pint = pk + bushel = 64 dry_pint = bu + dry_barrel = 7065 cubic_inch = US_dry_barrel @end -@group AvoirdupoisUK using Avoirdupois - cental = 100 * pound - hundredweight = 112 * pound = cwt = long_hundredweight - ton = 2240 * pound = long_tone +@group USCSLiquidVolume + minim = liquid_pint / 7680 + fluid_dram = liquid_pint / 128 = fldr = fluidram = US_fluid_dram + fluid_ounce = liquid_pint / 16 = floz = US_fluid_ounce = US_liquid_ounce + gill = liquid_pint / 4 = gi = liquid_gill = US_liquid_gill + + pint = 28.875 cubic_inch = pt = liquid_pint = US_pint + + quart = 2 liquid_pint = qt = liquid_quart = US_liquid_quart + gallon = 8 liquid_pint = gal = liquid_gallon = US_liquid_gallon @end -# https://en.wikipedia.org/wiki/Imperial_and_US_customary_measurement_systems -@group Troy - pennyweight = 24 * gram = dwt - troy_ounce = 480 * grain = toz = apounce = apothecary_ounce - troy_pound = 12 * toz = tlb = appound = apothecary_pound -@end - -# https://en.wikipedia.org/wiki/United_States_customary_units -@group US using Commonwealth1959 - - # Gunter' survey units - link = 7.92 * inches - rod = 25 * link - - # survey - square_rod = 2721*.25 foot ** 2 - survey_foot = 1200 / 3937 m = sft - survey_mile = 8 * furlong - - # Volume - fluid_dram = floz / 8 = fldr = fluidram +@group USCSVolumeOther teaspoon = tablespoon / 3 = tsp tablespoon = floz / 2 = tbsp = Tbsp = Tblsp = tblsp = tbs = Tbl - fluid_ounce = 1/20 * pint = floz = US_fluid_ounce = US_liquid_ounce - shot = 3 * tablespoon = jig - gill = 4 * fluid_ounce = gi = liquid_gill = US_liquid_gill - cup = 8 * fluid_ounce = cp = liquid_cup = US_liquid_cup - pint = 473.176473 * milliliter = pt = liquid_pint = US_pint - quart = 32 * fluid_ounce = qt = liquid_quart = US_liquid_quart - gallon = 128 * fluid_ounce = gal = liquid_gallon = US_liquid_gallon + shot = 3 * tablespoon = jig = US_shot + cup = 8 fluid_ounce = cp = liquid_cup = US_liquid_cup barrel = 31.5 * gallon = bbl oil_barrel = 42 * gallon = oil_bbl beer_barrel = 31 * gallon = beer_bbl hogshead = 63 * gallon - - # Dry Volume - dry_pint = 33.60 * inch ** 3 = dpt = US_dry_pit - dry_quart = 2 * dry_pint = dqt = US_dry_quart - dry_gallon = 8 * dry_pint = dgal = US_dry_gallon - peck = 16 * dry_pint = pk - dry_barrel = 7065 * inch ** 3 = US_dry_barrel - - # gravitational - slug = 14.59390 * kilogram @end -# See https://en.wikipedia.org/wiki/Imperial_units -@group imperial using Commonwealth1959 +@group Avoirdupois + grain = avdp_pound / 7000 = gr + drachm = pound / 256 = dr = avoirdupois_dram = avdp_dram = dram + ounce = pound / 16 = oz = avoirdupois_ounce = avdp_ounce + pound = 453.59237 gram = lb = avoirdupois_pound = avdp_pound - # Volume - imperial_fluid_ounce = 1/20 * imperial_pint = imperial_floz = UK_fluid_ounce - imperial_gill = 1/4 * imperial_pint = imperial_gi = UK_gill + short_hunderdweight = 100 avoirdupois_pound = ch_cwt + long_hunderweight = 112 avoirdupois_pound = lg_cwt + short_ton = 2000 avoirdupois_pound + long_ton = 2240 avoirdupois_pound +@end + +@group Troy + pennyweight = 24 grain = dwt + troy_ounce = 480 grain = toz + troy_pound = 12 troy_ounce = tlb +@end + +@group Apothecary + scruple = 20 grain + apothecary_dram = 3 scruple = ap_dr + apothecary_ounce = 8 apothecary_dram = ap_oz + apothecary_pound = 12 apothecary_ounce = ap_lb +@end + +@group AvoirdupoisUK using Avoirdupois, Apothecary, Troy + stone = 14 pound + quarter = 28 stone + UK_hundredweight = long_hunderweight = UK_cwt + UK_ton = long_ton +@end + +@group AvoirdupoisUS using Avoirdupois, Apothecary, Troy + US_hundredweight = short_hunderdweight = US_cwt + US_ton = short_ton = ton +@end + +@group Printer + # Length + point = yard / 216 / 12 = pp = printers_point + thou = yard / 36000 = th = mil + pica = yard / 216 = P̸ = printers_pica +@end + +@group ImperialVolume + imperial_fluid_ounce = imperial_pint / 20 = imperial_floz = UK_fluid_ounce + imperial_fluid_drachm = imperial_fluid_ounce / 8 = imperial_fluid_dram + imperial_gill = imperial_pint / 4 = imperial_gi = UK_gill imperial_cup = imperial_pint / 2 = imperial_cp = UK_cup imperial_pint = 568.26125 * milliliter = imperial_pt = UK_pint imperial_quart = 2 * imperial_pint = imperial_qt = UK_quart imperial_gallon = 8 * imperial_pint = imperial_gal = UK_gallon + imperial_peck = 16 * imperial_pint = imperial_pk = UK_pk imperial_bushel = 64 * imperial_pint = imperial_bu = UK_bushel imperial_barrel = 288 * imperial_pint = imperial_bbl = UK_bbl @end @@ -429,12 +441,12 @@ stere = meter ** 3 second @end -@system imperial using imperial +@system imperial using ImperialVolume, USCSLengthInternational, AvoirdupoisUK yard pound @end -@system US using US +@system US using USCSLiquidVolume, USCSDryVolume, USCSVolume, USCSLengthInternational, USCSLengthSurvey, AvoirdupoisUS yard pound @end