nsrdb.solar_position.spa.SPA

class SPA(time_index, lat_lon, elev=0)[source]

Bases: object

Solar position algorithm

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest in meters

Methods

aberration_correction(r)

Compute aberration correction

apparent_elevation(time_index, lat_lon[, ...])

Compute the solar elevation after atmospheric refraction correction

apparent_elevation_angle(e0[, pres, temp, ...])

The apparent topocentric elevation angle after refraction

apparent_position(time_index, lat_lon[, ...])

Compute the solar position after atmospheric refraction correction - elevation - zenith

apparent_sidereal_time(v0, delta_psi, e)

Compute apparent sidereal time

apparent_solar_position([pressure, ...])

Compute the apparent (atmospheric refraction corrected) solar position for all locations and times: - elevation (e) - zenith (theta)

apparent_sun_longitude(beta, delta_psi, delta_u)

Compute apparent sun longitude

apparent_zenith(time_index, lat_lon[, elev, ...])

Compute the solar zenith angle after atmospheric refraction correction

atmospheric_refraction_correction(e0[, ...])

Compute the atmospheric refraction correction value for all sites

azimuth(time_index, lat_lon[, elev, delta_t])

Compute the solar elevation

elevation(time_index, lat_lon[, elev, delta_t])

Compute the solar elevation

equation_of_time(jme, alpha, delta_psi, e)

Equation of time

equatorial_horizontal_parallax(r)

Computes equatorial horizonatl parallax

geocentric_latitude(heliocentric_latitude)

Compute geocentric latitude from heliocentric Latitude

geocentric_longitude(heliocentric_longitude)

Compute geocentric longitude from heliocentric longitude

geocentric_sun_position(lamd, e, beta)

Compute geocentric sun position

heliocentric_latitude(jme)

Compute heliocentric latitude

heliocentric_longitude(jme)

Compute heliocentric Longitude

heliocentric_radius_vector(jme)

Compute heliocentric radius

local_hour_angle(v, obs_lon, alpha)

Compute local hour angle measured westward from south

mean_anomaly_moon(jce)

Compute mean moon anomaly

mean_anomaly_sun(jce)

Compute mean sun anomaly

mean_ecliptic_obliquity(jme)

Compute mean ecliptic obliquity

mean_elongation(jce)

Compute mean elongation

mean_sidereal_time(jd, jc)

Compute mean sidereal time

moon_argument_latitude(jce)

Compute moon latitude

moon_ascending_longitude(jce)

Compute moon ascending longitude

nutation_coefficients(jce)

Compute the nutation coefficients: x0 = mean elongation x1 = mean sun anomaly x2 = mean moon anomaly x3 = moon latitude x4 = moon ascending longitude

nutation_position(jce)

Compute nutation longitude for all timesteps

observer_xy(obs_lat, obs_elev)

Compute the observer x and y terms

parallax_sun_right_ascension(obs_x, xi, H, delta)

Computer sun right ascension parallax

position(time_index, lat_lon[, elev, delta_t])

Compute the solar position: - elevation - azimuth - zenith

solar_position([delta_t])

Compute the solar position for all locations and times: - elevation (e0) - azimuth (phi) - zenith (theta0)

sun_mean_longitude(jme)

Compute mean sun longitude for all timesteps

topocentric_local_hour_angle(H, delta_alpha)

Compute topocentric local hour angle

topocentric_solar_position(obs_lat, ...)

Compute the topocentric sun position: elevation and azimuth - without atmospheric correction

topocentric_sun_declination(obs_x, obs_y, ...)

Compute topocentric sun position: right ascention and declination

topocentric_zenith_angle(e)

Topocentric zenith angle

true_ecliptic_obliquity(e0, delta_eps)

Compute true ecliptic obliquity

zenith(time_index, lat_lon[, elev, delta_t])

Compute the solar elevation

Attributes

altitude

elevation above sea-level of site(s)

latitude

Latitudes of site(s)

longitude

longitude of site(s)

time_index

Datetime stamp(s) of interest

property time_index

Datetime stamp(s) of interest

Returns:

time_index (pandas.DatetimeIndex)

property latitude

Latitudes of site(s)

Returns:

lat (ndarray)

property longitude

longitude of site(s)

Returns:

lon (ndarray)

property altitude

elevation above sea-level of site(s)

static heliocentric_longitude(jme)[source]

Compute heliocentric Longitude

Parameters:

