Tunnels.parse_length

static Tunnels.parse_length(x)

Parse data in 'Length' column, i.e. convert miles/yards to metres.

Parameters

x (str or None) – raw length data

Returns

parsed length data and, if any, additional information associated with it

Return type

tuple

Examples:

>>> from pyrcs.other_assets import Tunnels  # from pyrcs import Tunnels

>>> tunl = Tunnels()

>>> tunl.parse_length('')
(nan, 'Unavailable')

>>> tunl.parse_length('1m 182y')
(1775.7648, None)

>>> tunl.parse_length('formerly 0m236y')
(215.7984, 'Formerly')

>>> tunl.parse_length('0.325km (0m 356y)')
(325.5264, '0.325km')

>>> tunl.parse_length("0m 48yd- (['0m 58yd'])")
(48.4632, '43.89-53.04 metres')