Specifying CGS Units (Units: A Unit Conversion Program and Scientific Calculator)

#### 8.1.1 Specifying CGS Units ¶

The CGS definitions involve {\rm cm}^{1/2} and \({{\rm g}^{1/2}}\) , which is problematic because `units` does not normally support fractional roots of base units. The `--units` (`-u`) option allows selection of a CGS unit system and works around this restriction by introducing base units for the square roots of length and mass: ‘`sqrt_cm`’ and ‘`sqrt_g`’. The centimeter then becomes ‘`sqrt_cm^2`’ and the gram, ‘`sqrt_g^2`’. This allows working from equations using the units in the CGS system, and enforcing dimensional conformity within that system. Recognized CGS arguments to the `--units` option are ‘`gauss[ian]`’, ‘`esu`’, ‘`emu`’, ‘`lhu`’; the argument is case insensitive. You can also give ‘`si`’ which just enforces the default SI mode and displays ‘`(SI)`’ at the ‘`You have:`’ prompt to emphasize the units mode. Some other types of units are also supported as described below. Giving an unrecognized system generates a warning, and `units` uses SI units.

The changes resulting from the `--units` option are actually controlled by the `UNITS_SYSTEM` environment variable. If you frequently work with one of the supported CGS units systems, you may set this environment variable rather than giving the `--units` option at each invocation. As usual, an option given on the command line overrides the setting of the environment variable. For example, if you would normally work with Gaussian units but might occasionally work with SI, you could set `UNITS_SYSTEM` to ‘`gaussian`’ and specify SI with the `--units` option. Unlike the argument to the `--units` option, the value of `UNITS_SYSTEM` is case sensitive, so setting a value of ‘`EMU`’ will have no effect other than to give an error message and set SI units.

The CGS definitions appear as conditional settings in the standard units data file, which you can consult for more information on how these units are defined, or on how to define an alternate units system.