Categories: API

Mars Weather Data API

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"https://api.nasa.gov/insight_weather/?api_key=DEMO_KEY&feedtype=json&ver=1.0"
    data = requests.get(f)
    tt = json.loads(data.text)
    for i in tt:
        return tt[i]["AT"], tt[i]["HWS"]

print(marsweather())

Output example:

Mars Weather

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

Sol 349

Sol 350

1 F
High
0 F
Low
0.88
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

Usag1r

Share
Published by
Usag1r

Recent Posts

Benefits of Bokeh over Python visualization libraries like Seaborn, Matplotlib & Plotly

ContentsIntroductionBokeh vs Seaborn & MatplotlibBokeh vs PlotlySummary Introduction As computer science activity booms, you might…

11 months ago

History of Speech-to-Text AI models

History of Speech-to-Text Models​ & Current Infrastructure As speech technology continues to advance, so too…

1 year ago

Advanced Level Python Tips & Tricks

Python Tips & Tricks (Part III) Advanced Level HolyPython.com Here are more Python tips about…

1 year ago

Intermediate Level Python Tips & Tricks

Python Tips & Tricks (Part II) Intermediate Level HolyPython.com The list continues with slightly more…

1 year ago

When is Python 4 Coming Out?

Almost 15 years after the release of Python 3 many people are wondering when Python…

2 years ago

How to Create an app with a 3D model using VIKTOR

Introduction We are going to need smart engineering solutions to solve our planet's problems (and…

2 years ago