Loading...
Searching...
No Matches
supernovas::Unit Class Reference
Helpers and utilities

Various physical units for converting quantities expressed in conventional units to SI, and vice versa. More...

`#include <supernovas.h>`

## Static Public Attributes

static constexpr double | angstrom = 1e-10
| [m] 1 Angstrom in meters
static constexpr double | arcmin = deg / 60.0
| [rad] 1 minute of arc in radians
static constexpr double | arcsec = NOVAS_ARCSEC
| [rad] 1 second or arc in radians
static constexpr double | atm = 101325.0
| [Pa] 1 atmosphere in pascals
static constexpr double | AU = NOVAS_AU
| [m] 1 Astronomical Unit in meters.
static constexpr double | au = AU
| [m] 1 AU (lower-case)
static constexpr double | AU_per_day = AU / day
| [m/s] 1 AU per day in m/s
static constexpr double | bar = 1000.0 * mbar
| [Pa] 1 bar in pascals
static constexpr double | besselian_year = NOVAS_BESSELIAN_YEAR_DAYS * day
| [s] 1 Besselian year in seconds
static constexpr double | cm = 0.01
| [m] 1 centimeter in meters
static constexpr double | cy = 100.0 * yr
| [s] 1 tropical calendar century in seconds (at J2000)
static constexpr double | day = NOVAS_DAY
| [s] 1 day in seconds
static constexpr double | deg = NOVAS_DEGREE
| [rad] 1 degree in radians
static constexpr double | Gpc = 1e9 * pc
| [m] 1 gigaparsec in meters
static constexpr double | hour = 3600.0
| [s] 1 hour in seconds
static constexpr double | hour_angle = NOVAS_HOURANGLE
| [rad] 1 hour of angle in radians on the 24h circle.
static constexpr double | hPa = 100.0
| [Pa] 1 hectopascal in pascals
static constexpr double | julian_century = 100.0 * julian_year
| [s] 1 Julian century in seconds
static constexpr double | julian_year = NOVAS_JULIAN_YEAR_DAYS * day
| [s] 1 Julian year in seconds
static constexpr double | km = NOVAS_KM
| [m] 1 kilometer in meters
static constexpr double | km_per_s = km / s
| [m/s] 1 kilometer per second in m/s
static constexpr double | kPa = 1000.0
| [Pa] 1 kilopascal in pascals
static constexpr double | kpc = 1000.0 * pc
| [m] 1 kiloparsec in meters
static constexpr double | lyr = NOVAS_LIGHT_YEAR
| [m] 1 light-year in meters
static constexpr double | m = 1.0
| [m] 1 meter (standard unit of distance)
static constexpr double | m_per_s = m / s
| [m/s] 1 meter per second
static constexpr double | mas = 1e-3 * arcsec
| [rad] 1 millisecond of arc in radians
static constexpr double | mbar = hPa
| [Pa] 1 millibar in pascals
static constexpr double | micron = um
| [m] 1 micron (=micrometer) in meters, by another name.
static constexpr double | min = 60.0
| [s] 1 minute in seconds
static constexpr double | mm = 1e-3
| [m] 1 millimeter in meters
static constexpr double | MPa = 1e6
| [Pa] 1 megapascal in pascals
static constexpr double | Mpc = 1e6 * pc
| [m] 1 megaparsec in meters
static constexpr double | ms = 1e-3
| [s] 1 millisecond in seconds
static constexpr double | nm = 1e-9
| [m] 1 nanometer in meters
static constexpr double | ns = 1e-9
| [s] 1 nanosecond in seconds
static constexpr double | Pa = 1.0
| [Pa] 1 pascal (standard unit of pressure)
static constexpr double | pc = NOVAS_PARSEC
| [m] 1 parsec in meters
static constexpr double | percent = 0.01
| [u] 1 percent as a fraction.
static constexpr double | ps = 1e-12
| [s] 1 picosecond in seconds
static constexpr double | rad = 1.0
| [rad] 1 radian (standard unit of angle)
static constexpr double | s = 1.0
| [s] 1 second (standard unit of time)
static constexpr double | sec = s
| [s] 1 second by another name
static constexpr double | torr = 133.3223684211
| [Pa] 1 torr (mm of Hg) in pascals
static constexpr double | uas = 1e-6 * arcsec
| [rad] 1 microsecond of arc in radians
static constexpr double | um = 1e-6
| [m] 1 micrometer (=micron) in meters
static constexpr double | us = 1e-6
| [s] 1 microsecond in seconds
static constexpr double | week = 7 * day
| [s] 1 week in seconds
static constexpr double | yr = NOVAS_TROPICAL_YEAR_DAYS * day
| [s] 1 tropical calendar year in seconds (at J2000)

