nautical.units package

Submodules

nautical.units.conversion module

nautical.units.conversion.convert(value, init_units, final_units)[source]

Convert the value given the current units to the new units. If the units are not in the same set of units then the value cannot be converted, and None will be returned.

Parameters
  • value – Value provided in the units (init_units)

  • init_units – initial units of the value (must match final units type)

  • final_units – final units of the value (must match initial units type)

Returns

The value converted to the final units. If the units did not match None is returned

Raises

TypeError – when the two types do not match, or when any of the parameters are None

nautical.units.conversion.convert_distance(value, init_units, final_units)[source]

Convert the distance value from the initial units to the final units

Parameters
  • value – initial value for distance

  • init_units – initial units for distance

  • final_units – desired distance units

Returns

value converted from the initial units to the final units

nautical.units.conversion.convert_pressure(value, init_units, final_units)[source]

Convert the pressure value from the initial units to the final units

Parameters
  • value – initial value for pressure

  • init_units – initial units for pressure

  • final_units – desired pressure units

Returns

value converted from the initial units to the final units

nautical.units.conversion.convert_speed(value, init_units, final_units)[source]

Convert the speed value from the initial units to the final units

Parameters
  • value – initial value for speed

  • init_units – initial units for speed

  • final_units – desired speed units

Returns

value converted from the initial units to the final units

nautical.units.conversion.convert_temperature(value, init_units, final_units)[source]

Convert the temperature value from the initial units to the final units

Parameters
  • value – initial value for temperature

  • init_units – initial units for temperature

  • final_units – desired temperature units

Returns

value converted from the initial units to the final units

nautical.units.conversion.convert_time(value, init_units, final_units)[source]

Convert the time value from the initial units to the final units

Parameters
  • value – initial value for time

  • init_units – initial units for time

  • final_units – desired time units

Returns

value converted from the initial units to the final units

Raises

KeyError

nautical.units.units module

class nautical.units.units.DistanceUnits(value)[source]

Bases: Enum

Various units of distance to provide to the user in the event that they do not wish to use the base units from NOAA

CENTIMETERS = 1
FEET = 2
KILOMETERS = 5
METERS = 4
MILES = 6
NAUTICAL_MILES = 7
YARDS = 3
class nautical.units.units.PressureUnits(value)[source]

Bases: Enum

Various units of pressure to provide to the user in the event that they do not wish to use the base units from NOAA

AT = 5
ATM = 4
BA = 6
BARR = 3
HG = 8
PA = 1
PSI = 7
TORR = 2
class nautical.units.units.SalinityUnits(value)[source]

Bases: Enum

Units of salinity

PSU = 1
class nautical.units.units.SpeedUnits(value)[source]

Bases: Enum

Various units of speed to provide to the user in the event that they do not wish to use the base units from NOAA

FPS = 5
KNOTS = 1
KPH = 4
MPH = 3
MPS = 2
class nautical.units.units.TemperatureUnits(value)[source]

Bases: Enum

Various units of temperature to provide to the user in the event that they do not wish to use the base units from NOAA

DEG_C = 2
DEG_F = 1
class nautical.units.units.TimeUnits(value)[source]

Bases: Enum

Various units of time to provide to the user in the event that they do not wish to use the base units from NOAA

DAYS = 4
HOURS = 3
MINUTES = 2
SECONDS = 1

Module contents

class nautical.units.DistanceUnits(value)[source]

Bases: Enum

Various units of distance to provide to the user in the event that they do not wish to use the base units from NOAA

CENTIMETERS = 1
FEET = 2
KILOMETERS = 5
METERS = 4
MILES = 6
NAUTICAL_MILES = 7
YARDS = 3
class nautical.units.PressureUnits(value)[source]

Bases: Enum

Various units of pressure to provide to the user in the event that they do not wish to use the base units from NOAA

AT = 5
ATM = 4
BA = 6
BARR = 3
HG = 8
PA = 1
PSI = 7
TORR = 2
class nautical.units.SalinityUnits(value)[source]

Bases: Enum

Units of salinity

PSU = 1
class nautical.units.SpeedUnits(value)[source]

Bases: Enum

Various units of speed to provide to the user in the event that they do not wish to use the base units from NOAA

FPS = 5
KNOTS = 1
KPH = 4
MPH = 3
MPS = 2
class nautical.units.TemperatureUnits(value)[source]

Bases: Enum

Various units of temperature to provide to the user in the event that they do not wish to use the base units from NOAA

DEG_C = 2
DEG_F = 1
class nautical.units.TimeUnits(value)[source]

Bases: Enum

Various units of time to provide to the user in the event that they do not wish to use the base units from NOAA

DAYS = 4
HOURS = 3
MINUTES = 2
SECONDS = 1
nautical.units.convert(value, init_units, final_units)[source]

Convert the value given the current units to the new units. If the units are not in the same set of units then the value cannot be converted, and None will be returned.

Parameters
  • value – Value provided in the units (init_units)

  • init_units – initial units of the value (must match final units type)

  • final_units – final units of the value (must match initial units type)

Returns

The value converted to the final units. If the units did not match None is returned

Raises

TypeError – when the two types do not match, or when any of the parameters are None

nautical.units.convert_distance(value, init_units, final_units)[source]

Convert the distance value from the initial units to the final units

Parameters
  • value – initial value for distance

  • init_units – initial units for distance

  • final_units – desired distance units

Returns

value converted from the initial units to the final units

nautical.units.convert_pressure(value, init_units, final_units)[source]

Convert the pressure value from the initial units to the final units

Parameters
  • value – initial value for pressure

  • init_units – initial units for pressure

  • final_units – desired pressure units

Returns

value converted from the initial units to the final units

nautical.units.convert_speed(value, init_units, final_units)[source]

Convert the speed value from the initial units to the final units

Parameters
  • value – initial value for speed

  • init_units – initial units for speed

  • final_units – desired speed units

Returns

value converted from the initial units to the final units

nautical.units.convert_temperature(value, init_units, final_units)[source]

Convert the temperature value from the initial units to the final units

Parameters
  • value – initial value for temperature

  • init_units – initial units for temperature

  • final_units – desired temperature units

Returns

value converted from the initial units to the final units

nautical.units.convert_time(value, init_units, final_units)[source]

Convert the time value from the initial units to the final units

Parameters
  • value – initial value for time

  • init_units – initial units for time

  • final_units – desired time units

Returns

value converted from the initial units to the final units

Raises

KeyError