Tuesday, August 10, 2021

Mars Weather and how to fetch the data

What's the weather on Mars? Aside from drilling holes and collecting samples from the Martian surface, it is vital to keep tabs on the environmental information. I'm sure it's not all sunny all throughout a Martian year. If at all sunny, what could be the temperature and how the atmospheric variation for each Sols. Mars rover have to capture information such as these. It would be helpful to future missions on how the seasons on Mars varies and how could future rovers or even human missions sustain such a fluctuation with minimal disruption.

This is not a technical article of analyzing Mars Weather. Instead, as hobbyist, I'm going to share on how to fetch such information for personal or education purposes. But, before we dive into the "how" here's a short background on the REMS.

How we can take hold of such weather data?

With API we can get these information or data. The question is what API. NASA open API have published for InSight: Mars Weather. With Curiosity REMS, it's not openly shared. But, here, I will show you how. If you'll look into Mars MSL Curiosity REMS page. Inspect the webpage at the right element you will see the API they are currently using to create the weather information posted on the page as shown below.

The API URL is https://mars.nasa.gov/rss/api/?feed=weather&category=msl&feedtype=json. Opening this link will direct you to a page which contains all weather data since Sol 1. That's almost 3000 lines of data, considering is about Sol 3073 on Gale Crater Mars. You can always get down to coding and create ways to fetch those JSON data into usable and structured table. A .csv or directly written into a spreadsheet.

This approach is for script written in Google Apps Script. What's about to be shown are methods on...

  1. How to fetch the REMS Curiosity data and write accordingly the latest Sol info into a spreadsheet.
  2. Fetch like an online API where you can pick the information you only need. The API show above is not clearly mapped and no documentation available (found) to properly access the resources. Creating the API for you from the daily fetch done from the main API will be convenient for developers who just want the direct data right away. 
To save you time, you can access the full script on this github link https://github.com/git-janus/tracking_perseverance/blob/master/Mars_Weather_API_custom.js. Here are snippets of the code. Apologies for some image may not be clear enough. But, you may go ahead use above github link for better view of the code. As of the moment, it only caters with MSL Curiosity REMS data. I was hoping that I could find the API for Perseverance MEDA. Until such time we can have another attributes to our tracking percy as it searches for clues on Mars.

The script:

No comments:

Post a Comment