Mars Weather Service

Nasa’s Mars Weather API will provide weather data from Elysium Planitia region of Mars continously in terms of temperature, wind and pressure.

Here is a simply code that uses requests and json libraries.

Below you can find a simple code to extract temperature and wind data from Mars.

import requests 
import json 
import webbrowser

def marsweather():
    f = r""
    data = requests.get(f)
    tt = json.loads(data.text)
    for i in tt:
        return tt[i]["AT"], tt[i]["HWS"]


Output example:

Mars Weather

Nasa’s InSight robot takes continous weather data from Mars surface at Elysium Planitia.

Sol 349

Sol 350

1 F
0 F
Max Wind

If you need a refresher on user defined functions lesson in Python here is a link to our Defining Functions Lesson.

Source of API: Nasa API Webpage
Documentation: PDF

Recommended Posts