Distance
¶Distance
(**kwargs)[source]¶To initialize a distance object, pass in a keyword corresponding to the desired unit attribute name set with desired value. For example, the following creates a distance object representing 5 miles:
>>> dist = Distance(mi=5)
__getattr__
(unit_att)¶Returns the distance value in units corresponding to the given unit attribute. For example:
>>> print(dist.km)
8.04672
unit_attname
(unit_name)¶Returns the distance unit attribute name for the given full unit name. For example:
>>> Distance.unit_attname('Mile')
'mi'
Area
¶Area
(**kwargs)[source]¶To initialize an area object, pass in a keyword corresponding to the desired unit attribute name set with desired value. For example, the following creates an area object representing 5 square miles:
>>> a = Area(sq_mi=5)
__getattr__
(unit_att)¶Returns the area value in units corresponding to the given unit attribute. For example:
>>> print(a.sq_km)
12.949940551680001
unit_attname
(unit_name)¶Returns the area unit attribute name for the given full unit name. For example:
>>> Area.unit_attname('Kilometer')
'sq_km'
Footnotes
[1] | Robert Coup is the initial author of the measure objects, and was inspired by Brian Beck’s work in geopy and Geoff Biggs’ PhD work on dimensioned units for robotics. |
Unit Attribute | Full name or alias(es) |
---|---|
km |
Kilometre, Kilometer |
mi |
Mile |
m |
Meter, Metre |
yd |
Yard |
ft |
Foot, Foot (International) |
survey_ft |
U.S. Foot, US survey foot |
inch |
Inches |
cm |
Centimeter |
mm |
Millimetre, Millimeter |
um |
Micrometer, Micrometre |
british_ft |
British foot (Sears 1922) |
british_yd |
British yard (Sears 1922) |
british_chain_sears |
British chain (Sears 1922) |
indian_yd |
Indian yard, Yard (Indian) |
sears_yd |
Yard (Sears) |
clarke_ft |
Clarke’s Foot |
chain |
Chain |
chain_benoit |
Chain (Benoit) |
chain_sears |
Chain (Sears) |
british_chain_benoit |
British chain (Benoit 1895 B) |
british_chain_sears_truncated |
British chain (Sears 1922 truncated) |
gold_coast_ft |
Gold Coast foot |
link |
Link |
link_benoit |
Link (Benoit) |
link_sears |
Link (Sears) |
clarke_link |
Clarke’s link |
fathom |
Fathom |
rod |
Rod |
nm |
Nautical Mile |
nm_uk |
Nautical Mile (UK) |
german_m |
German legal metre |
Apr 03, 2016