pipeline.domain.measures.Latitude

class Latitude(value: int | float | Decimal = 0, units: dict = {'html': '°', 'name': 'DEGREE', 'symbol': 'd', 'units per circle': Decimal('360')})[source]

Bases: EquatorialArc

Methods

convert_to

Converts this arc to the new units.

isNorthOf

Returns True if this latitude is north of other.

isNorthOfEquator

Returns True if this latitude is north of the equator.

isSouthOf

Returns True if this latitude is south of other.

isSouthOfEquator

Returns True if this latitude is south of the equator.

parse

Returns a new Latitude based on the given text.

toDms

Returns a representation of this arc in degrees, minutes, and seconds.

toHms

Returns a representation of this arc in hours, minutes, and seconds.

to_units

Returns the magnitude of this arc in otherUnits.

Attributes

value

units

patt

__init__(value: int | float | Decimal = 0, units: dict = {'html': '°', 'name': 'DEGREE', 'symbol': 'd', 'units per circle': Decimal('360')}) None[source]

Creates a new latitude with the given magnitude and units.

If no magnitude or units are give, a latitude of 0 degrees will be created.

If magnitude is not a valid value for latitude, it will be normalised in a way that will transform it to a legal value. To be legal, magnitude must be greater than or equal to the negative of one-quarter of a circle and less than or equal to one-quarter of a circle, in the given units.

Parameters:
  • value -- The magnitude for this latitude.

  • units -- The units for this latitude.

convert_to(newUnits: dict = {'html': '°', 'name': 'DEGREE', 'symbol': 'd', 'units per circle': Decimal('360')}) EquatorialArc

Converts this arc to the new units.

After this method is complete this arc will have units of units and its value will have been converted accordingly.

Parameters:

newUnits -- The new units for this arc. Default: degrees.

Returns:

This arc. The reason for this return type is to allow code of this nature:

radians = myArc.convert_to(ArcUnits.RADIAN).value;

isNorthOf(other: Latitude) bool[source]

Returns True if this latitude is north of other.

Parameters:

other -- The latitude to be tested.

Returns:

True if this latitude is north of other.

isNorthOfEquator() bool[source]

Returns True if this latitude is north of the equator.

Returns:

True if this latitude is north of the equator.

isSouthOf(other: Latitude) bool[source]

Returns True if this latitude is south of other.

Parameters:

other -- The latitude to be tested.

Returns:

True if this latitude is south of other.

isSouthOfEquator() bool[source]

Returns True if this latitude is south of the equator.

Returns:

True if this latitude is south of the equator.

static parse(value: str) Latitude[source]

Returns a new Latitude based on the given text.

See the parse method of Angle for information on the format of text. This Latitude class offers two other formats:

dd:mm:ss.sss dd mm ss.sss

Both of the above are in degrees, arc-minutes, and arc-seconds. For the first alternative form, whitespace is permitted around the colon characters. For the second alternative form, any type and number of whitespace characters may be used in between the three parts.

The parsed value, if not a legal value for latitude, will be normalised in such a way that it is transformed to a legal value. To be legal, magnitude must be greater than or equal to the negative of one-quarter of a circle and less than or equal to one-quarter of a circle, in the given units.

Parameters:

value -- A string that will be converted into a latitude.

Returns:

A new Latitude. If parsing was successful, the value of the latitude will be based on the parameter string. If it was not, the returned latitude will be of zero degrees.

Raises:

ValueError - if text is not in the expected form. --

toDms() tuple[int, int, float]

Returns a representation of this arc in degrees, minutes, and seconds.

Returns:

An integer holding the number of degrees. An integer holding the number of arc minutes. A float holding the number of arc seconds.

Return type:

a tuple of size three in this order

toHms() tuple[int, int, float]

Returns a representation of this arc in hours, minutes, and seconds.

Returns:

An integer holding the number of hours. An integer holding the number of minutes. A float holding the number of seconds.

Return type:

a tuple of size three in this order

to_units(otherUnits: dict = {'html': '°', 'name': 'DEGREE', 'symbol': 'd', 'units per circle': Decimal('360')}) Decimal

Returns the magnitude of this arc in otherUnits.

Note that this method does not alter the state of this arc. Contrast this with convert_to(ArcUnits).

Parameters:

otherUnits -- The units in which to express this arc's magnitude (default: degrees)

Returns:

This arc's value converted to otherUnits.