Using Python to Create an Animated Planet Map

This was a neat little project I came up with while working on improving my RaspAstro Web application. It started with plotting the current position of the planets using matplotlib. Once I was able to get a map with accurate plots of the planets current locations, using The Planets Today for reference, around the Sun I decide to level it up a bit and plot the position of the planets over time and then create an animation.

This is the Animated Planet Map I came up with animating the locations of the planets in our Solar System from February 2023 to November 2059. Each frame in the animation shows the planets location with 28 days passing between frames. There are 480 frames total. The Sun is in the center, Mercury is the small brown point, next is Venus in orange, then Earth in green, then Mars in red of course, then Jupiter is the largest dot in purple, next up Saturn is olive, then Uranus is light blue, and finally Neptune is in blue.
Animated Planet Map
I used my AstroData class which uses PyEphem to compute the astrometric heliocentric longitude and the distance from the Sun for each planet on the different dates. While trying to do this I did find an issue with how I was setting the observer date. I was not setting the date keyword argument obsepoch which was being passed to the class, I fixed this.

Once I fixed the issue with passing in the observer date/time I started with the current date time and then created a loop which added 28 days to each date/time for 480 loops to generate the ~40 years of plots by creating an individual image for each using matplotlib. Once I had the 480 images I uploaded them (manually) to the EZGif.com Animated PNG Maker to create the animation above.

The code I used to create the frames for the animation is part of my RaspAstro Project and can be found here: planets_overtime.py. This kind of sidetracked me from the RaspAstro Web App for a bit, but it was fun to mess with.

I am still learning but getting more into it with each little application I write. Gives me something to do when the sky is full of clouds.

Appreciate any comments or feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *

eight − one =