1
$\begingroup$

I would like to write a small script to calculate solar ecliptic longitude in relation to different locations and dates. For instance UTC + - 1...2 etc.. I know, solar ecliptic longitude is the position of the sun relative to the vernal equinox, in degrees clockwise 360 degrees over a year..

What do I have to keep in mind?

Thanx a lot!

$\endgroup$
3
  • $\begingroup$ Looking down from above the North Pole, the solar ecliptic longitude increases in the anticlockwise direction. See commons.m.wikimedia.org/wiki/… $\endgroup$
    – PM 2Ring
    Commented Mar 30, 2023 at 8:28
  • $\begingroup$ What do you mean by "in relation to different locations"? Typically, the solar ecliptic longitude is calculated relative to the centre of the Earth. There is a small difference to the observed longitude at a given location on the Earth's surface due to parallax and atmospheric refraction. Of course, location (or time zone) is needed to convert local time to UTC. $\endgroup$
    – PM 2Ring
    Commented Mar 30, 2023 at 8:34
  • $\begingroup$ Thanx, you helped a lot $\endgroup$
    – Robert
    Commented Mar 30, 2023 at 12:59

1 Answer 1

1
$\begingroup$

I'm not sure what language you want to write this script in, but here is one way to calculate the solar longitude using astropy.

import astropy.time
import astropy.coordinates

time = astropy.time.Time("2023-03-29")

sun = astropy.coordinates.get_body("sun", time=time)
frame = astropy.coordinates.GeocentricTrueEcliptic(equinox=time)

lon = sun.transform_to(frame).lon.value

print(lon)

Which outputs

8.041066223269443
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .