1# -*- coding: utf-8 -*-
2"""
3"""
4from __future__ import absolute_import
5
6from ..unitquantity import UnitQuantity, UnitMass
7from .length import m
8
9kg = kilogram =  UnitMass(
10    'kilogram',
11    symbol='kg',
12    aliases=['kilograms']
13)
14g = gram = UnitMass(
15    'gram',
16    kg/1000,
17    symbol='g',
18    aliases=['grams']
19)
20mg = milligram = UnitMass(
21    'milligram',
22    gram/1000,
23    symbol='mg',
24    aliases=['milligrams']
25)
26oz = ounce = avoirdupois_ounce = UnitMass(
27    'ounce',
28    28.349523125*g,
29    symbol='oz',
30    aliases=['ounces','avoirdupois_ounce', 'avoirdupois_ounces'],
31    doc='exact'
32)
33lb = pound = avoirdupois_pound = UnitMass(
34    'pound',
35    0.45359237*kg,
36    symbol='lb',
37    aliases=['pounds', 'avoirdupois_pound', 'avoirdupois_pounds'],
38    doc='exact'
39)
40st = stone = UnitMass(
41    'stone',
42    14*lb,
43    symbol='st',
44    doc='As defined in the UK, 1 stone = 14 avoirdupois pounds'
45)
46
47carat = UnitMass(
48    'carat',
49    200*mg,
50    aliases=['carats']
51)
52gr = grain = UnitMass(
53    'grain',
54    64.79891*mg,
55    symbol='gr',
56    aliases=['grains']
57)
58long_hundredweight = UnitMass(
59    'long_hundredweight',
60    112*lb,
61    aliases=['long_hundredweights']
62)
63short_hundredweight = UnitMass(
64    'short_hundredweight',
65    100*lb,
66    aliases=['short_hundredweights']
67) # cwt is used for both short and long hundredweight, so we wont use it
68t = metric_ton = tonne = UnitMass(
69    'tonne',
70    1000*kg,
71    symbol='t',
72    aliases=['tonnes']
73)
74dwt = pennyweight = UnitMass(
75    'pennyweight',
76    24*gr,
77    symbol='dwt',
78    aliases=['pennyweights']
79)
80slug = slugs = UnitMass(
81    'slug',
82    14.59390*kg,
83    aliases=['slugs']
84)
85toz = troy_ounce = apounce = apothecary_ounce = UnitMass(
86    'troy_ounce',
87    480*gr,
88    symbol='toz',
89    u_symbol='℥',
90    aliases=[
91        'apounce', 'apounces', 'apothecary_ounce', 'apothecary_ounces',
92        'troy_ounces'
93    ]
94)
95troy_pound = appound = apothecary_pound = UnitMass(
96    'troy_pound',
97    12*toz,
98    symbol='tlb',
99    u_symbol='℔',
100    aliases=[
101        'troy_pounds', 'appound', 'appounds', 'apothecary_pound',
102        'apothecary_pounds'
103    ]
104)
105u = amu = atomic_mass_unit = dalton = Da = UnitMass(
106    'atomic_mass_unit',
107    1.660538782e-27*kg,
108    symbol='u',
109    aliases=['amu', 'Da', 'dalton'],
110    doc='relative uncertainty = 5e-8'
111)
112scruple = UnitMass(
113    'scruple',
114    20*gr,
115    u_symbol='℈',
116    aliases=['scruples']
117)
118dr = dram = UnitMass(
119    'dram',
120    oz/16,
121    symbol='dr',
122    aliases=['drams'],
123    doc='avoirdupois dram'
124)
125drachm = apdram = UnitMass(
126    'drachm',
127    60*gr,
128    u_symbol='  ',
129    aliases=['drachms', 'apdram', 'apdrams'],
130    doc='also known as the apothecary dram'
131)
132
133bag = UnitMass(
134    'bag',
135    94*lb,
136    aliases=['bags']
137)
138
139ton = short_ton = UnitMass(
140    'short_ton',
141    2000*lb,
142    aliases=['short_tons']
143)
144long_ton = UnitMass(
145    'long_ton', 2240*lb,
146    aliases=['long_tons']
147) # both long and short tons are referred to as "ton" so we wont use it
148
149############################################################
150##                 Mass per unit length                   ##
151############################################################
152
153denier = UnitQuantity(
154    'denier',
155    g/(9000*m),
156    aliases=['deniers']
157)
158tex = UnitQuantity(
159    'tex',
160    g/(1000*m),
161    aliases=['texs']
162)
163dtex = UnitQuantity(
164    'dtex',
165    g/(10000*m),
166    aliases=['dtexs']
167)
168
169del UnitQuantity, m
170