gregseth / suncalc-php

PHP library for basic astronomical computation (sun and moon rise and set, moon phases, …)
GNU General Public License v2.0
65 stars 20 forks source link

moon amimuth values are incorrect? #4

Open pketola opened 8 years ago

pketola commented 8 years ago

When I compare the values data from timeanddate.com service, (http://www.timeanddate.com/astronomy/france/paris) it looks that the suncalc-php values are incorrect. I took the hourly values for several hours .

Or don't I just understand?

slarta commented 7 years ago

Here is no answer. This is not good. I've found another bug.

slarta commented 7 years ago

This can have several causes.

  1. Is the server time with you UTC?
  2. Some lunar calculations use database tables with reference values for comparison, and not just scripts for calculation. 3.) Deviations from minutes are normal.
gregseth commented 7 years ago

I get the same values as the original JavaScript lib, I have not the mathemetical backgound to go further than that.

pketola commented 7 years ago

ok. i got it working somehow, but there is something strange about moon's rise/set and sun's rise/set at midnight.

moon's calculations are same for the day, but sun gives at 00:00:00 the previous day's rise/set.

i can make a workaround for that, but i think moon and sun should work at same logic?

here's what i have working for:

http://finnso.fi/tahtitaivas

it started for as tool to find easy when should take a photo of landscape when the moon is in a good window (over horizon and less than some height in some compass direction) and fraction. and what are the light conditions that time.

i started the project again some weeks ago. the system is under still under construction and partly finnish/english, but probably you can use it. and has only some finnish cities.

i may make it full finnish/english and add more european and other cities it there are demand for it.

On 9.2.2017 21.58, Greg wrote:

I get the same values as the original JavaScript lib, I have not the mathemetical backgound to go further than that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gregseth/suncalc-php/issues/4#issuecomment-278754746, or mute the thread https://github.com/notifications/unsubscribe-auth/ATB1xaXEQAuHWTn5G6EeTN1MFBbdcu4dks5ra2_xgaJpZM4I5JSh.Web Bug from https://github.com/notifications/beacon/ATB1xV3mZP8oKDau6n7V_bLAiRg8pMvjks5ra2_xgaJpZM4I5JSh.gif

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/gregseth/suncalc-php","title":"gregseth/suncalc-php","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/gregseth/suncalc-php"}},"updates":{"snippets":[{"icon":"PERSON","message":"@gregseth in #4: I get the same values as the original JavaScript lib, I have not the mathemetical backgound to go further than that. "}],"action":{"name":"View Issue","url":"https://github.com/gregseth/suncalc-php/issues/4#issuecomment-278754746"}}}

gregseth commented 7 years ago

Hi,

When you say you got it working, you mean you made some changes in the code? If so you're more than welcome to submit a pull request.

About the difference between the moon and sun rise/set, I agree they should have the same behavior. It may be timezone related, I'll look into that.

pketola commented 7 years ago

i just re-writed my code and don't know what was wrong with the first try.

into the suncalc itself i made no changes.

it could however be a good idea to make working examples how to get out sunrise, sunset etc. in the original something was was not working and some values had no examples.

On 13.2.2017 11.05, Greg wrote:

Hi,

When you say you got it working, you mean you made some changes in the code? If so you're more than welcome to submit a pull request.

About the difference between the moon and sun rise/set, I agree they should have the same behavior. It may be timezone related, I'll look into that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gregseth/suncalc-php/issues/4#issuecomment-279329778, or mute the thread https://github.com/notifications/unsubscribe-auth/ATB1xS6nYeWw5bffReVFjC8M0WGGNiMNks5rcBzpgaJpZM4I5JSh.Web Bug from https://github.com/notifications/beacon/ATB1xeS0Sgsz2iItzAWT_11HBiZ_8fmmks5rcBzpgaJpZM4I5JSh.gif

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/gregseth/suncalc-php","title":"gregseth/suncalc-php","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/gregseth/suncalc-php"}},"updates":{"snippets":[{"icon":"PERSON","message":"@gregseth in #4: Hi,\r\n\r\nWhen you say you got it working, you mean you made some changes in the code? If so you're more than welcome to submit a pull request. \r\n\r\nAbout the difference between the moon and sun rise/set, I agree they should have the same behavior. It may be timezone related, I'll look into that.\r\n\r\n"}],"action":{"name":"View Issue","url":"https://github.com/gregseth/suncalc-php/issues/4#issuecomment-279329778"}}}

