Anyone good at astronomy? – PHP

  php

Q(Question):

I’ve put some code together to calculate sun rise/set, moon rise/set, and
moon phase and illumination. Everything is right on the money except for the
moon rise/set. I can’t seem to find where I’m going wrong. If you think you
can help, I’ll post the code here. I’d really appreciate the extra set of
eyes!

TIA

A(Answer):

On Nov 9, 3:30*am, "Jessica Griego" <j…@example.comwrote:

I’ve put some code together to calculate sun rise/set, moon rise/set, and
moon phase and illumination. Everything is right on the money except for the
moon rise/set. I can’t seem to find where I’m going wrong. If you think you
can help, I’ll post the code here. I’d really appreciate the extra set of
eyes!

TIA

I think php 5 has some new functions for that, check the date time
functions at php.net. That way you don’t have to calculate it yourself

A(Answer):

"Yorian" <yo************@hotmail.comwrote in message
news:7a**********************************@i20g2000 prf.googlegroups.com…
On Nov 9, 3:30 am, "Jessica Griego" <j…@example.comwrote:

I’ve put some code together to calculate sun rise/set, moon rise/set, and
moon phase and illumination. Everything is right on the money except for
the
moon rise/set. I can’t seem to find where I’m going wrong. If you think
you
can help, I’ll post the code here. I’d really appreciate the extra set of
eyes!

TIA

I think php 5 has some new functions for that, check the date time
functions at php.net. That way you don’t have to calculate it yourself

In php 5 there is a sun rise/set function, but it doesn’t work as far as I
can tell. Also, there are no functions for moon information…like rise/set,
phase, and illumination. The core of what I have should be able to work for
any celestial body…and is what I use to calculate the sun and moon. The
only problem is that the moon rise seems to be off by about 20 minutes and
the moon set seems to be off by about 30 to 45 minutes.

A(Answer):

Jessica Griego said the following on 09/11/2008 18:51:

In php 5 there is a sun rise/set function, but it doesn’t work as far as I
can tell. Also, there are no functions for moon information…like rise/set,
phase, and illumination. The core of what I have should be able to work for
any celestial body…and is what I use to calculate the sun and moon. The
only problem is that the moon rise seems to be off by about 20 minutes and
the moon set seems to be off by about 30 to 45 minutes.

Ask the US Navy, they might have something that you can-rejig to fit?

http://aa.usno.navy.mil/software/novas/novas_info.php

A(Answer):

"Richard Brooks" <ri***********@vickers-armstrongs.comwrote in message
news:S4******************************@bt.com…

Jessica Griego said the following on 09/11/2008 18:51:

>In php 5 there is a sun rise/set function, but it doesn’t work as far as
I can tell. Also, there are no functions for moon information…like
rise/set, phase, and illumination. The core of what I have should be able
to work for any celestial body…and is what I use to calculate the sun
and moon. The only problem is that the moon rise seems to be off by about
20 minutes and the moon set seems to be off by about 30 to 45 minutes.

Ask the US Navy, they might have something that you can-rejig to fit?

http://aa.usno.navy.mil/software/novas/novas_info.php

Well, I’ve been to that sight many times. It’s actually where I’ve gotten
most of the formulas. They have a data entry form that actually gives you
the results. I could just parse that, but I’d like to have the tools at my
disposal. Anyway, like I said, everything I have matches the USNO data
perfectly…just not the moon rise/set.

Thanks for the suggestion though!

A(Answer):

>In php 5 there is a sun rise/set function, but it doesn’t work as far as I

>can tell. Also, there are no functions for moon information…like rise/set,
phase, and illumination. The core of what I have should be able to work for
any celestial body…and is what I use to calculate the sun and moon. The
only problem is that the moon rise seems to be off by about 20 minutes and
the moon set seems to be off by about 30 to 45 minutes.

It matters where you are east/west within a time zone. Does your formula
take that into account?

It probably also matters whether you’re talking about the top of
the moon or the bottom of the moon or the center of the moon at the
horizon. Oh, yes, local hills and mountains may mess up your
observations.

A(Answer):

"Gordon Burditt" <go***********@burditt.orgwrote in message
news:Dr******************************@posted.inter netamerica…

In php 5 there is a sun rise/set function, but it doesn’t work as far as
I
can tell. Also, there are no functions for moon information…like
rise/set,
phase, and illumination. The core of what I have should be able to work
for
any celestial body…and is what I use to calculate the sun and moon. The
only problem is that the moon rise seems to be off by about 20 minutes and
the moon set seems to be off by about 30 to 45 minutes.

It matters where you are east/west within a time zone. Does your formula
take that into account?

It probably also matters whether you’re talking about the top of
the moon or the bottom of the moon or the center of the moon at the
horizon. Oh, yes, local hills and mountains may mess up your
observations.

Yes, I account not only for time zones but for refraction as well.
Calculations are geocentric and I use the effective, civil, and astronomic
azthmus’ in providing different sun rise/sets. The moon is being calculated
the same way except there is only one calculation for rise/set, and that’s
based on an 8 arcminute point…the classical definition – sin(RADIANS * 8 /
60)

Would you be able to review the code if I posted it here? There isn’t that
much to it really…I just can’t seem to be able to catch the problem.
Originally, I thought php had something to do with it in that it wasn’t
carrying the floating precision far enough…but, that’s just not the case
after further investigation.

I’d appreciate any help you could provide, Gordon.

LEAVE A COMMENT