Sun position code

43 views
Skip to first unread message

Chris

unread,
May 16, 2016, 12:13:32 PM5/16/16
to Julia Astro
Hello,

I'm hoping someone here can save me a bunch of time: I need to compute the obliquity of the ecliptic, mean longitude of the Sun, and mean anomaly of the Sun at some epoch. It does not need to be very accurate. I would really prefer to use existing code for this and not try to cobble something together myself, as I am not an astronomer. I've seen sunpos.jl in AstroLib.jl, but it's not usable in its current form. Does this exist somewhere?

Thanks in advance,
Chris

nirinA

unread,
May 16, 2016, 2:00:13 PM5/16/16
to julia...@googlegroups.com
have a look at:

https://github.com/JuliaAstro/ERFA.jl

there are eraObl06 and eraObl80 for the obliquity of the ecliptic,
and eraFaxx03 for mean longitude and anomaly of orbiting bodies.

--
nirinA
> --
> You received this message because you are subscribed to the Google
> Groups "Julia Astro" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to julia-astro...@googlegroups.com
> <mailto:julia-astro...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Chris

unread,
May 16, 2016, 9:47:23 PM5/16/16
to Julia Astro
Thanks. I knew about ERFA.jl, I should've checked that a little more thoroughly. I see eraFalp03, which returns mean anomaly of the Sun (according to the SOFA doc, at least), but I can't find a function that returns mean longitude.

nirinA

unread,
May 17, 2016, 9:19:41 AM5/17/16
to julia...@googlegroups.com
eraFaom03 - eraFad03 ?

note that the fundamental arguments relative to the planets
are their mean heliocentric ecliptic longitudes.

--
nirinA

Chris wrote:
> Thanks. I knew about ERFA.jl, I should've checked that a little more
> thoroughly. I see eraFalp03, which returns mean anomaly of the Sun
> (according to the SOFA doc, at least
> <http://www.iausofa.org/2008_0301/sofa/sofa_lib.lis>), but I can't

Chris

unread,
May 17, 2016, 9:41:54 AM5/17/16
to Julia Astro
Hmm, "elongation" is a new term to me. Thanks for your help.

Mosè Giordano

unread,
May 17, 2016, 7:18:09 PM5/17/16
to Julia Astro
Hi Chris,

2016-05-16 18:13:32 GMT+2 Chris:
Hello,

I'm hoping someone here can save me a bunch of time: I need to compute the obliquity of the ecliptic, mean longitude of the Sun, and mean anomaly of the Sun at some epoch. It does not need to be very accurate. I would really prefer to use existing code for this and not try to cobble something together myself, as I am not an astronomer. I've seen sunpos.jl in AstroLib.jl, but it's not usable in its current form. Does this exist somewhere?


Why do you say that sunpos function in AstroLib.jl is not usable?  It can't be used alone because it relies on other functions part of the library, but the whole library is self-sufficient.  If you mean that there isn't a tagged version providing that function, I can release a new one.

Bye,
Mosè

Chris

unread,
May 18, 2016, 11:25:45 AM5/18/16
to Julia Astro
Admittedly I did not spend much time trying to get it working, but I checked out master and included sunpos.jl, but I still got an error. I did not pursue it further.

Mosè Giordano

unread,
May 18, 2016, 12:24:32 PM5/18/16
to Julia Astro
2016-05-18 17:25 GMT+02:00 Chris:
Admittedly I did not spend much time trying to get it working, but I checked out master and included sunpos.jl, but I still got an error. I did not pursue it further.

So you only issued

include("/path/to/sunpos.jl")

?  If so, this is definitely a problem, AstroLib.jl is intended to be used as a package (like any other Julia package I know), not a collection of independent (and sometimes inconsistent) functions like IDL AstroLib.  AstroLib.jl's functions are in different files just for convenience.

Instead, if you loaded the whole package and got an error it would be great to know which error ;-)

Bye,
Mosè

Chris

unread,
May 18, 2016, 12:50:52 PM5/18/16
to Julia Astro
Well, no, I did some combination of using AstroLib and the include statement, one problem is that sunpos.jl is not included when the module is loaded. I can tell you that trying it again now (`using AstroLib`, that is), I get the following error:

iERROR: LoadError: LoadError: SystemError: opening file C:\Users\cbinz\.julia\v0.4\AstroLib\src\..\deps\NP.xy: No such file or directory
 in open at iostream.jl:90
 in open at iostream.jl:112
 in readdlm_auto at datafmt.jl:45
 in readdlm at datafmt.jl:39
 in readdlm at datafmt.jl:36
 in anonymous at C:\Users\cbinz\.julia\v0.4\AstroLib\src\common.jl:13
 in include at boot.jl:261
 in include_from_node1 at loading.jl:320
 in include at boot.jl:261
 in include_from_node1 at loading.jl:320
 in require at loading.jl:259
while loading C:\Users\cbinz\.julia\v0.4\AstroLib\src\common.jl, in expression starting on line 11
while loading C:\Users\cbinz\.julia\v0.4\AstroLib\src\AstroLib.jl, in expression starting on line 15

Chris

unread,
May 18, 2016, 12:55:13 PM5/18/16
to Julia Astro
I see now that sunpos.jl is included via utils.jl, so I was wrong about that.

Mosè Giordano

unread,
May 18, 2016, 1:36:48 PM5/18/16
to Julia Astro
2016-05-18 18:50 GMT+02:00 Chris:
Well, no, I did some combination of using AstroLib and the include statement, one problem is that sunpos.jl is not included when the module is loaded. I can tell you that trying it again now (`using AstroLib`, that is), I get the following error:

iERROR: LoadError: LoadError: SystemError: opening file C:\Users\cbinz\.julia\v0.4\AstroLib\src\..\deps\NP.xy: No such file or directory
 in open at iostream.jl:90
 in open at iostream.jl:112
 in readdlm_auto at datafmt.jl:45
 in readdlm at datafmt.jl:39
 in readdlm at datafmt.jl:36
 in anonymous at C:\Users\cbinz\.julia\v0.4\AstroLib\src\common.jl:13
 in include at boot.jl:261
 in include_from_node1 at loading.jl:320
 in include at boot.jl:261
 in include_from_node1 at loading.jl:320
 in require at loading.jl:259
while loading C:\Users\cbinz\.julia\v0.4\AstroLib\src\common.jl, in expression starting on line 11
while loading C:\Users\cbinz\.julia\v0.4\AstroLib\src\AstroLib.jl, in expression starting on line 15

It seems that the build script hadn't been run (how did you install the package?  This is done automatically when installing the package with Pkg.add("AstroLib")), so the file NP.xy wasn't there.  But it is used only in a function, it isn't fundamental, I'll had a check about existence of that file: if it's missing there will be not error, just a warning.  Thanks for pointing this out!  Anyway, you can run the build script manually with

Pkg.build("AstroLib")

and then everything should work just fine.

Bye,
Mosè

Chris

unread,
May 18, 2016, 2:20:39 PM5/18/16
to Julia Astro
I think I see what happened: I installed v0.0.5 with the usual `Pkg.add("AstroLib")``, but that version does not include `sunpos`. So I checked out `master`, but did not re-build the package after doing so. Checking out `master` and manually building works. A new tagged version would be useful. Thanks for your help.

Mosè Giordano

unread,
May 19, 2016, 4:22:50 PM5/19/16
to Julia Astro
Hi Chris,


2016-05-18 20:20 GMT+02:00 Chris:
A new tagged version would be useful.
 
AstroLib 0.0.6 is now out there ;-)

Bye,
Mosè
Reply all
Reply to author
Forward
0 new messages