pketola commented 7 years ago

greg,

I had already forgotten that on some days suncalc does not give sunrise/sunset or moonrise/moonset values.

a short php test program attached to show the problem.

On 11.2.2017 11.03, roska.posti@finnso.fi wrote:

ok. i got it working somehow, but there is something strange about moon's rise/set and sun's rise/set at midnight.

moon's calculations are same for the day, but sun gives at 00:00:00 the previous day's rise/set.

i can make a workaround for that, but i think moon and sun should work at same logic?

here's what i have working for:

http://finnso.fi/tahtitaivas

it started for as tool to find easy when should take a photo of landscape when the moon is in a good window (over horizon and less than some height in some compass direction) and fraction. and what are the light conditions that time.

i started the project again some weeks ago. the system is under still under construction and partly finnish/english, but probably you can use it. and has only some finnish cities.

i may make it full finnish/english and add more european and other cities it there are demand for it.

On 9.2.2017 21.58, Greg wrote:

I get the same values as the original JavaScript lib, I have not the mathemetical backgound to go further than that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gregseth/suncalc-php/issues/4#issuecomment-278754746, or mute the thread https://github.com/notifications/unsubscribe-auth/ATB1xaXEQAuHWTn5G6EeTN1MFBbdcu4dks5ra2_xgaJpZM4I5JSh.Web Bug from https://github.com/notifications/beacon/ATB1xV3mZP8oKDau6n7V_bLAiRg8pMvjks5ra2_xgaJpZM4I5JSh.gif

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/gregseth/suncalc-php","title":"gregseth/suncalc-php","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/gregseth/suncalc-php"}},"updates":{"snippets":[{"icon":"PERSON","message":"@gregseth in #4: I get the same values as the original JavaScript lib, I have not the mathemetical backgound to go further than that. "}],"action":{"name":"View Issue","url":"https://github.com/gregseth/suncalc-php/issues/4#issuecomment-278754746"}}}

pketola commented 7 years ago

greg,

other example of possible errors.

PLACE: Hanko 59.49 22.58 date: 2018-01-26 moon height jumps on 11:00

2018-01-26 10:30:00 sunrise:08:55, sunset:16:31, moonrise:10:02,moonset:11:59, az:-2.466588265987,alt:-0.16152694332653 2018-01-26 11:00:00 sunrise:08:55, sunset:16:31, moonrise:10:02,moonset:11:59, az:-2.3516859391622,alt:2.5144667409025 2018-01-26 11:30:00 sunrise:08:55, sunset:16:31, moonrise:10:02,moonset:11:59, az:-2.2395646074941,alt:-0.069486030019704

demo php app included

On 11.2.2017 11.03, roska.posti@finnso.fi wrote:

ok. i got it working somehow, but there is something strange about moon's rise/set and sun's rise/set at midnight.

moon's calculations are same for the day, but sun gives at 00:00:00 the previous day's rise/set.

i can make a workaround for that, but i think moon and sun should work at same logic?

here's what i have working for:

http://finnso.fi/tahtitaivas

it started for as tool to find easy when should take a photo of landscape when the moon is in a good window (over horizon and less than some height in some compass direction) and fraction. and what are the light conditions that time.

i started the project again some weeks ago. the system is under still under construction and partly finnish/english, but probably you can use it. and has only some finnish cities.

i may make it full finnish/english and add more european and other cities it there are demand for it.

On 9.2.2017 21.58, Greg wrote:

I get the same values as the original JavaScript lib, I have not the mathemetical backgound to go further than that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gregseth/suncalc-php/issues/4#issuecomment-278754746, or mute the thread https://github.com/notifications/unsubscribe-auth/ATB1xaXEQAuHWTn5G6EeTN1MFBbdcu4dks5ra2_xgaJpZM4I5JSh.Web Bug from https://github.com/notifications/beacon/ATB1xV3mZP8oKDau6n7V_bLAiRg8pMvjks5ra2_xgaJpZM4I5JSh.gif

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/gregseth/suncalc-php","title":"gregseth/suncalc-php","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/gregseth/suncalc-php"}},"updates":{"snippets":[{"icon":"PERSON","message":"@gregseth in #4: I get the same values as the original JavaScript lib, I have not the mathemetical backgound to go further than that. "}],"action":{"name":"View Issue","url":"https://github.com/gregseth/suncalc-php/issues/4#issuecomment-278754746"}}}