jme (ndarray) – Julian ephemeris millennium

Returns:

lon (ndarray) – Heliocentric longitude in degrees

static heliocentric_latitude(jme)[source]

Compute heliocentric latitude

Parameters:

jme (ndarray) – Julian ephemeris millennium

Returns:

b (ndarray) – Heliocentric longitude in degrees

static heliocentric_radius_vector(jme)[source]

Compute heliocentric radius

Parameters:

jme (ndarray) – Julian ephemeris millennium

Returns:

r (ndarray) – Heliocentric radius in radians

static geocentric_longitude(heliocentric_longitude)[source]

Compute geocentric longitude from heliocentric longitude

Parameters:

heliocentric_longitude (ndarray) – heliocentric longitude for each available timestep

Returns:

theta (ndarray) – geocentric longitude for each available timestep

static geocentric_latitude(heliocentric_latitude)[source]

Compute geocentric latitude from heliocentric Latitude

Parameters:

heliocentric_latitude (ndarray) – heliocentric latitude for each available timestep

Returns:

beta (ndarray) – geocentric latitude for each available timestep

static mean_elongation(jce)[source]

Compute mean elongation

Parameters:

jce (ndarray) – Julian ephemeris century for all timesteps

Returns:

x0 (ndarray) – Mean elogation for all timesteps

static mean_anomaly_sun(jce)[source]

Compute mean sun anomaly

Parameters:

jce (ndarray) – Julian ephemeris century for all timesteps

Returns:

x1 (ndarray) – Mean sun anomaly for all timesteps

static mean_anomaly_moon(jce)[source]

Compute mean moon anomaly

Parameters:

jce (ndarray) – Julian ephemeris century for all timesteps

Returns:

x2 (ndarray) – Mean moon anomaly for all timesteps

static moon_argument_latitude(jce)[source]

Compute moon latitude

Parameters:

jce (ndarray) – Julian ephemeris century for all timesteps

Returns:

x3 (ndarray) – Moon latitude for all timesteps

static moon_ascending_longitude(jce)[source]

Compute moon ascending longitude

Parameters:

jce (ndarray) – Julian ephemeris century for all timesteps

Returns:

x4 (ndarray) – Moon ascending longitude for all timesteps

static nutation_coefficients(jce)[source]

Compute the nutation coefficients: x0 = mean elongation x1 = mean sun anomaly x2 = mean moon anomaly x3 = moon latitude x4 = moon ascending longitude

Parameters:

jce (ndarray) – Julian ephemeris century for all timesteps

Returns:

x_arr (ndarray) – Array of nutation coeffiecients [x0, x1, x2, x3, x4]

static nutation_position(jce)[source]

Compute nutation longitude for all timesteps

Parameters:

jce (ndarray) – Julian ephemeris century for all timesteps

Returns:

delta_psi (ndarray) – nutation longitude

static mean_ecliptic_obliquity(jme)[source]

Compute mean ecliptic obliquity

Parameters:

jme (ndarray) – Julian ephemeris millennium for all timesteps

Returns:

e0 (ndarray) – Mean ecliptic obliquity for all timesteps

static true_ecliptic_obliquity(e0, delta_eps)[source]

Compute true ecliptic obliquity

Parameters:
  • e0 (ndarray) – Mean elciptic obliquity

  • delta_eps (ndarray) – Nutation obliquity

Returns:

e (ndarray) – True ecliptic obliquity

static aberration_correction(r)[source]

Compute aberration correction

Parameters:

r (ndarray) – Heliocentric or earth radius vector

Returns:

delta_u (ndarray) – Aberation correction

static apparent_sun_longitude(beta, delta_psi, delta_u)[source]

Compute apparent sun longitude

Parameters:
  • beta (ndarray) – Geocentric latitude

  • delta_psi (ndarray) – Nutation longitude

  • delta_u (ndarray) – Aberration correction

Returns:

lamd (ndarray) – Apparent sun longitude

static mean_sidereal_time(jd, jc)[source]

Compute mean sidereal time

Parameters:
  • jd (ndarray) – Julian day for all timesteps

  • jc (ndarray) – Julian century for all timesteps

  • v0 (ndarray) – Mean sidereal time in degrees

static apparent_sidereal_time(v0, delta_psi, e)[source]

Compute apparent sidereal time

Parameters:
  • v0 (ndarray) – Mean sidreal time

  • delta_psi (ndarray) – Nutation longitude

  • e (ndarray) – True ecliptic obliquity

