quantify 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/quantify.rb +3 -1
- data/lib/quantify/config.rb +243 -243
- data/lib/quantify/core_extensions/numeric.rb +19 -0
- data/lib/quantify/core_extensions/string.rb +29 -0
- data/lib/quantify/core_extensions/symbol.rb +7 -0
- data/lib/quantify/dimensions.rb +19 -21
- data/lib/quantify/quantify.rb +32 -1
- data/lib/quantify/quantity.rb +37 -37
- data/lib/quantify/unit/base_unit.rb +113 -61
- data/lib/quantify/unit/compound_base_unit.rb +54 -14
- data/lib/quantify/unit/compound_unit.rb +42 -18
- data/lib/quantify/unit/non_si_unit.rb +1 -1
- data/lib/quantify/unit/prefix/base_prefix.rb +5 -5
- data/lib/quantify/unit/prefix/prefix.rb +4 -4
- data/lib/quantify/unit/unit.rb +55 -24
- data/spec/compound_unit_spec.rb +205 -0
- data/spec/dimension_spec.rb +49 -1
- data/spec/quantify_spec.rb +20 -0
- data/spec/quantity_spec.rb +9 -9
- data/spec/string_spec.rb +55 -0
- data/spec/unit_spec.rb +292 -10
- metadata +24 -19
- data/lib/quantify/core_extensions.rb +0 -63
data/lib/quantify.rb
CHANGED
@@ -8,7 +8,9 @@ require 'pp'
|
|
8
8
|
require 'rubygems'
|
9
9
|
require 'active_support/inflector'
|
10
10
|
require 'quantify/quantify'
|
11
|
-
require 'quantify/core_extensions'
|
11
|
+
require 'quantify/core_extensions/string'
|
12
|
+
require 'quantify/core_extensions/symbol'
|
13
|
+
require 'quantify/core_extensions/numeric'
|
12
14
|
require 'quantify/inflections'
|
13
15
|
require 'quantify/exception'
|
14
16
|
require 'quantify/dimensions'
|
data/lib/quantify/config.rb
CHANGED
@@ -14,96 +14,96 @@ Dimensions.configure do
|
|
14
14
|
# Load the standard, widely-recognised physical quantities.
|
15
15
|
|
16
16
|
# Base quantities
|
17
|
-
load :physical_quantity => '
|
18
|
-
load :physical_quantity => '
|
19
|
-
load :physical_quantity => 'time',
|
20
|
-
load :physical_quantity => 'electric current',
|
21
|
-
load :physical_quantity => 'temperature',
|
22
|
-
load :physical_quantity => 'luminous intensity',
|
17
|
+
load :physical_quantity => 'length', :length => 1
|
18
|
+
load :physical_quantity => 'mass', :mass => 1
|
19
|
+
load :physical_quantity => 'time', :time => 1
|
20
|
+
load :physical_quantity => 'electric current', :electric_current => 1
|
21
|
+
load :physical_quantity => 'temperature', :temperature => 1
|
22
|
+
load :physical_quantity => 'luminous intensity', :luminous_intensity => 1
|
23
23
|
load :physical_quantity => 'amount of substance', :amount_of_substance => 1
|
24
|
-
load :physical_quantity => 'information',
|
25
|
-
load :physical_quantity => 'currency',
|
26
|
-
load :physical_quantity => 'item',
|
24
|
+
load :physical_quantity => 'information', :information => 1
|
25
|
+
load :physical_quantity => 'currency', :currency => 1
|
26
|
+
load :physical_quantity => 'item', :item => 1
|
27
27
|
load :physical_quantity => 'dimensionless'
|
28
28
|
|
29
29
|
# Derived quantities
|
30
|
-
load :physical_quantity => 'acceleration',
|
31
|
-
load :physical_quantity => 'area',
|
32
|
-
load :physical_quantity => 'action',
|
33
|
-
load :physical_quantity => 'angular monentum',
|
34
|
-
load :physical_quantity => 'conductivity',
|
35
|
-
load :physical_quantity => 'density',
|
36
|
-
load :physical_quantity => 'electric charge',
|
37
|
-
load :physical_quantity => 'electric charge_density',
|
38
|
-
load :physical_quantity => 'electric conductance',
|
39
|
-
load :physical_quantity => 'electric displacement',
|
40
|
-
load :physical_quantity => 'electric field strength',
|
41
|
-
load :physical_quantity => 'electric polarisability',
|
42
|
-
load :physical_quantity => 'electric polarisation',
|
43
|
-
load :physical_quantity => 'electric potential difference', :
|
44
|
-
load :physical_quantity => 'electric resistance',
|
45
|
-
load :physical_quantity => 'electrical capacitance',
|
46
|
-
load :physical_quantity => 'energy',
|
47
|
-
load :physical_quantity => 'entropy',
|
48
|
-
load :physical_quantity => 'force',
|
49
|
-
load :physical_quantity => 'frequency',
|
50
|
-
load :physical_quantity => 'heat capacity',
|
51
|
-
load :physical_quantity => 'illuminance',
|
52
|
-
load :physical_quantity => 'impedance',
|
53
|
-
load :physical_quantity => 'inductance',
|
54
|
-
load :physical_quantity => 'irradiance',
|
55
|
-
load :physical_quantity => 'luminous flux',
|
56
|
-
load :physical_quantity => 'magnetic field strength',
|
57
|
-
load :physical_quantity => 'magnetic flux',
|
58
|
-
load :physical_quantity => 'magnetic flux density',
|
59
|
-
load :physical_quantity => 'magnetic dipole moment',
|
60
|
-
load :physical_quantity => 'magnetic vector potential',
|
61
|
-
load :physical_quantity => 'magnetisation',
|
62
|
-
load :physical_quantity => 'moment of inertia',
|
63
|
-
load :physical_quantity => 'momentum',
|
64
|
-
load :physical_quantity => 'number density',
|
65
|
-
load :physical_quantity => 'permeability',
|
66
|
-
load :physical_quantity => 'permittivity',
|
67
|
-
load :physical_quantity => 'plane angle'
|
68
|
-
load :physical_quantity => 'power',
|
69
|
-
load :physical_quantity => 'pressure',
|
70
|
-
load :physical_quantity => 'radiation absorbed dose',
|
71
|
-
load :physical_quantity => 'radiation dose equivalent',
|
72
|
-
load :physical_quantity => 'radioactivity',
|
73
|
-
load :physical_quantity => 'solid angle'
|
74
|
-
load :physical_quantity => 'surface tension',
|
75
|
-
load :physical_quantity => 'velocity',
|
76
|
-
load :physical_quantity => 'dynamic viscosity',
|
77
|
-
load :physical_quantity => 'kinematic viscosity',
|
78
|
-
load :physical_quantity => 'volume',
|
79
|
-
load :physical_quantity => 'energy density',
|
80
|
-
load :physical_quantity => 'thermal resistance',
|
81
|
-
load :physical_quantity => 'catalytic activity',
|
30
|
+
load :physical_quantity => 'acceleration', :length => 1, :time => -2
|
31
|
+
load :physical_quantity => 'area', :length => 2
|
32
|
+
load :physical_quantity => 'action', :length => 2, :mass => 1, :time => -1
|
33
|
+
load :physical_quantity => 'angular monentum', :length => 2, :mass => 1, :time => -1
|
34
|
+
load :physical_quantity => 'conductivity', :length => -3, :mass => -1, :time => 3, :electric_current => 2
|
35
|
+
load :physical_quantity => 'density', :length => -3, :mass => 1
|
36
|
+
load :physical_quantity => 'electric charge', :time => 1, :electric_current => 1
|
37
|
+
load :physical_quantity => 'electric charge_density', :length => -3, :time => 1, :electric_current => 1
|
38
|
+
load :physical_quantity => 'electric conductance', :length => -2, :mass => -1, :time => 3, :electric_current => 2
|
39
|
+
load :physical_quantity => 'electric displacement', :length => -2, :time => 1, :electric_current => 1
|
40
|
+
load :physical_quantity => 'electric field strength', :length => 1, :mass => 1, :time => -3, :electric_current => -1
|
41
|
+
load :physical_quantity => 'electric polarisability', :mass => -1, :time => 4, :electric_current => 2
|
42
|
+
load :physical_quantity => 'electric polarisation', :length => -2, :time => 1, :electric_current => 1
|
43
|
+
load :physical_quantity => 'electric potential difference', :length => 2, :mass => 1, :time => -3, :electric_current => -1
|
44
|
+
load :physical_quantity => 'electric resistance', :length => 2, :mass => 1, :time => -3, :electric_current => -2
|
45
|
+
load :physical_quantity => 'electrical capacitance', :length => -2, :mass => -1, :time => 4, :electric_current => 2
|
46
|
+
load :physical_quantity => 'energy', :length => 2, :mass => 1, :time => -2
|
47
|
+
load :physical_quantity => 'entropy', :length => 2, :mass => 1, :time => -2, :temperature => -1
|
48
|
+
load :physical_quantity => 'force', :length => 1, :mass => 1, :time => -2
|
49
|
+
load :physical_quantity => 'frequency', :time => -1
|
50
|
+
load :physical_quantity => 'heat capacity', :length => 2, :mass => 1, :time => -2, :temperature => -1
|
51
|
+
load :physical_quantity => 'illuminance', :length => -2, :luminous_intensity => 1
|
52
|
+
load :physical_quantity => 'impedance', :length => 2, :mass => 1, :time => -3, :electric_current => -2
|
53
|
+
load :physical_quantity => 'inductance', :length => 2, :mass => 1, :time => -2, :electric_current => -2
|
54
|
+
load :physical_quantity => 'irradiance', :mass => 1, :time => -3
|
55
|
+
load :physical_quantity => 'luminous flux', :luminous_intensity => 1
|
56
|
+
load :physical_quantity => 'magnetic field strength', :length => -1, :electric_current => 1
|
57
|
+
load :physical_quantity => 'magnetic flux', :length => 2, :mass => 1, :time => -2, :electric_current => -1
|
58
|
+
load :physical_quantity => 'magnetic flux density', :mass => 1, :time => -2, :electric_current => -1
|
59
|
+
load :physical_quantity => 'magnetic dipole moment', :length => 2, :electric_current => 1
|
60
|
+
load :physical_quantity => 'magnetic vector potential', :length => 1, :mass => 1, :time => -2, :electric_current => -1
|
61
|
+
load :physical_quantity => 'magnetisation', :length => -1, :electric_current => 1
|
62
|
+
load :physical_quantity => 'moment of inertia', :length => 2, :mass => 1
|
63
|
+
load :physical_quantity => 'momentum', :length => 1, :mass => 1, :time => -1
|
64
|
+
load :physical_quantity => 'number density', :length => -3, :item => 1
|
65
|
+
load :physical_quantity => 'permeability', :length => 1, :mass => 1, :time => -2, :electric_current => -2
|
66
|
+
load :physical_quantity => 'permittivity', :length => -3, :mass => -1, :time => 4, :electric_current => 2
|
67
|
+
load :physical_quantity => 'plane angle' # length / length = dimensionsless
|
68
|
+
load :physical_quantity => 'power', :length => 2, :mass => 1, :time => -3
|
69
|
+
load :physical_quantity => 'pressure', :length => -1, :mass => 1, :time => -2
|
70
|
+
load :physical_quantity => 'radiation absorbed dose', :length => 2, :time => -2
|
71
|
+
load :physical_quantity => 'radiation dose equivalent', :length => 2, :time => -2
|
72
|
+
load :physical_quantity => 'radioactivity', :time => -1
|
73
|
+
load :physical_quantity => 'solid angle' # area / area = dimensionless
|
74
|
+
load :physical_quantity => 'surface tension', :mass => 1, :time => -2
|
75
|
+
load :physical_quantity => 'velocity', :length => 1, :time => -1
|
76
|
+
load :physical_quantity => 'dynamic viscosity', :length => -1, :mass => 1, :time => -1
|
77
|
+
load :physical_quantity => 'kinematic viscosity', :length => 2, :time => -1
|
78
|
+
load :physical_quantity => 'volume', :length => 3
|
79
|
+
load :physical_quantity => 'energy density', :length => -1, :mass => 1, :time => -2
|
80
|
+
load :physical_quantity => 'thermal resistance', :mass => -1, :time => 3, :temperature => 1
|
81
|
+
load :physical_quantity => 'catalytic activity', :time => -1, :amount_of_substance => 1
|
82
82
|
|
83
83
|
end
|
84
84
|
|
85
85
|
Unit::Prefix::SI.configure do
|
86
86
|
|
87
|
-
load :name => 'deca',
|
88
|
-
load :name => 'hecto', :symbol => 'h',
|
89
|
-
load :name => 'kilo',
|
90
|
-
load :name => 'mega',
|
91
|
-
load :name => 'giga',
|
92
|
-
load :name => 'tera',
|
93
|
-
load :name => 'peta',
|
94
|
-
load :name => 'exa',
|
95
|
-
load :name => 'zetta', :symbol => 'Z',
|
96
|
-
load :name => 'yotta', :symbol => 'Y',
|
97
|
-
load :name => 'deci',
|
98
|
-
load :name => 'centi', :symbol => 'c',
|
99
|
-
load :name => 'milli', :symbol => 'm',
|
100
|
-
load :name => 'micro', :symbol => 'μ',
|
101
|
-
load :name => 'nano',
|
102
|
-
load :name => 'pico',
|
103
|
-
load :name => 'femto', :symbol => 'f',
|
104
|
-
load :name => 'atto',
|
105
|
-
load :name => 'zepto', :symbol => 'z',
|
106
|
-
load :name => 'yocto', :symbol => 'y',
|
87
|
+
load :name => 'deca', :symbol => 'da', :factor => 1e1
|
88
|
+
load :name => 'hecto', :symbol => 'h', :factor => 1e2
|
89
|
+
load :name => 'kilo', :symbol => 'k', :factor => 1e3
|
90
|
+
load :name => 'mega', :symbol => 'M', :factor => 1e6
|
91
|
+
load :name => 'giga', :symbol => 'G', :factor => 1e9
|
92
|
+
load :name => 'tera', :symbol => 'T', :factor => 1e12
|
93
|
+
load :name => 'peta', :symbol => 'P', :factor => 1e15
|
94
|
+
load :name => 'exa', :symbol => 'E', :factor => 1e18
|
95
|
+
load :name => 'zetta', :symbol => 'Z', :factor => 1e21
|
96
|
+
load :name => 'yotta', :symbol => 'Y', :factor => 1e24
|
97
|
+
load :name => 'deci', :symbol => 'd', :factor => 1e-1
|
98
|
+
load :name => 'centi', :symbol => 'c', :factor => 1e-2
|
99
|
+
load :name => 'milli', :symbol => 'm', :factor => 1e-3
|
100
|
+
load :name => 'micro', :symbol => 'μ', :factor => 1e-6
|
101
|
+
load :name => 'nano', :symbol => 'n', :factor => 1e-9
|
102
|
+
load :name => 'pico', :symbol => 'p', :factor => 1e-12
|
103
|
+
load :name => 'femto', :symbol => 'f', :factor => 1e-15
|
104
|
+
load :name => 'atto', :symbol => 'a', :factor => 1e-18
|
105
|
+
load :name => 'zepto', :symbol => 'z', :factor => 1e-21
|
106
|
+
load :name => 'yocto', :symbol => 'y', :factor => 1e-24
|
107
107
|
|
108
108
|
end
|
109
109
|
|
@@ -113,13 +113,13 @@ Unit::Prefix::NonSI.configure do
|
|
113
113
|
# used in the US, so could added here to provide this support.
|
114
114
|
#
|
115
115
|
# load :name => 'million ', :symbol => 'MM', :factor => 1e6
|
116
|
-
# load :name => 'billion ', :symbol => 'B',
|
116
|
+
# load :name => 'billion ', :symbol => 'B', :factor => 1e9
|
117
117
|
|
118
118
|
end
|
119
119
|
|
120
120
|
Unit::Base.configure do
|
121
121
|
|
122
|
-
load :name => 'unity',
|
122
|
+
load :name => 'unity', :physical_quantity => 'dimensionless', :symbol => '1', :label => '1'
|
123
123
|
load :name => 'percent', :physical_quantity => 'dimensionless', :symbol => '%', :label => '%'
|
124
124
|
|
125
125
|
end
|
@@ -135,35 +135,35 @@ Unit::SI.configure do
|
|
135
135
|
# need to be declared here. SI units therefore require only their physical quantity
|
136
136
|
# to be specified.
|
137
137
|
#
|
138
|
-
load :name => 'ampere',
|
139
|
-
load :name => 'amagat',
|
140
|
-
load :name => 'bit',
|
141
|
-
load :name => 'bequerel',
|
142
|
-
load :name => 'candela',
|
143
|
-
load :name => 'coloumb',
|
144
|
-
load :name => 'farad',
|
145
|
-
load :name => 'gray',
|
146
|
-
load :name => 'hertz',
|
147
|
-
load :name => 'henry',
|
148
|
-
load :name => 'joule',
|
149
|
-
load :name => 'katal',
|
150
|
-
load :name => 'kelvin',
|
151
|
-
load :name => 'lumen',
|
152
|
-
load :name => 'lux',
|
153
|
-
load :name => 'metre',
|
154
|
-
load :name => 'mole',
|
155
|
-
load :name => 'newton',
|
156
|
-
load :name => 'ohm',
|
157
|
-
load :name => 'pascal',
|
158
|
-
load :name => 'radian',
|
159
|
-
load :name => 'second',
|
160
|
-
load :name => 'siemens',
|
161
|
-
load :name => 'sievert',
|
162
|
-
load :name => 'steridian', :physical_quantity => 'solid_angle',
|
163
|
-
load :name => 'tesla',
|
164
|
-
load :name => 'volt',
|
165
|
-
load :name => 'watt',
|
166
|
-
load :name => 'weber',
|
138
|
+
load :name => 'ampere', :physical_quantity => 'electric_current', :symbol => 'A', :label => 'A'
|
139
|
+
load :name => 'amagat', :physical_quantity => 'number_density', :symbol => 'η', :label => 'η'
|
140
|
+
load :name => 'bit', :physical_quantity => 'information', :symbol => 'bit', :label => 'bit'
|
141
|
+
load :name => 'bequerel', :physical_quantity => 'radioactivity', :symbol => 'Bq', :label => 'Bq'
|
142
|
+
load :name => 'candela', :physical_quantity => 'luminous_intensity', :symbol => 'cd', :label => 'cd'
|
143
|
+
load :name => 'coloumb', :physical_quantity => 'electric_charge', :symbol => 'C', :label => 'C'
|
144
|
+
load :name => 'farad', :physical_quantity => 'electrical_capacitance', :symbol => 'F', :label => 'F'
|
145
|
+
load :name => 'gray', :physical_quantity => 'radiation_absorbed_dose', :symbol => 'Gy', :label => 'Gy'
|
146
|
+
load :name => 'hertz', :physical_quantity => 'frequency', :symbol => 'Hz', :label => 'Hz'
|
147
|
+
load :name => 'henry', :physical_quantity => 'inductance', :symbol => 'H', :label => 'H'
|
148
|
+
load :name => 'joule', :physical_quantity => 'energy', :symbol => 'J', :label => 'J'
|
149
|
+
load :name => 'katal', :physical_quantity => 'catalytic activity', :symbol => 'kat', :label => 'kat'
|
150
|
+
load :name => 'kelvin', :physical_quantity => 'temperature', :symbol => 'K', :label => 'K'
|
151
|
+
load :name => 'lumen', :physical_quantity => 'luminous_flux', :symbol => 'lm', :label => 'lm'
|
152
|
+
load :name => 'lux', :physical_quantity => 'illuminance', :symbol => 'lx', :label => 'lx'
|
153
|
+
load :name => 'metre', :physical_quantity => 'length', :symbol => 'm', :label => 'm'
|
154
|
+
load :name => 'mole', :physical_quantity => 'amount_of_substance', :symbol => 'mol', :label => 'mol'
|
155
|
+
load :name => 'newton', :physical_quantity => 'force', :symbol => 'N', :label => 'N'
|
156
|
+
load :name => 'ohm', :physical_quantity => 'electric_resistance', :symbol => 'Ω', :label => 'Ohm'
|
157
|
+
load :name => 'pascal', :physical_quantity => 'pressure', :symbol => 'Pa', :label => 'Pa'
|
158
|
+
load :name => 'radian', :physical_quantity => 'plane_angle', :symbol => 'rad', :label => 'rad'
|
159
|
+
load :name => 'second', :physical_quantity => 'time', :symbol => 's', :label => 's'
|
160
|
+
load :name => 'siemens', :physical_quantity => 'electric_conductance', :symbol => 'S', :label => 'S'
|
161
|
+
load :name => 'sievert', :physical_quantity => 'radiation_dose_equivalent', :symbol => 'Sv', :label => 'Sv'
|
162
|
+
load :name => 'steridian', :physical_quantity => 'solid_angle', :symbol => 'sr', :label => 'sr'
|
163
|
+
load :name => 'tesla', :physical_quantity => 'magnetic_flux_density', :symbol => 'T', :label => 'T'
|
164
|
+
load :name => 'volt', :physical_quantity => 'electric_potential_difference', :symbol => 'V', :label => 'V'
|
165
|
+
load :name => 'watt', :physical_quantity => 'power', :symbol => 'W', :label => 'W'
|
166
|
+
load :name => 'weber', :physical_quantity => 'magnetic_flux', :symbol => 'Wb', :label => 'Wb'
|
167
167
|
|
168
168
|
# The kilogram is unusual in being the SI unit of mass yet containing the
|
169
169
|
# 'kilo' prefix.
|
@@ -175,7 +175,7 @@ Unit::SI.configure do
|
|
175
175
|
# (kilogram), in consistency with all other unit types
|
176
176
|
#
|
177
177
|
load :name => 'kilogram', :physical_quantity => :mass, :symbol => 'kg', :label => 'kg'
|
178
|
-
load :name => 'gram',
|
178
|
+
load :name => 'gram', :physical_quantity => :mass, :symbol => 'g', :label => 'g', :factor => 1e-3
|
179
179
|
|
180
180
|
# Define units on the basis of unit operations
|
181
181
|
|
@@ -235,135 +235,135 @@ Unit::NonSI.configure do
|
|
235
235
|
# to the SI system. They are therefore represent by a conversion factor which
|
236
236
|
# is defined relative to the corresponding SI unit for that quantity.
|
237
237
|
|
238
|
-
load :name => 'acre',
|
239
|
-
load :name => 'angstrom',
|
240
|
-
load :name => 'arcminute',
|
241
|
-
load :name => 'arcsecond',
|
242
|
-
load :name => 'are',
|
243
|
-
load :name => 'astronomical unit',
|
244
|
-
load :name => 'atmosphere',
|
245
|
-
load :name => 'bar',
|
246
|
-
load :name => 'barn',
|
247
|
-
load :name => 'biot',
|
248
|
-
load :name => 'boiler horsepower',
|
249
|
-
load :name => 'british thermal unit (59 °F)',
|
250
|
-
load :name => 'british thermal unit (39 °F)',
|
251
|
-
load :name => 'british thermal unit (60 °F)',
|
252
|
-
load :name => 'british thermal unit (63 °F)',
|
253
|
-
load :name => 'british thermal unit (ISO)',
|
254
|
-
load :name => 'british thermal unit (IT)',
|
255
|
-
load :name => 'british thermal unit (mean)',
|
256
|
-
load :name => 'british thermal unit (thermochemical)', :physical_quantity => 'energy',
|
257
|
-
load :name => 'bushel
|
258
|
-
load :name => 'bushel
|
259
|
-
load :name => 'byte',
|
260
|
-
load :name => 'calorie',
|
261
|
-
load :name => 'candle power',
|
262
|
-
load :name => 'carat',
|
263
|
-
load :name => 'celsius heat unit',
|
264
|
-
load :name => 'centimetre of mercury',
|
265
|
-
load :name => 'centimetre of water',
|
266
|
-
load :name => 'chain',
|
267
|
-
load :name => 'clo',
|
268
|
-
load :name => 'cup',
|
269
|
-
load :name => 'curie',
|
270
|
-
load :name => 'day',
|
271
|
-
load :name => 'degree',
|
272
|
-
load :name => 'degree celsius',
|
273
|
-
load :name => 'degree farenheit',
|
274
|
-
load :name => 'degree rankine',
|
275
|
-
load :name => 'dram',
|
276
|
-
load :name => 'dyne',
|
277
|
-
load :name => 'dyne centimetre',
|
278
|
-
load :name => 'electric horsepower',
|
279
|
-
load :name => 'electron mass',
|
280
|
-
load :name => 'electron volt',
|
281
|
-
load :name => 'ell',
|
282
|
-
load :name => 'erg',
|
283
|
-
load :name => 'faraday',
|
284
|
-
load :name => 'fathom',
|
285
|
-
load :name => 'fermi',
|
286
|
-
load :name => 'foot',
|
287
|
-
load :name => 'footcandle',
|
288
|
-
load :name => 'foot of water',
|
289
|
-
load :name => 'franklin',
|
290
|
-
load :name => 'furlong',
|
291
|
-
load :name => 'gamma',
|
292
|
-
load :name => 'gauss',
|
293
|
-
load :name => 'grad',
|
294
|
-
load :name => 'grain',
|
295
|
-
load :name => 'hartree',
|
296
|
-
load :name => 'hectare',
|
297
|
-
load :name => 'hogshead',
|
298
|
-
load :name => 'hour',
|
299
|
-
load :name => 'hundredweight long',
|
300
|
-
load :name => 'hundredweight short',
|
301
|
-
load :name => 'inch',
|
302
|
-
load :name => 'inch of mercury',
|
303
|
-
load :name => 'inch of water',
|
304
|
-
load :name => 'kilocalorie',
|
305
|
-
load :name => 'kilogram force',
|
306
|
-
load :name => 'knot',
|
307
|
-
load :name => 'lambert',
|
308
|
-
load :name => 'light year',
|
309
|
-
load :name => 'line',
|
310
|
-
load :name => 'link',
|
311
|
-
load :name => 'litre',
|
312
|
-
load :name => 'long ton',
|
313
|
-
load :name => 'maxwell',
|
314
|
-
load :name => 'metric horsepower',
|
315
|
-
load :name => 'mile',
|
316
|
-
load :name => 'millibar',
|
317
|
-
load :name => 'millimetre of mercury',
|
318
|
-
load :name => 'minute',
|
319
|
-
load :name => 'month',
|
320
|
-
load :name => 'nautical league',
|
321
|
-
load :name => 'nautical mile',
|
322
|
-
load :name => 'ounce',
|
323
|
-
load :name => 'parsec',
|
324
|
-
load :name => 'pennyweight',
|
325
|
-
load :name => 'petroleum barrel',
|
326
|
-
load :name => 'point',
|
327
|
-
load :name => 'poncelot',
|
328
|
-
load :name => 'pound',
|
329
|
-
load :name => 'poundal',
|
330
|
-
load :name => 'pound force',
|
331
|
-
load :name => 'quad',
|
332
|
-
load :name => 'rad',
|
333
|
-
load :name => 'rem',
|
334
|
-
load :name => 'revolution',
|
335
|
-
load :name => 'reyn',
|
336
|
-
load :name => 'rood',
|
337
|
-
load :name => 'rutherford',
|
338
|
-
load :name => 'rydberg',
|
339
|
-
load :name => 'short ton',
|
340
|
-
load :name => 'sidereal day',
|
341
|
-
load :name => 'sidereal year',
|
342
|
-
load :name => 'statute league',
|
343
|
-
load :name => 'sphere',
|
344
|
-
load :name => 'sthene',
|
345
|
-
load :name => 'stokes',
|
346
|
-
load :name => 'stone',
|
347
|
-
load :name => 'therm',
|
348
|
-
load :name => 'thermie',
|
349
|
-
load :name => 'tog',
|
350
|
-
load :name => 'tonne',
|
351
|
-
load :name => 'unified atomic mass',
|
352
|
-
load :name => '
|
353
|
-
load :name => '
|
354
|
-
load :name => '
|
355
|
-
load :name => '
|
356
|
-
load :name => '
|
357
|
-
load :name => '
|
358
|
-
load :name => '
|
359
|
-
load :name => '
|
360
|
-
load :name => '
|
361
|
-
load :name => '
|
362
|
-
load :name => '
|
363
|
-
load :name => '
|
364
|
-
load :name => 'week',
|
365
|
-
load :name => 'yard',
|
366
|
-
load :name => 'year',
|
238
|
+
load :name => 'acre', :physical_quantity => 'area', :factor => 4046.8564224, :symbol => 'acre', :label => 'acre'
|
239
|
+
load :name => 'angstrom', :physical_quantity => 'length', :factor => 100e-12, :symbol => 'Å', :label => 'Å'
|
240
|
+
load :name => 'arcminute', :physical_quantity => 'plane angle', :factor => Math::PI/10800, :symbol => '′', :label => '′'
|
241
|
+
load :name => 'arcsecond', :physical_quantity => 'plane angle', :factor => Math::PI/648000, :symbol => '″', :label => '″'
|
242
|
+
load :name => 'are', :physical_quantity => 'area', :factor => 100.0, :symbol => 'a', :label => 'a'
|
243
|
+
load :name => 'astronomical unit', :physical_quantity => 'length', :factor => 149.5979e9, :symbol => 'AU', :label => 'ua'
|
244
|
+
load :name => 'atmosphere', :physical_quantity => 'pressure', :factor => 101.325e3, :symbol => 'atm', :label => 'atm'
|
245
|
+
load :name => 'bar', :physical_quantity => 'pressure', :factor => 100e3, :symbol => 'bar', :label => 'bar'
|
246
|
+
load :name => 'barn', :physical_quantity => 'area', :factor => 100e-30, :symbol => 'b', :label => 'b'
|
247
|
+
load :name => 'biot', :physical_quantity => 'electric current', :factor => 10.0, :symbol => 'Bi', :label => 'Bi'
|
248
|
+
load :name => 'boiler horsepower', :physical_quantity => 'power', :factor => 9.80950e3, :symbol => 'bhp', :label => 'bhp'
|
249
|
+
load :name => 'british thermal unit (59 °F)', :physical_quantity => 'energy', :factor => 1054.804, :symbol => 'BTU', :label => 'BTU_FiftyNineF'
|
250
|
+
load :name => 'british thermal unit (39 °F)', :physical_quantity => 'energy', :factor => 1059.67, :symbol => 'BTU', :label => 'BTU_ThirtyNineF'
|
251
|
+
load :name => 'british thermal unit (60 °F)', :physical_quantity => 'energy', :factor => 1054.68, :symbol => 'BTU', :label => 'BTU_SixtyF'
|
252
|
+
load :name => 'british thermal unit (63 °F)', :physical_quantity => 'energy', :factor => 1054.6, :symbol => 'BTU', :label => 'BTU_SixtyThreeF'
|
253
|
+
load :name => 'british thermal unit (ISO)', :physical_quantity => 'energy', :factor => 1055.056, :symbol => 'BTU', :label => 'BTU_ISO'
|
254
|
+
load :name => 'british thermal unit (IT)', :physical_quantity => 'energy', :factor => 1055.05585262, :symbol => 'BTU', :label => 'BTU_IT'
|
255
|
+
load :name => 'british thermal unit (mean)', :physical_quantity => 'energy', :factor => 1055.87, :symbol => 'BTU', :label => 'BTU_Mean'
|
256
|
+
load :name => 'british thermal unit (thermochemical)', :physical_quantity => 'energy', :factor => 1054.35026444, :symbol => 'BTU', :label => 'BTU_Thermochemical'
|
257
|
+
load :name => 'US bushel', :physical_quantity => 'volume', :factor => 36.36872e-3, :symbol => 'bu (Imp)', :label => 'bu_imp'
|
258
|
+
load :name => 'UK bushel', :physical_quantity => 'volume', :factor => 35.23907e-3, :symbol => 'bu (US lvl)', :label => 'bu_us'
|
259
|
+
load :name => 'byte', :physical_quantity => 'information', :factor => 8, :symbol => 'byte', :label => 'byte'
|
260
|
+
load :name => 'calorie', :physical_quantity => 'energy', :factor => 4.1868, :symbol => 'cal', :label => 'cal'
|
261
|
+
load :name => 'candle power', :physical_quantity => 'luminous flux', :factor => 4*Math::PI, :symbol => 'cp', :label => 'cp'
|
262
|
+
load :name => 'carat', :physical_quantity => 'mass', :factor => 200e-6, :symbol => 'kt', :label => 'kt'
|
263
|
+
load :name => 'celsius heat unit', :physical_quantity => 'energy', :factor => 1.0899101e3, :symbol => 'CHU', :label => 'CHU'
|
264
|
+
load :name => 'centimetre of mercury', :physical_quantity => 'pressure', :factor => 1.333222e3, :symbol => 'cmHg', :label => 'cmHg'
|
265
|
+
load :name => 'centimetre of water', :physical_quantity => 'pressure', :factor => 98.060616, :symbol => 'cmH2O', :label => 'cmH2O'
|
266
|
+
load :name => 'chain', :physical_quantity => 'length', :factor => 20.1168, :symbol => 'ch', :label => 'ch'
|
267
|
+
load :name => 'clo', :physical_quantity => 'thermal resistance', :factor => 0.155, :symbol => 'clo', :label => 'clo'
|
268
|
+
load :name => 'cup', :physical_quantity => 'volume', :factor => 236.5882e-6, :symbol => 'c (US)', :label => 'c_us'
|
269
|
+
load :name => 'curie', :physical_quantity => 'radioactivity', :factor => 37.0e9, :symbol => 'Ci', :label => 'Ci'
|
270
|
+
load :name => 'day', :physical_quantity => 'time', :factor => 86.4e3, :symbol => 'd', :label => 'd'
|
271
|
+
load :name => 'degree', :physical_quantity => 'plane angle', :factor => Math::PI/180.0, :symbol => '°', :label => '°'
|
272
|
+
load :name => 'degree celsius', :physical_quantity => 'temperature', :symbol => '°C', :label => '°C', :scaling => 273.15
|
273
|
+
load :name => 'degree farenheit', :physical_quantity => 'temperature', :factor => 5.0/9.0, :symbol => '°F', :label => '°F', :scaling => 459.67
|
274
|
+
load :name => 'degree rankine', :physical_quantity => 'temperature', :factor => 5.0/9.0, :symbol => '°R', :label => '°R'
|
275
|
+
load :name => 'dram', :physical_quantity => 'length', :factor => 1.771845e-3, :symbol => 'dram', :label => 'dram'
|
276
|
+
load :name => 'dyne', :physical_quantity => 'force', :factor => 10e-6, :symbol => 'dyn', :label => 'dyn'
|
277
|
+
load :name => 'dyne centimetre', :physical_quantity => 'energy', :factor => 100e-9, :symbol => 'dyn cm', :label => 'dyn_cm'
|
278
|
+
load :name => 'electric horsepower', :physical_quantity => 'power', :factor => 746.0, :symbol => 'hp', :label => 'hp_elec'
|
279
|
+
load :name => 'electron mass', :physical_quantity => 'mass', :factor => 9.10938188e-31, :symbol => 'me', :label => 'me'
|
280
|
+
load :name => 'electron volt', :physical_quantity => 'energy', :factor => 160.218e-21, :symbol => 'eV', :label => 'eV'
|
281
|
+
load :name => 'ell', :physical_quantity => 'length', :factor => 1.143, :symbol => 'ell', :label => 'ell'
|
282
|
+
load :name => 'erg', :physical_quantity => 'energy', :factor => 100.0e-9, :symbol => 'erg', :label => 'erg'
|
283
|
+
load :name => 'faraday', :physical_quantity => 'electric charge', :factor => 96.4853e3, :symbol => 'F', :label => 'Fd'
|
284
|
+
load :name => 'fathom', :physical_quantity => 'length', :factor => 1.828804, :symbol => 'ftm', :label => 'ftm'
|
285
|
+
load :name => 'fermi', :physical_quantity => 'length', :factor => 1e-15, :symbol => 'fm', :label => 'fm'
|
286
|
+
load :name => 'foot', :physical_quantity => 'length', :factor => 0.3048, :symbol => 'ft', :label => 'ft'
|
287
|
+
load :name => 'footcandle', :physical_quantity => 'illuminance', :factor => 10.76391, :symbol => 'fc', :label => 'fc'
|
288
|
+
load :name => 'foot of water', :physical_quantity => 'pressure', :factor => 2.988887e3, :symbol => 'ftH2O', :label => 'ftH2O'
|
289
|
+
load :name => 'franklin', :physical_quantity => 'electric charge', :factor => 3.3356e-10, :symbol => 'Fr', :label => 'Fr'
|
290
|
+
load :name => 'furlong', :physical_quantity => 'length', :factor => 201.168, :symbol => 'fur', :label => 'fur'
|
291
|
+
load :name => 'gamma', :physical_quantity => 'magnetic flux density', :factor => 1e-9, :symbol => 'γ', :label => 'γ'
|
292
|
+
load :name => 'gauss', :physical_quantity => 'magnetic flux density', :factor => 100e-6, :symbol => 'G', :label => 'G'
|
293
|
+
load :name => 'grad', :physical_quantity => 'plane_angle', :factor => Math::PI/200.0, :symbol => 'grad', :label => 'grade'
|
294
|
+
load :name => 'grain', :physical_quantity => 'mass', :factor => 64.79891e-6, :symbol => 'gr', :label => 'gr'
|
295
|
+
load :name => 'hartree', :physical_quantity => 'energy', :factor => 4.359748e-18, :symbol => 'Eh', :label => 'Eh'
|
296
|
+
load :name => 'hectare', :physical_quantity => 'area', :factor => 10e3, :symbol => 'ha', :label => 'ha'
|
297
|
+
load :name => 'hogshead', :physical_quantity => 'volume', :factor => 238.6697e-3, :symbol => 'hhd', :label => 'hhd'
|
298
|
+
load :name => 'hour', :physical_quantity => 'time', :factor => 3.6e3, :symbol => 'h', :label => 'h'
|
299
|
+
load :name => 'hundredweight long', :physical_quantity => 'mass', :factor => 50.802345, :symbol => 'cwt', :label => 'cwt_long'
|
300
|
+
load :name => 'hundredweight short', :physical_quantity => 'mass', :factor => 45.359237, :symbol => 'cwt', :label => 'cwt_short'
|
301
|
+
load :name => 'inch', :physical_quantity => 'length', :factor => 25.4e-3, :symbol => 'in', :label => 'in'
|
302
|
+
load :name => 'inch of mercury', :physical_quantity => 'pressure', :factor => 3.386389e3, :symbol => 'inHg', :label => 'inHg'
|
303
|
+
load :name => 'inch of water', :physical_quantity => 'pressure', :factor => 249.0740, :symbol => 'inH2O', :label => 'inH2O'
|
304
|
+
load :name => 'kilocalorie', :physical_quantity => 'energy', :factor => 4.1868e3, :symbol => 'kcal', :label => 'kcal'
|
305
|
+
load :name => 'kilogram force', :physical_quantity => 'force', :factor => 9.80665, :symbol => 'kgf', :label => 'kgf'
|
306
|
+
load :name => 'knot', :physical_quantity => 'velocity', :factor => 514.4444e-3, :symbol => 'kn', :label => 'kn'
|
307
|
+
load :name => 'lambert', :physical_quantity => 'illuminance', :factor => 1e4, :symbol => 'La', :label => 'La'
|
308
|
+
load :name => 'light year', :physical_quantity => 'length', :factor => 9.46073e15, :symbol => 'ly', :label => 'ly'
|
309
|
+
load :name => 'line', :physical_quantity => 'length', :factor => 2.116667e-3, :symbol => 'ln', :label => 'ln'
|
310
|
+
load :name => 'link', :physical_quantity => 'length', :factor => 201.168e-3, :symbol => 'lnk', :label => 'lnk'
|
311
|
+
load :name => 'litre', :physical_quantity => 'volume', :factor => 1e-3, :symbol => 'L', :label => 'L'
|
312
|
+
load :name => 'long ton', :physical_quantity => 'mass', :factor => 1.016047, :symbol => 'ton', :label => 'ton_uk'
|
313
|
+
load :name => 'maxwell', :physical_quantity => 'magnetic flux', :factor => 10e-9, :symbol => 'Mx', :label => 'Mx'
|
314
|
+
load :name => 'metric horsepower', :physical_quantity => 'power', :factor => 735.4988, :symbol => 'hp', :label => 'hp'
|
315
|
+
load :name => 'mile', :physical_quantity => 'length', :factor => 1.609344e3, :symbol => 'mi', :label => 'mi'
|
316
|
+
load :name => 'millibar', :physical_quantity => 'pressure', :factor => 100, :symbol => 'mbar', :label => 'mbar'
|
317
|
+
load :name => 'millimetre of mercury', :physical_quantity => 'pressure', :factor => 1.333222e2, :symbol => 'mmHg', :label => 'mmHg'
|
318
|
+
load :name => 'minute', :physical_quantity => 'time', :factor => 60.0, :symbol => 'min', :label => 'min'
|
319
|
+
load :name => 'month', :physical_quantity => 'time', :factor => 2.551444e6, :symbol => 'month', :label => 'month'
|
320
|
+
load :name => 'nautical league', :physical_quantity => 'length', :factor => 5.556e3, :symbol => 'nl', :label => 'nl'
|
321
|
+
load :name => 'nautical mile', :physical_quantity => 'length', :factor => 1.852e3, :symbol => 'nmi', :label => 'nmi'
|
322
|
+
load :name => 'ounce', :physical_quantity => 'mass', :factor => 28.34952e-3, :symbol => 'oz', :label => 'oz'
|
323
|
+
load :name => 'parsec', :physical_quantity => 'length', :factor => 30.85678e15, :symbol => 'pc', :label => 'pc'
|
324
|
+
load :name => 'pennyweight', :physical_quantity => 'mass', :factor => 1.555174e-3, :symbol => 'dwt', :label => 'dwt'
|
325
|
+
load :name => 'petroleum barrel', :physical_quantity => 'volume', :factor => 158.9873e-3, :symbol => 'bbl', :label => 'bbl'
|
326
|
+
load :name => 'point', :physical_quantity => 'length', :factor => 351.4598e-6, :symbol => 'pt', :label => 'pt'
|
327
|
+
load :name => 'poncelot', :physical_quantity => 'power', :factor => 980.665, :symbol => 'p', :label => 'p'
|
328
|
+
load :name => 'pound', :physical_quantity => 'mass', :factor => 0.45359237, :symbol => 'lb', :label => 'lb'
|
329
|
+
load :name => 'poundal', :physical_quantity => 'force', :factor => 138.255, :symbol => 'pdl', :label => 'pdl'
|
330
|
+
load :name => 'pound force', :physical_quantity => 'force', :factor => 4.448222, :symbol => 'lbf', :label => 'lbf'
|
331
|
+
load :name => 'quad', :physical_quantity => 'energy', :factor => 1.055056e18, :symbol => 'quad', :label => 'quad'
|
332
|
+
load :name => 'rad', :physical_quantity => 'radiation absorbed dose', :factor => 0.01, :symbol => 'rad', :label => 'rd'
|
333
|
+
load :name => 'rem', :physical_quantity => 'radiation_dose_equivalent', :factor => 0.01, :symbol => 'rem', :label => 'rem'
|
334
|
+
load :name => 'revolution', :physical_quantity => 'plane angle', :factor => 2*Math::PI, :symbol => 'rev', :label => 'rev'
|
335
|
+
load :name => 'reyn', :physical_quantity => 'dynamic viscosity', :factor => 689.5e3, :symbol => 'reyn', :label => 'reyn'
|
336
|
+
load :name => 'rood', :physical_quantity => 'area', :factor => 1.011714e3, :symbol => 'rood', :label => 'rood'
|
337
|
+
load :name => 'rutherford', :physical_quantity => 'radioactivity', :factor => 1e6, :symbol => 'rd', :label => 'Rd'
|
338
|
+
load :name => 'rydberg', :physical_quantity => 'energy', :factor => 2.179874e-18, :symbol => 'Ry', :label => 'Ry'
|
339
|
+
load :name => 'short ton', :physical_quantity => 'mass', :factor => 907.1847, :symbol => 'ton', :label => 'ton_us'
|
340
|
+
load :name => 'sidereal day', :physical_quantity => 'time', :factor => 86.16409053e3, :symbol => 'd', :label => 'day_sidereal'
|
341
|
+
load :name => 'sidereal year', :physical_quantity => 'time', :factor => 31558823.803728, :symbol => 'yr', :label => 'year_sidereal'
|
342
|
+
load :name => 'statute league', :physical_quantity => 'length', :factor => 4.828032e3, :symbol => 'lea', :label => 'lea'
|
343
|
+
load :name => 'sphere', :physical_quantity => 'solid angle', :factor => 4*Math::PI, :symbol => 'sphere', :label => 'sphere'
|
344
|
+
load :name => 'sthene', :physical_quantity => 'force', :factor => 1e3, :symbol => 'sn', :label => 'sn'
|
345
|
+
load :name => 'stokes', :physical_quantity => 'kinematic viscosity', :factor => 100e-6, :symbol => 'St', :label => 'St'
|
346
|
+
load :name => 'stone', :physical_quantity => 'mass', :factor => 6.350293, :symbol => 'st', :label => 'st'
|
347
|
+
load :name => 'therm', :physical_quantity => 'energy', :factor => 105.506e6, :symbol => 'thm', :label => 'thm'
|
348
|
+
load :name => 'thermie', :physical_quantity => 'energy', :factor => 4.185407e6, :symbol => 'th', :label => 'th'
|
349
|
+
load :name => 'tog', :physical_quantity => 'thermal resistance', :factor => 0.1, :symbol => 'tog', :label => 'tog'
|
350
|
+
load :name => 'tonne', :physical_quantity => 'mass', :factor => 1000.0, :symbol => 't', :label => 't'
|
351
|
+
load :name => 'unified atomic mass', :physical_quantity => 'mass', :factor => 1.66054e-27, :symbol => 'u', :label => 'u'
|
352
|
+
load :name => 'UK barrel', :physical_quantity => 'volume', :factor => 163.6592e-3, :symbol => 'bl (Imp)', :label => 'bbl_imp'
|
353
|
+
load :name => 'UK fluid ounce', :physical_quantity => 'volume', :factor => 28.41308e-6, :symbol => 'fl oz', :label => 'oz_fl_uk'
|
354
|
+
load :name => 'UK gallon', :physical_quantity => 'volume', :factor => 4.546092e-3, :symbol => 'gal', :label => 'gal_uk'
|
355
|
+
load :name => 'UK gill', :physical_quantity => 'volume', :factor => 142.0654e-6, :symbol => 'gi', :label => 'gi_uk'
|
356
|
+
load :name => 'UK horsepower', :physical_quantity => 'power', :factor => 745.6999, :symbol => 'hp', :label => 'hp_uk'
|
357
|
+
load :name => 'US dry gallon', :physical_quantity => 'volume', :factor => 4.40488377086e-3, :symbol => 'gal', :label => 'gallon_dry_us'
|
358
|
+
load :name => 'US dry barrel', :physical_quantity => 'volume', :factor => 115.6271e-3, :symbol => 'bl (US)', :label => 'bbl_dry_us'
|
359
|
+
load :name => 'US fluid ounce', :physical_quantity => 'volume', :factor => 29.57353e-6, :symbol => 'fl oz', :label => 'oz_fl'
|
360
|
+
load :name => 'US gill', :physical_quantity => 'volume', :factor => 118.2941e-6, :symbol => 'gi', :label => 'gi_us'
|
361
|
+
load :name => 'US liquid barrel', :physical_quantity => 'volume', :factor => 119.2405e-3, :symbol => 'fl bl (US)', :label => 'bbl_fl_us'
|
362
|
+
load :name => 'US liquid gallon', :physical_quantity => 'volume', :factor => 3.785412e-3, :symbol => 'gal', :label => 'gal'
|
363
|
+
load :name => 'US survey foot', :physical_quantity => 'length', :factor => 304.8e-3, :symbol => 'ft', :label => 'foot_survey_us'
|
364
|
+
load :name => 'week', :physical_quantity => 'time', :factor => 604800, :symbol => 'wk', :label => 'week'
|
365
|
+
load :name => 'yard', :physical_quantity => 'length', :factor => 0.9144, :symbol => 'yd', :label => 'yd'
|
366
|
+
load :name => 'year', :physical_quantity => 'time', :factor => 31557600, :symbol => 'yr', :label => 'year'
|
367
367
|
|
368
368
|
construct_and_load(kW*h) do |unit|
|
369
369
|
unit.symbol = 'kWh'
|
@@ -376,4 +376,4 @@ Unit::NonSI.configure do
|
|
376
376
|
|
377
377
|
non_si_base_units.each { |unit| unit.acts_as_equivalent_unit = true }
|
378
378
|
|
379
|
-
end
|
379
|
+
end
|