Position of the sun in the sky of mars or the moon - pyephem

I'm interested in designing a device that will track the position of the sun from the surface of the moon or mars.
Is there a way to compute this information within the pyephem package, or a way to derive it?

Alas, no — PyEphem can't directly generate positions from bodies other than the Earth. You might want to look at Skyfield, AstroPy, or NOVAS for that possibility.

Related

Moving around the surface of an Earth shaped spheroid in Unity

I'm trying to make a Unity game that allows the user to explore the surface of an Earth shaped spheroid, based on WGS84.
The project so far is on Github, and there's a YouTube video of this behaviour.
A shape the size of Earth is way too big for Unity, so I just spawn tiles near the user, offset so that the first tile is at Unity's origin point. This bit works.
The issue is moving around. I've been using an approach where I get the user's position in ECEF coordinates, then normalise that to provide the global orientation for the player, then I translate the player forward based on that and their rotation.
The issue with this is that normalising the ECEF coordinate means that the player is moving in a spherical shape, but the WGS84 spheroid is not perfectly spherical. So the player sinks into the floor, or flies up if you got south or north, respectively.
My question is, how can I allow the user to move around the surface of the spheroid by way of translation? I feel like there might be some way of taking the major/minor axis of the spheroid into account as the player moves, but I'm not sure how to do that.
I have no experience with Unity or computer graphics, I'm approaching it purely from the navigation point of view.
Let's look at the real world.
We want to travel either by walking/driving on the surface or flying at some altitude. When we do it, we move in the local coordinate system (North-South, East-West, Up-Down), we can't see any curvature. We assume the Earth is flat.
The problem arises when we try to do it on a computer, which is ruthlessly precise and knows the shape of the Earth. We can't assume the Earth is flat, we can't assume the Earth is a sphere. The Earth is a geoid. Fortunately for some purposes we can simplify things and assume the Earth is an ellipsoid. You chose WGS84. Good!
So how to move around an ellipsoid? Solving the problem analitically is a nightmare. We have to cheat ;)
We should assume te Earth is flat for a moment, make a move in a chosen direction in the local coordinate system, write down the altitude of the new position, calculate the global geodetic coordinates (Lat, Long, Alt) of that new point and then replace the altitude with the one obtained while using the local coordinate system. In other words: each time we move forward along a perfectly straight line and diverge from the ellipsoid (just a tiny bit), we force the altitude not to change in relation to the ellipsoid.
Implementation.
You need to be able to freely translate coordinates between geodetic (Lat, Long, Alt) and ECEF. Going from geodetic to ECEF is easy. Finding geodetic coordinates for a given ECEF position is much more complex, there are many different algorithms, I'm sure you should be able to find a ready to use implementation somewhere.
What you also need is Local Tangent Plane, and to be precise, you are going to use NED.
Let's assume your object is initially at some geodetic position. You write down the altitude (relative to the ellipsoid). Then you create a local NED coordinate system with its origin at that point. Then you move the object in that local coordinate system. You write down how much the altitude (or rather the Down coordinate) changed. Then you must calculate the ECEF coordinates of that new position and transform it to geodetic (Lat, Long, Alt). You have the old altitude, you have the altitude change in the NED coordinates, which means you know the new altitude. You then apply that altitude to your new geodetic coordinates (brutally replace the Alt in Lat/Long/Alt with a new value).
Then you make another move in the NED coordinates defined for that new position. And so on...
I'm not sure if it is clear, the process is quite complicated. If you can't understand - shout :)

Planet tilts and rotations.

