fbpx
Wikipedia

GNU Units

GNU Units is a cross-platform computer program for conversion of units of quantities. It has a database of measurement units, including esoteric and historical units. This for instance allows conversion of velocities specified in furlongs per fortnight, and pressures specified in tons per acre. Output units are checked for consistency with the input, allowing verification of conversion of complex expressions.

Units
Developer(s)GNU Project
Repositoryweb.cvs.savannah.gnu.org/viewvc/units/
Operating systemLinux, FreeBSD, NetBSD, OpenBSD, most Unix implementations, Windows
PlatformIncluded with some[which?] Linux distributions. Two Windows binary distributions are available; distribution for other platforms is source only.
Size1.2 Megabytes (tar source)
TypeUtility
License2007: GPL-3.0-or-later[a]
1997: GPL-2.0-or-later[b]
Websitewww.gnu.org/software/units/ 

History edit

GNU Units was written by Adrian Mariano as an implementation of the units utility included with the Unix operating system. It was originally available under a permissive license. The GNU variant is distributed under the GPL although the FreeBSD project maintains a free fork of units from before the license change.

units (Unix utility) edit

The original units program has been a standard part of Unix since the early Bell Laboratories versions.[1] Source code for a version very similar to the original is available from the Heirloom Project. [2]

The GNU implementation edit

