API Reference

AstroAngles.deg2dmsMethod
deg2dms(angle)

Convert degrees to (degrees, arcminutes, arcseconds) tuple.

If angle is Missing, returns missing.

source
AstroAngles.deg2hmsMethod
deg2hms(angle)

Convert degrees to (hours, minutes, seconds) tuple.

If angle is Missing, returns missing.

source
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.

If any input is Missing, returns missing.

source
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.

If any input is Missing, returns missing.

source
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.

If any input is Missing, returns missing.

source
AstroAngles.format_angleMethod
format_angle(parts; delim = ':', digits = 2, pad = true, alwayssign = false)
format_angle(whole, minutes, seconds; kwargs...)

Format the (whole, minutes, seconds)parts of an angle into a delimited string. The parts are typically produced by the deg2dms, deg2hms, rad2dms, rad2hms, ha2dms, and ha2hms methods, and may be passed either as a single tuple or as three separate positional arguments. For more control over formatting, consider using Printf or a package like Format.jl.

If any part is missing, returns missing.

Keyword arguments

  • delim: The delimiter(s) placed between the parts. A single Char/String (default ':') is inserted between each part, e.g. "45:00:00.00". A vector or tuple of three delimiters is instead appended after each respective part, e.g., delim = ["h", "m", "s"] gives "05h43m46.48s". Only 1 or 3 delimiters are accepted.
  • digits: The number of digits to round the seconds to (default 2). Pass "all" to keep full precision without rounding.
  • pad: If true (default), zero-pad each part to at least two characters, e.g. "03:00:00.00".
  • alwayssign: If true, prefix non-negative angles with '+' (default false). Negative angles are always prefixed with '-'.

Examples

julia> ang = 45.0; # degrees

julia> format_angle(deg2dms(ang))
"45:00:00.00"

julia> format_angle(deg2hms(ang))
"03:00:00.00"

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

julia> format_angle(rad2hms(1.5), delim=["h", "m", "s"]; digits=5)
"05h43m46.48062s"

julia> format_angle(rad2hms(1.5), delim=["h", "m", "s"]; digits="all")
"05h43m46.48062470963538s"

julia> format_angle(deg2dms(45.0); pad=false)
"45:0:0.0"

julia> format_angle(deg2dms(45.0); alwayssign=true)
"+45:00:00.00"

julia> format_angle(deg2dms(-45.0); alwayssign=true)
"-45:00:00.00"

See also

deg2dms, deg2hms, rad2dms, rad2hms, ha2dms, ha2hms

source
AstroAngles.ha2dmsMethod
ha2dms(angle)

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

If angle is Missing, returns missing.

source
AstroAngles.ha2hmsMethod
ha2hms(angle)

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

If angle is Missing, returns missing.

source
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.

If any input is Missing, returns missing.

source
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.

If any input is Missing, returns missing.

source
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.

If any input is Missing, returns missing.

source
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)

If input is Missing, returns missing.

source
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)

If input is Missing, returns missing.

source
AstroAngles.rad2dmsMethod
rad2dms(angle)

Convert radians to (degrees, arcminutes, arcseconds) tuple.

If angle is Missing, returns missing.

source
AstroAngles.rad2hmsMethod
rad2hms(angle)

Convert radians to (hours, minutes, seconds) tuple.

If angle is Missing, returns missing.

source
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

source
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

source