Skip to content

Commit da00855

Browse files
committed
Add back docs for units
1 parent c8342f6 commit da00855

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

src/units.jl

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,35 @@ end
6262
@add_prefixes cd (m,)
6363
@add_prefixes mol (m,)
6464

65+
@doc(
66+
"Length in meters. Available variants: `fm`, `pm`, `nm`, `μm` (/`um`), `cm`, `dm`, `mm`, `km`, `Mm`, `Gm`.",
67+
m,
68+
)
69+
@doc(
70+
"Mass in kilograms. Available variants: `μg` (/`ug`), `mg`, `g`.",
71+
kg,
72+
)
73+
@doc(
74+
"Time in seconds. Available variants: `fs`, `ps`, `ns`, `μs` (/`us`), `ms`, `min`, `h` (/`hr`), `day`, `yr`, `kyr`, `Myr`, `Gyr`.",
75+
s,
76+
)
77+
@doc(
78+
"Current in Amperes. Available variants: `nA`, `μA` (/`uA`), `mA`, `kA`.",
79+
A,
80+
)
81+
@doc(
82+
"Temperature in Kelvin. Available variant: `mK`.",
83+
K,
84+
)
85+
@doc(
86+
"Luminosity in candela. Available variant: `mcd`.",
87+
cd,
88+
)
89+
@doc(
90+
"Amount in moles. Available variant: `mmol`.",
91+
mol,
92+
)
93+
6594
# SI derived units
6695
@register_unit Hz inv(s)
6796
@register_unit N kg * m / s^2
@@ -87,6 +116,48 @@ end
87116
@add_prefixes ohm (m,)
88117
@add_prefixes T ()
89118

119+
# SI derived units
120+
@doc(
121+
"Frequency in Hertz. Available variants: `kHz`, `MHz`, `GHz`.",
122+
Hz,
123+
)
124+
@doc(
125+
"Force in Newtons.",
126+
N,
127+
)
128+
@doc(
129+
"Pressure in Pascals. Available variant: `kPa`.",
130+
Pa,
131+
)
132+
@doc(
133+
"Energy in Joules. Available variant: `kJ`.",
134+
J,
135+
)
136+
@doc(
137+
"Power in Watts. Available variants: `kW`, `MW`, `GW`.",
138+
W,
139+
)
140+
@doc(
141+
"Charge in Coulombs.",
142+
C,
143+
)
144+
@doc(
145+
"Voltage in Volts. Available variants: `kV`, `MV`, `GV`.",
146+
V,
147+
)
148+
@doc(
149+
"Capacitance in Farads.",
150+
F,
151+
)
152+
@doc(
153+
"Resistance in Ohms. Available variant: `mΩ`. Also available is ASCII `ohm` (with variant `mohm`).",
154+
Ω,
155+
)
156+
@doc(
157+
"Magnetic flux density in Teslas.",
158+
T,
159+
)
160+
90161
# Common assorted units
91162
## Time
92163
@register_unit min 60 * s
@@ -106,11 +177,21 @@ end
106177

107178
@add_prefixes L (m, d)
108179

180+
@doc(
181+
"Volume in liters. Available variants: `mL`, `dL`.",
182+
L,
183+
)
184+
109185
## Pressure
110186
@register_unit bar 100 * kPa
111187

112188
@add_prefixes bar ()
113189

190+
@doc(
191+
"Pressure in bars.",
192+
bar,
193+
)
194+
114195
# Do not wish to define Gaussian units, as it changes
115196
# some formulas. Safer to force user to work exclusively in one unit system.
116197

0 commit comments

Comments
 (0)