## Detailed Description

Various physical units for converting quantities expressed in conventional units to SI, and vice versa.

The SuperNOVAS C++ API uses SI quantities consistently for inputs, so these units can be useful for converting quantities in other units to SI, or to convert return values from SI to conventional units.

For example, if you have distance in AU, then you can use Unit::AU to convert it to an SI distance (i.e. meters) as:

// Standard S.I. distance, defined in astronomical units (AUs)
double d = 2.4103 * Unit::AU;
supernovas::Unit::AU
static constexpr double AU
[m] 1 Astronomical Unit in meters.
Definition supernovas.h:126

Conversely, you can cast a quantity in S.I. units to S.I. units as:

// standard S.I. distance cast into units of 'km'.
double d_km = d / Unit::km;
supernovas::Unit::km
static constexpr double km
[m] 1 kilometer in meters
Definition supernovas.h:135

Note, this class cannot be instantiated or copied. You should only use its static fields.

Since
  1.6

See also
  Constant

## Member Data Documentation

## angstrom

double supernovas::Unit::angstrom = 1e-10

static constexpr

[m] 1 Angstrom in meters

## arcmin

double supernovas::Unit::arcmin = deg / 60.0

static constexpr

[rad] 1 minute of arc in radians

Referenced by supernovas::Angle::arcmin().

## arcsec

double supernovas::Unit::arcsec = NOVAS_ARCSEC

static constexpr

[rad] 1 second or arc in radians

Referenced by supernovas::Angle::arcsec(), supernovas::GeodeticObserver::eop_at(), supernovas::EOP::fetch_for_jd(), supernovas::EOP::itrf_transformed(), and supernovas::Coordinate::parallax().

## atm

double supernovas::Unit::atm = 101325.0

static constexpr

[Pa] 1 atmosphere in pascals

Referenced by supernovas::Pressure::atm(), supernovas::Pressure::atm(), and supernovas::Weather::standard().

## AU

double supernovas::Unit::AU = NOVAS_AU

static constexpr

[m] 1 Astronomical Unit in meters.

Referenced by supernovas::Observer::Observer(), supernovas::Planet::approx_geometric_in(), supernovas::SolarSystemSource::barycentric_at(), supernovas::GeodeticObserver::gcrs_position_at(), supernovas::Observer::gcrs_position_at(), supernovas::Observer::gcrs_velocity_at(), supernovas::Frame::geometric_moon_elp2000(), supernovas::Frame::observer_ssb_position(), supernovas::AstrometricPosition::to_interferometric(), and supernovas::Observer::to_interferometric().

## au

double supernovas::Unit::au = AU

static constexpr

[m] 1 AU (lower-case)

Referenced by supernovas::Orbital::Orbital(), supernovas::SolarSystemObserver::SolarSystemObserver(), supernovas::Apparent::astrometric_position(), supernovas::Coordinate::au(), supernovas::ScalarVelocity::au_per_day(), supernovas::Apparent::distance(), supernovas::Source::geometric_in(), supernovas::SolarSystemSource::helio_distance(), supernovas::Orbital::position(), supernovas::Orbital::semi_major_axis(), supernovas::SolarSystemObserver::ssb_position(), supernovas::Horizontal::to_apparent(), supernovas::Coordinate::to_string(), and supernovas::Apparent::xyz().

## AU_per_day

double supernovas::Unit::AU_per_day = AU / day

static constexpr

[m/s] 1 AU per day in m/s

