Astrononomical geometry functions

Some generally helpful astronomical geometry functions for base QC.

marine_qc.astronomical_geometry.azimuth_elevation(lat, declination, hour_angle)[source]

Get both azimuth and geometric elevation of sun.

Parameters:
  • lat (float) – Latitude value in degrees.

  • declination (float) – Declination.

  • hour_angle (float) – Hour angle.

Return type:

tuple[float, float]

Returns:

tuple of float – A tuple of two floats representing azimuth and geometric elevation of sun.

marine_qc.astronomical_geometry.calculate_azimuth(declination, hour_angle, elevation, phi)[source]

Calculate azimuth.

Parameters:
  • declination (float) – Declination.

  • hour_angle (float) – Hour angle.

  • elevation (float) – Elevation.

  • phi (float) – Latitude value in rad.

Return type:

float

Returns:

float – Azimuth.

marine_qc.astronomical_geometry.calculate_sun_parameters(time)[source]

Calculate both right ascension and declination of sun.

Parameters:

time (float) – Time value.

Return type:

tuple[float, float]

Returns:

tuple of float – A tuple of two floats representing right ascension and declination of sun.

marine_qc.astronomical_geometry.convert_degrees(deg)[source]

Convert degrees.

Parameters:

deg (float) – Value in degrees.

Return type:

float

Returns:

float – Degree (from 0 to 360).

marine_qc.astronomical_geometry.elliptic_angle(time)[source]

Get angle plane of elliptic to plane of celestial equator.

Parameters:

time (float) – Time value.

Return type:

float

Returns:

float – Angle plane of elliptic to plane of celestial equator.

marine_qc.astronomical_geometry.mean_earth_anomaly(time, theta)[source]

Calculate mean anomaly of earth (g).

Parameters:
  • time (float) – Time value.

  • theta (float) – Position of the sun.

Return type:

float

Returns:

float – Mean anomaly of the earth (g).

marine_qc.astronomical_geometry.sin_of_elevation(phi, declination, hour_angle)[source]

Get sinus of geometric elevation.

Parameters:
  • phi (float) – Latitude value in rad.

  • declination (float) – Declination.

  • hour_angle (float) – Hour angle.

Return type:

float

Returns:

float – Sinus of geometric elevation.

marine_qc.astronomical_geometry.sun_ascension(long_of_sun, sin_long_of_sun, angle_of_elliptic)[source]

Calculate right ascension.

Parameters:
  • long_of_sun (float) – Longitude of the sun.

  • sin_long_of_sun (float) – Sinus of the longitude of the sun.

  • angle_of_elliptic (float) – Angle of elliptic.

Return type:

float

Returns:

float – Right ascension.

marine_qc.astronomical_geometry.sun_azimuth(phi, declination)[source]

Get azimuth.

Parameters:
  • phi (float) – Latitude value in rad.

  • declination (float) – Declination.

Return type:

float

Returns:

float – Azimuth.

marine_qc.astronomical_geometry.sun_declination(sin_long_of_sun, angle_of_elliptic)[source]

Calculate declination of sun.

Parameters:
  • sin_long_of_sun (float) – Sinus of the longitude of the sun.

  • angle_of_elliptic (float) – Angle of elliptic.

Return type:

float

Returns:

float – Declination of sun.

marine_qc.astronomical_geometry.sun_hour_angle(local_siderial_time, right_ascension)[source]

Get hour angle.

Parameters:
  • local_siderial_time (float) – Local siderial time value.

  • right_ascension (float) – Right ascension.

Return type:

float

Returns:

float – Hour angle.

marine_qc.astronomical_geometry.sun_longitude(time)[source]

Get longitude of sun.

Parameters:

time (float) – Time value.

Return type:

float

Returns:

float – Longitude of the sun.

marine_qc.astronomical_geometry.sun_position(time)[source]

Find position of sun in celestial sphere, assuming circular orbit (radians).

Parameters:

time (float) – Time value.

Return type:

float

Returns:

float – Position of the sun.

marine_qc.astronomical_geometry.sunangle(year, day, hour, minute, sec, zone, dasvtm, lat, lon)[source]

Calculate the local azimuth and elevation of the sun at a specified location and time.

Parameters:
  • year (int) – Year.

  • day (int) – Day number of year starting with 1 for Jan 1st and running up to 365/6.

  • hour (int) – Hour.

  • minute (int) – Minute.

  • sec (int) – Second.

  • zone (int) – The local international time zone, counted westward from Greenwich.

  • dasvtm (int) – 1 if daylight saving time is in effect, otherwise 0.

  • lat (float) – Latitude in degrees, north is positive.

  • lon (float) – Longitude in degrees, east is positive.

Return type:

tuple[float, float, float, float, float, float]

Returns:

tuple of float – A tuple of six floats representing Azimuth angle of the sun (degrees east of north), Elevation of sun (degrees), Right ascension of sun (degrees), Hour angle of sun (degrees), Hour angle of local siderial time (degrees) and Declination of sun (degrees).

Notes

Copied from Rob Hackett’s area 28 Apr 1998 by J.Arnott. Add protection for ASIN near +/- 90 degrees 07 Jan 2002 by J.Arnott. Pythonised 25/09/2015 by J.J. Kennedy

The Python version gets within a fraction of a degree of the original Fortran code from which it was ported for a range of values. The differences are larger if single precision values are used suggesting that this is not the most numerically robust scheme.

marine_qc.astronomical_geometry.to_local_siderial_time(time, time_in_hours, delyear, lon)[source]

Convert to local siderial time.

Parameters:
  • time (float) – Time value.

  • time_in_hours (float) – Time value in hours.

  • delyear (int) – Relative year number.

  • lon (float) – Longitude value in degrees.

Return type:

float

Returns:

float – Local siderial time.

marine_qc.astronomical_geometry.to_siderial_time(time, delyear)[source]

Convert to siderial time.

Parameters:
  • time (float) – Time value.

  • delyear (int) – Relative year number.

Return type:

float

Returns:

float – Siderial time.