API Reference
AstroAngles.deg2dms — Methoddeg2dms(angle)Convert degrees to (degrees, arcminutes, arcseconds) tuple
AstroAngles.deg2ha — Methoddeg2ha(angle)Convert degrees to hour angles
AstroAngles.deg2hms — Methoddeg2hms(angle)Convert degrees to (hours, minutes, seconds) tuple
AstroAngles.dms2deg — Methoddms2deg(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.dms2ha — Methoddms2ha(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.dms2rad — Methoddms2rad(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_angle — Methodformat_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 Format.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
AstroAngles.ha2deg — Methodha2deg(angle)Convert hour angles to degrees
AstroAngles.ha2dms — Methodha2dms(angle)Convert hour angles to (degrees, arcminutes, arcseconds) tuple
AstroAngles.ha2hms — Methodha2hms(angle)Convert hour angles to (hours, minutes, seconds) tuple
AstroAngles.ha2rad — Methodha2rad(angle)Convert hour angles to radians
AstroAngles.hms2deg — Methodhms2deg(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.hms2ha — Methodhms2ha(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.hms2rad — Methodhms2rad(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_dms — Methodparse_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_hms — Methodparse_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.rad2dms — Methodrad2dms(angle)Convert radians to (degrees, arcminutes, arcseconds) tuple
AstroAngles.rad2ha — Methodrad2ha(angle)Convert radians to hour angles
AstroAngles.rad2hms — Methodrad2hms(angle)Convert radians to (hours, minutes, seconds) tuple
AstroAngles.@dms_str — Macro@dms_strParse 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-> degreesdms"..."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.8193574074074074See also
AstroAngles.@hms_str — Macro@hms_strParse 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-> degreeshms"..."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.29036111111111See also