Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Sun() function (Sun Position/Ascension/Declination) to the package #68

Closed
abolfazlshirazi opened this issue May 16, 2020 · 1 comment

Comments

@abolfazlshirazi
Copy link

Hi,

I work with orbit propagation and I have been used Vallado MATLAB package for a long time. Currently, I am using satellite.js for a web-based project and I realized not all of the functions are converted from the original Vallado code. Since I personally needed the Sun position in my project, I converted the MATLAB function "sun.mat" from the Vallado package to Javascript "sun.js".

Since it is very short and simple, I would like to share it here. Maybe it becomes useful for some users.
sun.js.txt
(Remove .txt extension)

To use, just simply add sun.js after loading satellite.js in your page. This function gets JulianDate as input and returns Sun position/ascension/declination as the output.

Since the MATLAB syntax is very simple, it is easy to convert the whole Vallado package to JavaScript and satellite.js. I think adding this (and also other functions from the original package) to satellite.js makes it more practical for various projects.

Cheers

spacenewb added a commit to spacenewb/satellite-js that referenced this issue Sep 11, 2023
Implemented function `sunPos`, to calculate sun position. This resolves issue  shashwatak#68 .

The name of the function is slightly changed for clarity and added references.

Cleaned the ported code `sun.js.txt` as provided in the original issue.

Removed `var` declarations within the function to augment performance.
@thkruz
Copy link
Collaborator

thkruz commented Jan 14, 2024

This looks like valid code and I hope it helps others, but there are no plans to upgrade this library. If you are looking for sun position or ra/dec caclulations for the sun or stars I recommend looking at the OP's solution or the following libraries:

suncalc3
ootk-core

@thkruz thkruz closed this as completed Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants