AstroAngles.deg2dmsMethod
deg2dms(angle)

Convert degrees to (degrees, arcminutes, arcseconds) tuple

AstroAngles.dms2degMethod
dms2deg(degrees, arcmin, arcsec)
dms2deg(parts)
dms2deg(input::AbstractString)

Convert (degrees, arcminutes, arcseconds) tuple to degrees. If a string is given, will parse with parse_dms first. If an angle is input will treat as a no-op.

AstroAngles.dms2haMethod
dms2ha(degrees, arcmin, arcsec)
dms2ha(parts)
dms2ha(input::AbstractString)

Convert (degrees, arcminutes, arcseconds) tuple to hour angles. If a string is given, will parse with parse_dms first. If an angle is input will treat as a no-op.

AstroAngles.dms2radMethod
dms2rad(degrees, arcmin, arcsec)
dms2rad(parts)
dms2rad(input::AbstractString)

Convert (degrees, arcminutes, arcseconds) tuple to radians. If a string is given, will parse with parse_dms first. If an angle is input will treat as a no-op.

AstroAngles.format_angleMethod
format_angle(parts; delim=':')

Given the (whole, minutes, seconds) parts of an angle, will format into a string with the given delimiter(s). These parts can be generated by the xxx2dms and xxx2hms methods, for sexagesimal and hour:minute:second outputs. Multiple delimiters can be given in a tuple or vector placed after their respective values. For more control over formatting, consider using Printf or a package like Formatting.jl.

Examples

julia> ang = 45.0; # degrees

julia> format_angle(deg2dms(ang))
"45:0:0.0"

julia> format_angle(deg2hms(ang))
"3:0:0.0"

julia> format_angle(rad2hms(1.5), delim=["h", "m", "s"])
"5h43m46.48062470963538s"

See also

deg2dms, deg2hms, rad2dms, rad2hms, ha2dms, ha2hms

AstroAngles.ha2dmsMethod
ha2dms(angle)

Convert hour angles to (degrees, arcminutes, arcseconds) tuple

AstroAngles.ha2hmsMethod
ha2hms(angle)

Convert hour angles to (hours, minutes, seconds) tuple

AstroAngles.hms2degMethod
hms2deg(hours, mins, secs)
hms2deg(parts)
hms2deg(input::AbstractString)

Convert (hours, minutes, seconds) tuple to degrees. If a string is given, will parse with parse_hms first. If an angle is input will treat as a no-op.

AstroAngles.hms2haMethod
hms2ha(hours, mins, secs)
hms2ha(parts)
hms2ha(input::AbstractString)

Convert (hours, minutes, seconds) tuple to hour angles. If a string is given, will parse with parse_hms first. If an angle is input will treat as a no-op.

AstroAngles.hms2radMethod
hms2rad(hours, mins, secs)
hms2rad(parts)
hms2rad(input::AbstractString)

Convert (hours, minutes, seconds) tuple to radians. If a string is given, will parse with parse_hms first. If an angle is input will treat as a no-op.

AstroAngles.parse_dmsMethod
parse_dms(input)

Parses a string input in "deg:arcmin:arcsec" format to the tuple (degrees, arcminutes, arcseconds). The following delimiters will all work and can be mixed together (the last delimiter is optional):

"[+-]xx[°d: ]xx['′m: ]xx[\"″s][NESW]"

if the direction is provided, "S" and "E" are considered negative (and "-1:0:0S" is 1 degree North)

AstroAngles.parse_hmsMethod
parse_hms(input)

Parses a string input in "ha:min:sec" format to the tuple (hours, minutes, seconds). The following delimiters will all work and can be mixed together (the last delimiter is optional):

"[+-]xx[h ]xx['′m: ]xx[\"″s][EW]"

if the direction is provided, "S" and "E" are considered negative (and "-1:0:0W" is 1 degree East)

AstroAngles.rad2dmsMethod
rad2dms(angle)

Convert radians to (degrees, arcminutes, arcseconds) tuple

AstroAngles.@dms_strMacro
@dms_str

Parse a string in "deg:arcmin:arcsec" format directly to an angle. By default, it will be parsed as radians, but the angle can be chosen by adding a flag to the end of the string

  • dms"..."rad -> radians (default)
  • dms"..."deg -> degrees
  • dms"..."ha -> hour angles

Examples

julia> dms"12:17:25.3"
0.21450726764795752

julia> dms"12:17:25.3"rad # default
0.21450726764795752

julia> dms"12:17:25.3"deg
12.29036111111111

julia> dms"12:17:25.3"ha
0.8193574074074074

See also

parse_dms

AstroAngles.@hms_strMacro
@hms_str

Parse a string in "ha:min:sec" format directly to an angle. By default, it will be parsed as radians, but the angle can be chosen by adding a flag to the end of the string

  • hms"..."rad -> radians (default)
  • hms"..."deg -> degrees
  • hms"..."ha -> hour angles

Examples

julia> hms"12:17:25.3"
3.2176090147193626

julia> hms"12:17:25.3"rad # default
3.2176090147193626

julia> hms"12:17:25.3"deg
184.35541666666666

julia> hms"12:17:25.3"ha
12.29036111111111

See also

parse_hms