Returns:

v (ndarray) – Apparent sidereal time degrees

static geocentric_sun_position(lamd, e, beta)[source]

Compute geocentric sun position

Parameters:
  • lamd (ndarray) – Apparent sun longitude

  • e (ndarray) – True ecliptic obliquity

  • beta (ndarray) – Geocentric latitude

Returns:

  • alpha (ndarray) – Geocentric sun right ascension in degrees

  • delta (ndarray) – Geocentric sun delication in degrees

static local_hour_angle(v, obs_lon, alpha)[source]

Compute local hour angle measured westward from south

Parameters:
  • v (ndarray) – Apparent sidreal time

  • obs_lon (ndarray) – Observers longitudes

  • alpha (ndarray) – Sun right ascension

Returns:

H (ndarray) – Local hour angle in degrees from westward from south

static equatorial_horizontal_parallax(r)[source]

Computes equatorial horizonatl parallax

Parameters:

r (ndarray) – heliocentric or earth radius vector

Returns:

xi (ndarray) – Equatorial horizontal parallax

static observer_xy(obs_lat, obs_elev)[source]

Compute the observer x and y terms

Parameters:
  • obs_lat (ndarray) – Observers latitudes

  • obs_elev (ndarray) – Observers elevations (above sealevel in m)

Returns:

  • obs_x (ndarray) – Observers x terms

  • obs_y (ndarray) – Observers y terms

static parallax_sun_right_ascension(obs_x, xi, H, delta)[source]

Computer sun right ascension parallax

Parameters:
  • obs_x (ndarray) – Observers x terms

  • xi (ndarray) – Equatorial horizontal parallax

  • H (ndarray) – Local hour angle

  • delta (ndarray) – Geocentric sun declination

Returns:

delta_alpha (ndarray) – Sun right ascension parallax

static topocentric_sun_declination(obs_x, obs_y, xi, H, delta, delta_alpha)[source]

Compute topocentric sun position: right ascention and declination

Parameters:
  • obs_x (ndarray) – Observers x terms

  • obs_y (ndarray) – Observers y terms

  • xi (ndarray) – Equatorial horizontal parallax

  • H (ndarray) – Local hour angle

  • delta (ndarray) – Geocentric sun declination

  • delta_alpha (ndarray) – Sun right ascensoin parallax

Returns:

delta_prime (ndarray) – Topocentric sun declination angle in degrees

static topocentric_local_hour_angle(H, delta_alpha)[source]

Compute topocentric local hour angle

Parameters:
  • H (ndarray) – Local hour angle

  • delta_alpha (ndarray) – Sun right ascension parallax

Returns:

H_prime (ndarray) – Topocentric local hour angle

static topocentric_solar_position(obs_lat, obs_elev, xi, H, delta)[source]

Compute the topocentric sun position: elevation and azimuth - without atmospheric correction

Parameters:
  • obs_lat (ndarray) – Observers latitudes

  • obs_elev (ndarray) – Observers elevations

  • xi (ndarray) – Equatorial horizontal parallax

  • H (ndarray) – Local hour angle

  • delta (ndarray) – Geocentric sun declination

Returns:

  • e0 (ndarray) – Topocentric elevation angle in degrees

  • phi (ndarray) – Topocentric azimuth angle

static atmospheric_refraction_correction(e0, pres=1013.25, temp=12, atmos_refract=0.5667)[source]

Compute the atmospheric refraction correction value for all sites

Parameters:
  • e0 (ndarray) – Topocentric elevation angle

  • pres (ndarray) – Pressure at all sites in millibars

  • temp (ndarray) – Temperature at all sites in C

  • atmos_refract (float) – Atmospheric refraction constant

Returns:

delta_e (ndarray) – Atmospheric refraction correction

static apparent_elevation_angle(e0, pres=1013.25, temp=12, atmos_refract=0.5667)[source]

The apparent topocentric elevation angle after refraction

Parameters:
  • e0 (ndarray) – Topocentric elevation angle

  • pres (ndarray) – Pressure at all sites in millibar

  • temp (ndarray) – Temperature at all sites in C

  • atmos_refract (float) – Atmospheric refraction constant

Returns:

e (ndarray) – Apparent topocentric elevation angle after refraction

static topocentric_zenith_angle(e)[source]

Topocentric zenith angle

Parameters:

e (ndarray) – Topocentric elevation angle

Returns:

theta (ndarray) – Topocentric zenith angle

static sun_mean_longitude(jme)[source]

Compute mean sun longitude for all timesteps

Parameters:

jme (ndarray) – Julian ephemeris millennium

Returns:

M (ndarray) – Mean sun longitude

static equation_of_time(jme, alpha, delta_psi, e)[source]

Equation of time

Parameters:
  • jme (ndarray) – Julian ephemeris millennium

  • alpha (ndarray) – geocentric sun right ascension

  • delta_psi (ndarray) – nutation longitude

  • e (ndarray) – True ecliptic obliquity

Returns:

E (ndarray) – Equation of time values for all timesteps

solar_position(delta_t=None)[source]

Compute the solar position for all locations and times: - elevation (e0) - azimuth (phi) - zenith (theta0)

Parameters:

delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

  • e0 (ndarray) – Solar elevation in degrees

  • phi (ndarray) – Solar azimuth in degrees

  • theta0 (ndarray) – Solar zenith in degrees

apparent_solar_position(pressure=1013.25, temperature=12, atmospheric_refraction=0.5667, delta_t=None)[source]

Compute the apparent (atmospheric refraction corrected) solar position for all locations and times: - elevation (e) - zenith (theta)

Parameters:
  • pressure (ndarray) – Pressure at all sites in millibar

  • temperature (ndarray) – Temperature at all sites in C

  • atmospheric_refract (float) – Atmospheric refraction constant

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

  • e (ndarray) – Solar elevation after atmospheric refraction correction in degrees

  • theta (ndarray) – Solar zenith after atmospheric refraction correction in degrees

classmethod position(time_index, lat_lon, elev=0, delta_t=None)[source]

Compute the solar position: - elevation - azimuth - zenith

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

  • e0 (ndarray) – Solar elevation in degrees

  • phi (ndarray) – Solar azimuth in degrees

  • theta0 (ndarray) – Solar zenith in degrees

classmethod elevation(time_index, lat_lon, elev=0, delta_t=None)[source]

Compute the solar elevation

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

e0 (ndarray) – Solar elevation in degrees

classmethod azimuth(time_index, lat_lon, elev=0, delta_t=None)[source]

Compute the solar elevation

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

phi (ndarray) – Solar azimuth in degrees

classmethod zenith(time_index, lat_lon, elev=0, delta_t=None)[source]

Compute the solar elevation

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

theta0 (ndarray) – Solar zenith in degrees

classmethod apparent_position(time_index, lat_lon, elev=0, pressure=1013.25, temperature=12, atmospheric_refraction=0.5667, delta_t=None)[source]

Compute the solar position after atmospheric refraction correction - elevation - zenith

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest

  • pressure (ndarray) – Pressure at all sites in millibar

  • temperature (ndarray) – Temperature at all sites in C

  • atmospheric_refract (float) – Atmospheric refraction constant

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

  • e (ndarray) – Solar elevation after atmospheric refraction correction in degrees

  • theta (ndarray) – Solar zenith after atmospheric refraction correction in degrees

classmethod apparent_elevation(time_index, lat_lon, elev=0, pressure=1013.25, temperature=12, atmospheric_refraction=0.5667, delta_t=None)[source]

Compute the solar elevation after atmospheric refraction correction

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest

  • pressure (ndarray) – Pressure at all sites in millibar

  • temperature (ndarray) – Temperature at all sites in C

  • atmospheric_refract (float) – Atmospheric refraction constant

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

e (ndarray) – Solar elevation after atmospheric refraction correction in degrees

classmethod apparent_zenith(time_index, lat_lon, elev=0, pressure=1013.25, temperature=12, atmospheric_refraction=0.5667, delta_t=None)[source]

Compute the solar zenith angle after atmospheric refraction correction

Parameters:
  • time_index (ndarray | pandas.DatetimeIndex | str) – Datetime stamps of interest

  • lat_lon (ndarray) – (latitude, longitude) for site(s) of interest

  • elev (ndarray) – Elevation above sea-level for site(s) of interest

  • pressure (ndarray) – Pressure at all sites in millibar

  • temperature (ndarray) – Temperature at all sites in C

  • atmospheric_refract (float) – Atmospheric refraction constant

  • delta_t (float | None) – Difference between terrestrial time and UT1. Dependent on year. None will infer delta_t value from time index (recommended).

Returns:

theta (ndarray) – Solar zenith after atmospheric refraction correction in degrees