Referenced by supernovas::Observer::Observer(), supernovas::Planet::approx_geometric_in(), supernovas::SolarSystemSource::barycentric_at(), supernovas::GeodeticObserver::gcrs_velocity_at(), supernovas::Source::geometric_in(), supernovas::Frame::geometric_moon_elp2000(), supernovas::SolarSystemSource::helio_rate(), supernovas::Frame::observer_ssb_velocity(), supernovas::SolarSystemObserver::ssb_velocity(), supernovas::Horizontal::to_apparent(), and supernovas::Orbital::velocity().

## bar

double supernovas::Unit::bar = 1000.0 * mbar

static constexpr

[Pa] 1 bar in pascals

Referenced by supernovas::Pressure::bar(), and supernovas::Pressure::bar().

## besselian_year

double supernovas::Unit::besselian_year = NOVAS_BESSELIAN_YEAR_DAYS * day

static constexpr

[s] 1 Besselian year in seconds

Referenced by supernovas::Equinox::mod_at_besselian_epoch().

## cm

double supernovas::Unit::cm = 0.01

static constexpr

[m] 1 centimeter in meters

## cy

double supernovas::Unit::cy = 100.0 * yr

static constexpr

[s] 1 tropical calendar century in seconds (at J2000)

## day

double supernovas::Unit::day = NOVAS_DAY

static constexpr

[s] 1 day in seconds

Referenced by supernovas::Orbital::Orbital(), supernovas::SolarSystemObserver::SolarSystemObserver(), supernovas::Orbital::apsis_period(), supernovas::Orbital::apsis_period(), supernovas::ScalarVelocity::au_per_day(), supernovas::Calendar::date(), supernovas::Interval::days(), supernovas::CalendarDate::equals(), supernovas::Equinox::equals(), supernovas::Equinox::from_string(), supernovas::Orbital::mean_motion(), supernovas::Equinox::mod_at_besselian_epoch(), supernovas::Orbital::node_period(), supernovas::Orbital::node_period(), supernovas::CalendarDate::operator-(), supernovas::CalendarDate::operator<=(), supernovas::CalendarDate::operator>=(), supernovas::Time::shifted(), supernovas::AstrometricPosition::to_interferometric(), supernovas::Observer::to_interferometric(), supernovas::Interval::to_string(), and supernovas::CalendarDate::unix_time().

## deg

double supernovas::Unit::deg = NOVAS_DEGREE

static constexpr

[rad] 1 degree in radians

Referenced by supernovas::Orbital::Orbital(), supernovas::Site::Site(), supernovas::Source::angle_to(), supernovas::Orbital::ascending_node(), supernovas::Apparent::cirs(), supernovas::CatalogEntry::dec(), supernovas::Angle::deg(), supernovas::Spherical::distance_to(), supernovas::Orbital::eccentricity(), supernovas::Apparent::equatorial(), supernovas::Time::era(), supernovas::Orbital::inclination(), supernovas::Orbital::inclination(), supernovas::Site::itrf_transformed(), supernovas::Site::latitude(), supernovas::Site::longitude(), supernovas::Orbital::mean_motion(), supernovas::Source::moon_angle(), supernovas::Time::moon_phase(), supernovas::Ecliptic::offset(), supernovas::Equatorial::offset(), supernovas::Galactic::offset(), supernovas::Horizontal::offset(), supernovas::Orbital::periapsis(), supernovas::Orbital::pole(), supernovas::Orbital::reference_mean_anomaly(), supernovas::GeodeticObserver::site(), supernovas::Source::sun_angle(), supernovas::Equatorial::to_ecliptic(), supernovas::AstrometricPosition::to_equatorial(), supernovas::Ecliptic::to_equatorial(), supernovas::Galactic::to_equatorial(), supernovas::Equatorial::to_galactic(), supernovas::Apparent::to_horizontal(), supernovas::Horizontal::to_refracted(), supernovas::CatalogSource::to_string(), supernovas::OrbitalSystem::to_string(), supernovas::Site::to_string(), supernovas::Equatorial::to_system(), and supernovas::Horizontal::to_unrefracted().

## Gpc

double supernovas::Unit::Gpc = 1e9 * pc

static constexpr

[m] 1 gigaparsec in meters

Referenced by supernovas::Coordinate::at_Gpc(), and supernovas::Coordinate::Gpc().

## hour