GNU units includes several extensions to the original version,[3] including

  • Exponents can be written with ^ or **.
  • Exponents can be larger than 9 if written with ^ or **.
  • Rational and decimal exponents are supported.
  • Sums of units (e.g., btu + ft lbf) can be converted.
  • Conversions can be made to sums of units, termed unit lists (e.g., from degrees to degrees, minutes, and seconds).
  • Units that measure reciprocal dimensions can be converted (e.g., S to megohm).
  • Parentheses for grouping are supported. This sometimes allows more natural expressions, such as in the example given in Complex units expressions.
  • Roots of units (e.g., sqrt((lbf/inch) / lb) can be computed.
  • Nonlinear units conversions (e.g., °F to °C) are supported.
  • Functions such as sin, cos, ln, log, and log2 are included.
  • A script for updating the currency conversions is included; the script requires Python.

Units definitions, including nonlinear conversions and unit lists, are user extensible.

The plain text database definitions.units is a good reference in itself, as it is extensively commented and cites numerous sources.

Other implementations edit

UDUNITS is a similar utility program, except that it has an additional programming library interface and date conversion abilities. UDUNITS is considered the de facto program and library for variable unit conversion for netCDF files.[4]

Version history edit

GNU Units version 2.19 was released on 31 May 2019, to reflect the new 2019 revision of the SI; Version 2.14 released on 8 March 2017 fixed several minor bugs and improved support for building on Windows. Version 2.10, released on 26 March 2014, added support for rational exponents greater than one, and added the ability to save an interactive session in a file to provide a record of the conversions performed. Beginning with version 2.10, a 32-bit Windows binary distribution has been available on the project Web page (a 32-bit Windows port of version 1.87 has been available since 2008 as part of the GnuWin32 project).

Version 2.02, released on 11 July 2013, added hexadecimal floating-point output and two other options to simplify changing the output format.

Version 2.0, released on 2 July 2012, added the ability to convert to sums of units, such as hours and minutes or feet and inches. In addition, this release added support for UTF-8 encoding.[5] Provision for locale-specific unit definitions was added. The syntax for defining non-linear units was changed, and added optional domain and range specifications. The names of the standard and personal units data files were changed, and the currency definitions were placed in a separate data file; a Python script for updating the currency definitions was added.

The version history is covered in detail in the NEWS file included with the source distribution.

Usage edit

Units will output the result of the conversion in two lines. Usually, the first line (multiplication) is the desired result; the second line is the same conversion expressed as a division.

Units can also function as a general-purpose scientific calculator; it includes several built-in mathematical functions such as sin, cos, atan, ln, exp, etc.

Attempting to convert types of measurements that are incompatible will cause units to print a conformability error message and display a reduced form of each measurement.

Examples edit

The examples that follow show results from GNU units version 2.10.

Interactive mode edit

Currency exchange rates from www.timegenie.com on 2014-03-28 2729 units, 92 prefixes, 77 nonlinear units You have: 10 furlongs You want: miles * 1.25 / 0.8 You have: 1 gallon + 3 pints You want: quarts * 5.5 / 0.18181818 You have: sqrt(meter) ^ Unit not a root You have: sqrt(acre) You want: ft * 208.71033 / 0.0047913298 You have: 21 btu + 6500 ft lbf You want: btu * 29.352939 / 0.034068139 You have: _ You want: J * 30968.99 / 3.2290366e-005 You have: 3.277 hr You want: time 3 hr + 16 min + 37.2 sec You have: 1|2 inch You want: cm * 1.27 / 0.78740157 

The underscore ('_') is used to indicate the result of the last successful unit conversion.

On the command line (non-interactive) edit

C:\>units "ten furlongs per fortnight" "kilometers per hour"  * 0.0059871429  / 167.02458 
% units cup ounces conformability error  0.00023658824 m^3  0.028349523 kg 

Complex units expressions edit

One form of the Darcy–Weisbach equation for fluid flow is

 

where ΔP is the pressure drop, ρ is the mass density, f is the (dimensionless) friction factor, L is the length of the pipe, Q is the volumetric flow rate, and d is the pipe diameter. It might be desirable to have the equation in the form

 

that would accept typical US units; the constant A1 could be determined manually using the unit-factor method, but it could be determined more quickly and easily using units:[6]

$ units "(8/pi^2)(lbm/ft^3)ft(ft^3/s)^2(1/in^5)" psi  * 43.533969  / 0.022970568 

Crane Technical Paper No. 410,[7] Eq. 3-5, gives the multiplicative value as 43.5.

See also edit

Notes edit

  1. ^ GPL-3.0-or-later since 2007-09-26 (1.87)
  2. ^ GPL-2.0-or-later from 1997-01-14 (1.53) until 2006-11-11 (1.86)

References edit

  1. ^ Bell Telephone Laboratories, Incorporated (1979). . Murray Hill, NJ: Alcatel-Lucent Bell Labs. Archived from the original on 2008-10-19. Retrieved 2011-04-23. Online archive of the manual pages included with the Seventh Edition Unix distribution tapes.
  2. ^ "Heirloom Project CVS repository". Retrieved 2016-02-01.
  3. ^ Mariano, Adrian (2014). "Units: A Unit Conversion Program and Scientific Calculator". Boston, MA: Free Software Foundation, Inc. Retrieved 2014-03-29.
  4. ^ As specified from several NetCDF conventions, e.g.:
    • COARDS. 1995-02-10. Archived from the original on 2010-05-27. Retrieved 2007-04-12.
    • CF"NetCDF Climate and Forecast (CF) Metadata Conventions". 2014-03-29.
  5. ^ (German language) « GNU Units 2.0 berechnet Feet und Inches  », linux-magazin.de, 3 July 2012.
  6. ^ GNU units version 2.10, Windows XP SP3, PTC MKS Korn shell
  7. ^ Technical Paper No. 410, Flow of Fluids through Valves, Fittings, and Pipe. New York: Crane Co. 1985.

External links edit

  • Official website  
  • Linux man page for units
  • Java version of GNU units
  • GnuWin port of GNU units
  • units source from the Heirloom Project
  • Online units converter based on GNU units
  • A simple online converter based on GNU units
  • UDUNITS

units, cross, platform, computer, program, conversion, units, quantities, database, measurement, units, including, esoteric, historical, units, this, instance, allows, conversion, velocities, specified, furlongs, fortnight, pressures, specified, tons, acre, ou. GNU Units is a cross platform computer program for conversion of units of quantities It has a database of measurement units including esoteric and historical units This for instance allows conversion of velocities specified in furlongs per fortnight and pressures specified in tons per acre Output units are checked for consistency with the input allowing verification of conversion of complex expressions UnitsDeveloper s GNU ProjectRepositoryweb wbr cvs wbr savannah wbr gnu wbr org wbr viewvc wbr units wbr Operating systemLinux FreeBSD NetBSD OpenBSD most Unix implementations WindowsPlatformIncluded with some which Linux distributions Two Windows binary distributions are available distribution for other platforms is source only Size1 2 Megabytes tar source TypeUtilityLicense2007 GPL 3 0 or later a 1997 GPL 2 0 or later b Websitewww wbr gnu wbr org wbr software wbr units wbr Free and open source software portal Contents 1 History 1 1 units Unix utility 1 2 The GNU implementation 1 3 Other implementations 1 4 Version history 2 Usage 3 Examples 3 1 Interactive mode 3 2 On the command line non interactive 3 3 Complex units expressions 4 See also 5 Notes 6 References 7 External linksHistory editGNU Units was written by Adrian Mariano as an implementation of the units utility included with the Unix operating system It was originally available under a permissive license The GNU variant is distributed under the GPL although the FreeBSD project maintains a free fork of units from before the license change units Unix utility edit The original units program has been a standard part of Unix since the early Bell Laboratories versions 1 Source code for a version very similar to the original is available from the Heirloom Project 2 The GNU implementation edit GNU units includes several extensions to the original version 3 including Exponents can be written with or Exponents can be larger than 9 if written with or Rational and decimal exponents are supported Sums of units e g span class nowrap btu ft lbf span can be converted Conversions can be made to sums of units termed unit lists e g from degrees to degrees minutes and seconds Units that measure reciprocal dimensions can be converted e g S to megohm Parentheses for grouping are supported This sometimes allows more natural expressions such as in the example given in Complex units expressions Roots of units e g span class nowrap sqrt lbf inch lb span can be computed Nonlinear units conversions e g F to C are supported Functions such as sin cos ln log and log2 are included A script for updating the currency conversions is included the script requires Python Units definitions including nonlinear conversions and unit lists are user extensible The plain text database definitions units is a good reference in itself as it is extensively commented and cites numerous sources Other implementations edit UDUNITS is a similar utility program except that it has an additional programming library interface and date conversion abilities UDUNITS is considered the de facto program and library for variable unit conversion for netCDF files 4 Version history edit GNU Units version 2 19 was released on 31 May 2019 to reflect the new 2019 revision of the SI Version 2 14 released on 8 March 2017 fixed several minor bugs and improved support for building on Windows Version 2 10 released on 26 March 2014 added support for rational exponents greater than one and added the ability to save an interactive session in a file to provide a record of the conversions performed Beginning with version 2 10 a 32 bit Windows binary distribution has been available on the project Web page a 32 bit Windows port of version 1 87 has been available since 2008 as part of the GnuWin32 project Version 2 02 released on 11 July 2013 added hexadecimal floating point output and two other options to simplify changing the output format Version 2 0 released on 2 July 2012 added the ability to convert to sums of units such as hours and minutes or feet and inches In addition this release added support for UTF 8 encoding 5 Provision for locale specific unit definitions was added The syntax for defining non linear units was changed and added optional domain and range specifications The names of the standard and personal units data files were changed and the currency definitions were placed in a separate data file a Python script for updating the currency definitions was added The version history is covered in detail in the NEWS file included with the source distribution Usage editUnits will output the result of the conversion in two lines Usually the first line multiplication is the desired result the second line is the same conversion expressed as a division Units can also function as a general purpose scientific calculator it includes several built in mathematical functions such as sin cos atan ln exp etc Attempting to convert types of measurements that are incompatible will cause units to print a conformability error message and display a reduced form of each measurement Examples editThe examples that follow show results from GNU units version 2 10 Interactive mode edit Currency exchange rates from www timegenie com on 2014 03 28 2729 units 92 prefixes 77 nonlinear units You have 10 furlongs You want miles 1 25 0 8 You have 1 gallon 3 pints You want quarts 5 5 0 18181818 You have sqrt meter Unit not a root You have sqrt acre You want ft 208 71033 0 0047913298 You have 21 btu 6500 ft lbf You want btu 29 352939 0 034068139 You have You want J 30968 99 3 2290366e 005 You have 3 277 hr You want time 3 hr 16 min 37 2 sec You have 1 2 inch You want cm 1 27 0 78740157 The underscore is used to indicate the result of the last successful unit conversion On the command line non interactive edit C gt units ten furlongs per fortnight kilometers per hour 0 0059871429 167 02458 units cup ounces conformability error 0 00023658824 m 3 0 028349523 kg Complex units expressions edit One form of the Darcy Weisbach equation for fluid flow is D P 8 p 2 r f L Q 2 d 5 displaystyle Delta P frac 8 pi 2 rho fL frac Q 2 d 5 nbsp where DP is the pressure drop r is the mass density f is the dimensionless friction factor L is the length of the pipe Q is the volumetric flow rate and d is the pipe diameter It might be desirable to have the equation in the form D P A 1 r f L Q 2 d 5 displaystyle Delta P A 1 rho fL frac Q 2 d 5 nbsp that would accept typical US units the constant A1 could be determined manually using the unit factor method but it could be determined more quickly and easily using units 6 units 8 pi 2 lbm ft 3 ft ft 3 s 2 1 in 5 psi 43 533969 0 022970568 Crane Technical Paper No 410 7 Eq 3 5 gives the multiplicative value as 43 5 See also editUnified Code for Units of MeasureNotes edit GPL 3 0 or later since 2007 09 26 1 87 GPL 2 0 or later from 1997 01 14 1 53 until 2006 11 11 1 86 References edit Bell Telephone Laboratories Incorporated 1979 Unix Seventh Edition Manual Murray Hill NJ Alcatel Lucent Bell Labs Archived from the original on 2008 10 19 Retrieved 2011 04 23 Online archive of the manual pages included with the Seventh Edition Unix distribution tapes Heirloom Project CVS repository Retrieved 2016 02 01 Mariano Adrian 2014 Units A Unit Conversion Program and Scientific Calculator Boston MA Free Software Foundation Inc Retrieved 2014 03 29 As specified from several NetCDF conventions e g COARDS Conventions for the standardization of NetCDF files 1995 02 10 Archived from the original on 2010 05 27 Retrieved 2007 04 12 CF NetCDF Climate and Forecast CF Metadata Conventions 2014 03 29 German language GNU Units 2 0 berechnet Feet und Inches linux magazin de 3 July 2012 GNU units version 2 10 Windows XP SP3 PTC MKS Korn shell Technical Paper No 410 Flow of Fluids through Valves Fittings and Pipe New York Crane Co 1985 External links editOfficial website nbsp Linux man page for units Java version of GNU units GnuWin port of GNU units units source from the Heirloom Project Online units converter based on GNU units A simple online converter based on GNU units UDUNITS Retrieved from https en wikipedia org w index php title GNU Units amp oldid 1146570217, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.