-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathtemperature.py
More file actions
69 lines (65 loc) · 1.59 KB
/
temperature.py
File metadata and controls
69 lines (65 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
"""
"""
from ..unitquantity import UnitTemperature
K = degK = kelvin = Kelvin = UnitTemperature(
'Kelvin',
symbol='K',
aliases=['degK', 'kelvin']
)
for prefix, symbolprefix, magnitude in (
('yotta', 'Y', 1e24),
('zetta', 'Z', 1e21),
('exa', 'E', 1e18),
('peta', 'P', 1e15),
('tera', 'T', 1e12),
('giga', 'G', 1e9),
('mega', 'M', 1e6),
('kilo', 'k', 1e3),
('hecto', 'h', 1e2),
('deka', 'da', 1e1),
('deci', 'd', 1e-1),
('centi', 'c', 1e-2),
('milli', 'm', 1e-3),
('micro', 'u', 1e-6),
('nano', 'n', 1e-9),
('pico', 'p', 1e-12),
('femto', 'f', 1e-15),
('atto', 'a', 1e-18),
('zepto', 'z', 1e-21),
('yocto', 'y', 1e-24),
):
symbol = symbolprefix +'K'
globals()[symbol] = UnitTemperature(
prefix + 'kelvin',
K*magnitude,
symbol=symbol
)
degR = rankine = Rankine = UnitTemperature(
'Rankine',
K/1.8,
symbol='degR',
u_symbol='°R',
aliases=['rankine']
)
degC = celsius = Celsius = UnitTemperature(
'Celsius',
K,
symbol='degC',
u_symbol='°C',
aliases=['celsius'],
doc='''
Unicode has special compatibility characters for ℃, but its use is
discouraged by the unicode consortium.
'''
)
degF = fahrenheit = Fahrenheit = UnitTemperature(
'Fahrenheit',
degR,
symbol='degF',
u_symbol='°F',
aliases=['fahrenheit'],
doc='''
Unicode has special compatibility characters for ℉, but its use is
discouraged by the unicode consortium.
'''
)