double supernovas::Unit::hour = 3600.0

static constexpr

[s] 1 hour in seconds

Referenced by supernovas::CalendarDate::CalendarDate(), supernovas::Source::copy(), supernovas::Interval::hours(), and supernovas::Interval::to_string().

## hour_angle

double supernovas::Unit::hour_angle = NOVAS_HOURANGLE

static constexpr

[rad] 1 hour of angle in radians on the 24h circle.

Referenced by supernovas::Apparent::cirs(), supernovas::Apparent::equatorial(), supernovas::Time::gmst(), supernovas::Time::gst(), supernovas::TimeAngle::hours(), supernovas::TimeAngle::hours(), supernovas::Time::lst(), supernovas::TimeAngle::minutes(), supernovas::TimeAngle::noon(), supernovas::TimeAngle::operator+(), supernovas::TimeAngle::operator-(), supernovas::CatalogEntry::ra(), supernovas::TimeAngle::seconds(), supernovas::AstrometricPosition::to_equatorial(), supernovas::Ecliptic::to_equatorial(), supernovas::Galactic::to_equatorial(), supernovas::CatalogSource::to_string(), and supernovas::Equatorial::to_system().

## hPa

double supernovas::Unit::hPa = 100.0

static constexpr

[Pa] 1 hectopascal in pascals

## julian_century

double supernovas::Unit::julian_century = 100.0 * julian_year

static constexpr

[s] 1 Julian century in seconds

Referenced by supernovas::Interval::julian_centuries().

## julian_year

double supernovas::Unit::julian_year = NOVAS_JULIAN_YEAR_DAYS * day

static constexpr

[s] 1 Julian year in seconds

Referenced by supernovas::Interval::julian_years().

## km

double supernovas::Unit::km = NOVAS_KM

static constexpr

[m] 1 kilometer in meters

Referenced by supernovas::GeodeticObserver::GeodeticObserver(), supernovas::Observer::Observer(), and supernovas::GeocentricObserver::gcrs_position().

## km_per_s

double supernovas::Unit::km_per_s = km / s

static constexpr

[m/s] 1 kilometer per second in m/s

Referenced by supernovas::Observer::Observer(), supernovas::GeodeticObserver::enu_velocity(), supernovas::ScalarVelocity::from_redshift(), supernovas::GeocentricObserver::gcrs_velocity(), supernovas::GeodeticObserver::itrs_velocity(), supernovas::Apparent::radial_velocity(), supernovas::CatalogEntry::radial_velocity(), supernovas::CatalogEntry::radial_velocity(), supernovas::Track< CoordType >::radial_velocity_at(), supernovas::CatalogEntry::redshift(), supernovas::CatalogEntry::v_lsr(), and supernovas::CatalogEntry::v_lsr().

## kPa

double supernovas::Unit::kPa = 1000.0

static constexpr

[Pa] 1 kilopascal in pascals

## kpc

double supernovas::Unit::kpc = 1000.0 * pc

static constexpr

[m] 1 kiloparsec in meters

Referenced by supernovas::CatalogEntry::distance(), and supernovas::Coordinate::kpc().

## lyr

double supernovas::Unit::lyr = NOVAS_LIGHT_YEAR

static constexpr

[m] 1 light-year in meters

Referenced by supernovas::Coordinate::lyr().

## m

double supernovas::Unit::m = 1.0

static constexpr

[m] 1 meter (standard unit of distance)

Referenced by supernovas::Site::altitude(), and supernovas::Site::itrf_transformed().

## m_per_s

double supernovas::Unit::m_per_s = m / s

static constexpr

[m/s] 1 meter per second

## mas

double supernovas::Unit::mas = 1e-3 * arcsec

static constexpr

[rad] 1 millisecond of arc in radians

Referenced by supernovas::Frame::eop(), supernovas::Angle::mas(), supernovas::CatalogEntry::parallax(), supernovas::CatalogEntry::parallax(), and supernovas::CatalogEntry::proper_motion().

## mbar

double supernovas::Unit::mbar = hPa

static constexpr

[Pa] 1 millibar in pascals

Referenced by supernovas::Site::average_weather(), supernovas::Pressure::mbar(), supernovas::Pressure::mbar(), and supernovas::Pressure::to_string().

