Skip to content
4 min read plotly plotting joins datetime api

Bamboo Weekly #165: Artemis II

Get better at: APIs, dates and times, joins, and plotting with Plotly.

Bamboo Weekly #165: Artemis II

This week, let's talk about something exciting and positive: The Artemis II mission (https://en.wikipedia.org/wiki/Artemis_II), currently on its way home to Earth after going around the moon, and farther from Earth than anyone has ever travelled before. Artemis is NASA's successor to the Apollo program, and is meant to get astronauts back onto the moon for the first time in more than 50 years. (In Greek mythology, Artemis was the twin sister of Apollo.)

On Monday, I spent the better part of an hour watching NASA's live stream on YouTube (https://www.youtube.com/watch?v=m3kR2KK8TEs), as the astronauts on board their Orion spacecraft prepared to circle around the moon. As someone who grew up reading about the Apollo program as history, and following all of NASA's various probes, spacecraft, and adventures over the years, it was truly astonishing to see these astronauts, in real-time, color video, traveling to the moon.

(My first paid writing gig, BTW, was as a book reviewer for Odyssey, a wonderful magazine about astronomy and space for children, back when I was about 12 years old. I earned $25!)

This week, we'll use NASA's own data to track Orion, relative to Earth and the moon.

Paid subscribers, both to Bamboo Weekly and to my LernerPython+data membership program (https://LernerPython.com) get all of the questions and answers, as well as downloadable data files, downloadable versions of my notebooks, one-click access to my notebooks, and invitations to monthly office hours.

Learning goals for this week include reading working with APIs, working with dates and times, joins, and plotting.

Data and six questions

This week's data comes from NASA's Horizons API (https://ssd-api.jpl.nasa.gov/doc/horizons.html). This system has been around for many years, and the API reflects that. You'll need to make a GET request to https://ssd.jpl.nasa.gov/api/horizons.api. (No API key or registration is needed.) You'll need to pass a number of parameters to the API, most easily done via the following Python dict:


```python
 horizons_params = {
        'format': 'text',
        'COMMAND': f"'{command}'",
        'EPHEM_TYPE': "'VECTORS'",
        'START_TIME': f"'{start_time}'",
        'STOP_TIME': f"'{stop_time}'",
        'STEP_SIZE': "'1h'",
        'VEC_TABLE': "'2'",      
        'CSV_FORMAT': "'YES'",
    }
```    

The dict reflects the parameters that you need to pass. Note that all of them must be put inside of single quotes! It's not enough for them to be strings:

Here are my six questions for this week. I'll be back tomorrow with solutions and explanations: