<p>so i found this code and  even looked up the documentation on swe_suncross() most i've seen its - 88 degrees  but can one determine this using any degrees</p>
<pre><code>
# set ephemeris files path
swe.set_ephe_path('~/Downaloads/swisseph-master/')

# birth time as Julian day number (UT), for example
birth_t = swe.julday(1988, 6, 12, 5.5)
# sun longitude at birth
sun_longitude = swe.calc_ut(birth_t, swe.SUN)[0][0]
# longitude searched
xlon = swe.degnorm(sun_longitude - 88)
# start search 90 deays prior to birth
tstart = birth_t - 90
# find exact crossing time
res = swe.solcross_ut(xlon, tstart)
# turn it into a date
date = swe.revjul(res)

print(&quot;Year:&quot;, date[0], &quot;Month:&quot;, date[1], &quot;Day:&quot;, date[2], &quot;Hour:&quot;, date[3])
</code></pre>
<p>and i get sent in the future ???</p>
<p><code>Year: 1989 Month: 3 Day: 14 Hour: 1.8550639897584915</code></p>
<p>i have tried other numbers( less than 88 ) and was still in the future .. what am I doing wrong ?</p>

CC BY-SA 4.0
2023-09-24T03:36:36.100Z
This question is more about general debugging than astronomy. Inspect your intermediate values. I think you'll find `xlon` is 353.5.
Mike G
CC BY-SA 4.0
2023-09-24T05:43:01.177Z
Mike the xlong checks out, however the  rest is way off  ```Year: 1989 Month: 3 Day: 14
Time: 1 hours 51 minutes 18 seconds
Sun Longitude at Birth: 81.46587046324426
xlon: 353.46587046324424
tstart: 2447234.7291666665
Result (Julian Day Number): 2447599.577294333
``` thank you for the help tho <3
dimitri33
CC BY-SA 4.0
2023-09-24T12:06:56.923Z
What's the Sun's longitude at `tstart`?
Mike G
CC BY-SA 4.0
2023-09-24T15:24:46.530Z
```Sun Longitude at tstart: 353.8554640836316```
dimitri33
CC BY-SA 4.0
2023-09-24T15:45:05.133Z
So at `tstart` the Sun is 0.39° past `xlon` and it takes another year to get there again.
Mike G
CC BY-SA 4.0
2023-09-24T17:56:14.243Z
This is the best I can do .. ```Sun Longitude at tstart: 352.8581509350368
xlon: 353.46587046324424```  Not sure what else to thinker with to get it spot on :(   however your guidance helped <3
dimitri33
CC BY-SA 4.0
2023-09-24T18:14:33.040Z
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/148721/discussion-between-dimitri33-and-mike-g).
dimitri33
<the-sun>
calculating the position of the sun by using degrees and determining date and time
dimitri33
# calculating the position of the sun by using degrees and determining date and time

(Asked by: username_0 on 2023-09-24)

so i found this code and  even looked up the documentation on swe_suncross() most i've seen its - 88 degrees  but can one determine this using any degrees

# set ephemeris files path
swe.set_ephe_path('~/Downaloads/swisseph-master/')

# birth time as Julian day number (UT), for example
birth_t = swe.julday(1988, 6, 12, 5.5)
# sun longitude at birth
sun_longitude = swe.calc_ut(birth_t, swe.SUN)[0][0]
# longitude searched
xlon = swe.degnorm(sun_longitude - 88)
# start search 90 deays prior to birth
tstart = birth_t - 90
# find exact crossing time
res = swe.solcross_ut(xlon, tstart)
# turn it into a date
date = swe.revjul(res)

print("Year:", date[0], "Month:", date[1], "Day:", date[2], "Hour:", date[3])

and i get sent in the future ???
Year: 1989 Month: 3 Day: 14 Hour: 1.8550639897584915
i have tried other numbers( less than 88 ) and was still in the future .. what am I doing wrong ?

**Tags:** the-sun
> **Comments:**
> **username_1**: This question is more about general debugging than astronomy. Inspect your intermediate values. I think you'll find `xlon` is 353.5.  
> **username_0**: Mike the xlong checks out, however the  rest is way off  ```Year: 1989 Month: 3 Day: 14 Time: 1 hours 51 minutes 18 seconds Sun Longitude at Birth: 81.46587046324426 xlon: 353.46587046324424 tstart: 2447234.7291666665 Result (Julian Day Number): 2447599.577294333 ``` thank you for the help tho <3  
> **username_1**: What's the Sun's longitude at `tstart`?  
> **username_0**: ```Sun Longitude at tstart: 353.8554640836316```  
> **username_1**: So at `tstart` the Sun is 0.39° past `xlon` and it takes another year to get there again.  
> **username_0**: This is the best I can do .. ```Sun Longitude at tstart: 352.8581509350368 xlon: 353.46587046324424```  Not sure what else to thinker with to get it spot on :(   however your guidance helped <3  
> **username_0**: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/148721/discussion-between-dimitri33-and-mike-g).  

---

## 0 answers