## micron

double supernovas::Unit::micron = um

static constexpr

[m] 1 micron (=micrometer) in meters, by another name.

## min

double supernovas::Unit::min = 60.0

static constexpr

[s] 1 minute in seconds

Referenced by supernovas::Source::horizontal_track(), and supernovas::Interval::minutes().

## mm

double supernovas::Unit::mm = 1e-3

static constexpr

[m] 1 millimeter in meters

Referenced by supernovas::Velocity::operator!=(), supernovas::Position::operator==(), and supernovas::Velocity::operator==().

## MPa

double supernovas::Unit::MPa = 1e6

static constexpr

[Pa] 1 megapascal in pascals

## Mpc

double supernovas::Unit::Mpc = 1e6 * pc

static constexpr

[m] 1 megaparsec in meters

Referenced by supernovas::Coordinate::Mpc().

## ms

double supernovas::Unit::ms = 1e-3

static constexpr

[s] 1 millisecond in seconds

Referenced by supernovas::Interval::milliseconds(), supernovas::CalendarDate::operator<=(), supernovas::CalendarDate::operator>=(), and supernovas::Interval::to_string().

## nm

double supernovas::Unit::nm = 1e-9

static constexpr

[m] 1 nanometer in meters

Referenced by supernovas::Interferometric::operator==().

## ns

double supernovas::Unit::ns = 1e-9

static constexpr

[s] 1 nanosecond in seconds

Referenced by supernovas::Calendar::date(), and supernovas::Interval::to_string().

## Pa

double supernovas::Unit::Pa = 1.0

static constexpr

[Pa] 1 pascal (standard unit of pressure)

## pc

double supernovas::Unit::pc = NOVAS_PARSEC

static constexpr

[m] 1 parsec in meters

Referenced by supernovas::CatalogEntry::distance(), supernovas::Coordinate::from_parallax(), supernovas::Coordinate::pc(), and supernovas::Coordinate::to_string().

## percent

double supernovas::Unit::percent = 0.01

static constexpr

[u] 1 percent as a fraction.

Referenced by supernovas::Source::horizontal_track(), supernovas::Weather::standard(), and supernovas::Weather::to_string().

## ps

double supernovas::Unit::ps = 1e-12

static constexpr

[s] 1 picosecond in seconds

## rad

double supernovas::Unit::rad = 1.0

static constexpr

[rad] 1 radian (standard unit of angle)

## s

double supernovas::Unit::s = 1.0

static constexpr

[s] 1 second (standard unit of time)

Referenced by supernovas::GeodeticObserver::GeodeticObserver(), supernovas::Equinox::from_string(), and supernovas::Interval::to_string().

## sec

double supernovas::Unit::sec = s

static constexpr

[s] 1 second by another name

Referenced by supernovas::Velocity::operator!=(), and supernovas::Velocity::operator==().

## torr

double supernovas::Unit::torr = 133.3223684211

static constexpr

[Pa] 1 torr (mm of Hg) in pascals

Referenced by supernovas::Pressure::torr(), and supernovas::Pressure::torr().

## uas

double supernovas::Unit::uas = 1e-6 * arcsec

static constexpr

[rad] 1 microsecond of arc in radians

Referenced by supernovas::EOP::operator==(), and supernovas::Angle::uas().

## um

double supernovas::Unit::um = 1e-6

static constexpr

[m] 1 micrometer (=micron) in meters

## us

double supernovas::Unit::us = 1e-6

static constexpr

[s] 1 microsecond in seconds

Referenced by supernovas::Time::operator-(), supernovas::Time::operator<=(), supernovas::EOP::operator==(), and supernovas::Interval::to_string().

## week

double supernovas::Unit::week = 7 * day

static constexpr

[s] 1 week in seconds

Referenced by supernovas::Interval::weeks().

## yr

double supernovas::Unit::yr = NOVAS_TROPICAL_YEAR_DAYS * day

static constexpr

[s] 1 tropical calendar year in seconds (at J2000)

Referenced by supernovas::CatalogEntry::proper_motion(), supernovas::Interval::to_string(), and supernovas::Interval::years().