We are building an Astronomical clock that tracks the planet and moon locations in the Galilain solar system ( planets out to Saturn And moons do earth and 4 moons of Jupiter. Think if an orrery that acuately tracks time.
The clock can move to different epoch and Can move through the 12 astronomical ages. It’s 8ft in diameter, hangs from the ceiling, 24 stepper motors drive the rotations and tilts of the planets, 18.6 year moon cycle etc.
We plan to use PyEphem to identify locations of planets. We need additional data and was wondering if python can provide this data.
We need the rotation and tilt of planet (earth mars Saturn). And we need tie rotation so the part of the planet that faces the sun. Lastly we need to Jupiter’s 4 major moons location over the planet.
Does PyEphem support these addition items and if not is there any advice you can provide us.
W
Details of what PyEphem supports are available from the PyEphem website which provides detailed, searchable documentation.
This is very standard for software libraries. I am not being disingenuous when I advise you to RTFM - this is definitive material. Google and Bing should be your next port of call, especially since you have clearly defined search terms.
Alas, PyEphem does not include any models of planetary rotation, no — so the lack of any mention of it in the documentation is not an omission but the lack of that feature in the underlying libastro library.

Swift - how can i correct sky map according to current time and location?

i'm new to Swift, and now i'm trying to build sky map app like the application "star chart".
i already got a sky map image from NASA and cover it on SCNsphere, also already set camera node in the center of this sphere to make it looks like 360 degrees. Furthermore, i used accelerator to check what direction the camera is looking at.
i know that the sky map like “star chart” doesn't need internet to update data. so now the biggest problem is that i don't know how to correct the position of my sky map according to people's current time and location.
Any good advice and help? Thanks in advance!!! cause i tried vary hard to find some related information but still stuck in here for three weeks.
You just need to rotate your map with time+longitude around Earth's rotation axis and with latitude around axis longitude=90 degrees while earth is placed in the center of your sphere. For stars the offset does not matter so you can ignore Sun-Earth distance and also Earth's radius as well.
The time rotation must be day+year rotations together. On top of that you have to apply precession and nutation if you want to have higher precision.
Of coarse the stars are moving too so if you need really high precision and or high time interval to cover (hundreds or thousands of years) then this approach is not good and you should use stellar catalog with the motions implemented.
For more info see related:
How to draw sky chart
Plotting a star chart efficiently
If you want to use catalog and real colors then you will also need
Star B-V color index to apparent RGB color
simplified atmospheric scattering GLSL shader
And finally here some hints for such applications:
Is it possible to make realistic n-body solar system simulation in matter of size and mass?

Jupiter moon phase in pyephem

I am bit of a beginner with all this, but I've search around and can't find an answer.
I was to work out the phase of Io, as per this.
Where "The position or phase of Io (γIo) is measured counterclockwise around its orbit from Superior Geocentric Conjunction (SGC)"
I am current using:
moons = ephem.Io()
moons.compute(t)
print moons.x, moons.y, moons.z
Is there a way I can get the phase out of jupmoon.c? I am assuming that it has an elliptical orbit so it isn't as easy as simply working out the coordinates of x,y,z on a circle about the centre of jupiter?
You should be able to use the phase of Jupiter itself as the phase of any of its moons, since Jupiter and its moons are close enough together in the sky — and close enough together in space relative to the position of the Earth — that there should be no observable difference in phase between Jupiter itself and the moons that surround it when viewed from the Earth.

Can I track on point the surface of Mars, for instance, a rovers's landing site, using PyEphem

Can I track on point the surface of Mars, for instance, a rovers's landing site, using PyEphem and if the particular point would be visible from a certain point on Earth or the period as well, of visibility.
Unfortunately, I think that the answer is no: PyEphem offers support from the underlying libastro library for the longitude of our of own Moon that is facing us, and for the longitude of Jupiter that is facing us; but not, it appears, for Mars.
Response to comment:
Since the Moon always points the same face at us, the approximate answer to your comment about the Moon is that “0° longitude is always pointing toward us, so that the Moon's face visible to us is the longitudes 0–90° and 270-360°.”
There is, however, a slight wobble in the exact lunar longitude that is facing Earth's center at any given moment. You can look at the property moon.libration_long to find out, for a given moment, how far east or west of “perfectly facing us” the Moon currently is.
Further response:
You can ask for how Jupiter is facing us by asking for its Central Meridian Longitude, either using System I or System II, like this:
import ephem
j = ephem.Jupiter()
j.compute('2013/1/1')
print j.cmlI
print j.cmlII
The results are longitudes measured as radians that print out as degrees:
64:29:25.5
169:52:16.2