Next: , Previous: Unit Lists, Up: Top

8 Logging Calculations

The --log option allows you to save the results of calculations in a file; this can be useful if you need a permanent record of your work. For example, the fluid-flow conversion in Complicated Unit Expressions, is lengthy, and if you were to use it in designing a piping system, you might want a record of it for the project file. If the interactive session

     You have: (8/pi^2)(lbm/ft^3)ft(ft^3/s)^2(1/in^5)
     You want: psi
             * 43.533969
             / 0.022970568

were logged, the log file would contain

     From: (8/pi^2)(lbm/ft^3)ft(ft^3/s)^2(1/in^5)
     To:   psi
             * 43.533969
             / 0.022970568

The log includes conformability errors between the units at the ‘You have: and ‘You want: prompts, but not other errors, including lack of conformability of items in sums or differences or among items in a unit list. For example, a conversion between zenith angle and elevation angle could involve

     You have: 90 deg - (5 deg + 22 min + 9 sec)
     Illegal sum or difference of non-conformable units
     You have: 90 deg - (5 deg + 22 arcmin + 9 arcsec)
     You want: dms
             84 deg + 37 arcmin + 51 arcsec
     You have: _
     You want: deg
             * 84.630833
             / 0.011816024
     You have:

The log file would contain

     From: 90 deg - (5 deg + 22 arcmin + 9 arcsec)
     To:   deg;arcmin;arcsec
             84 deg + 37 arcmin + 51 arcsec
     From: _
     To:   deg
             * 84.630833
             / 0.011816024

The initial entry error (forgetting that minutes have dimension of time, and that arcminutes must be used for dimensions of angle) does not appear in the output. When converting to a unit list alias, units expands the alias in the log file.

The ‘From:’ and ‘To:’ tags are written to the log file even if the ‘--quiet’ option is given. If the log file exists when units is invoked, the new results are appended to the log file.