/weather_landscape

Visualizing Weather Forecasts Through Landscape Imagery

Primary LanguagePythonMIT LicenseMIT

Minimalistic copy of lds133's Weather Landscape

Visualizing Weather Forecasts Through Landscape Imagery

Forked from lds133 excellent project.

Visit https://openweathermap.org/ for an API Key and export it as OWM_KEY=... in your environment

Installable via pip:

$ pip install .
$ # OR
$ pip install git+https://github.com/rdyro/weather_landscape

Example usage

from weather_landscape import WeatherLandscape

# lon - longitude, lat - latitude as floating point numbers (negative for west and south)
w = WeatherLandscape(lon=52.237049, lat=21.017532, width=1024, height=128)
img = w.make_img() # get the PIL.Image.Image object directly

# or render and save to file
filename = "warsaw_weather_landscape.png"
w.make_and_save_img(filename) # make and save the image

Dynamically Serving the Weather Landscape

Run the Flask server

$ env OMW_KEY={your key} python3 server.py

Visit the URL

  • http://{server address}/image?lat={latitude}&lon={longitude}&width={width}&height={height}&temperature_unit={unit}

for example

  • http://localhost:8000/image?lat=52.24&lon=21.02&width=512&height=128&temperature_unit=C

Legend

Event image Description
example Sunrise
example Sunset
exampleexampleexampleexampleexampleexample Cloud cover
example Current time position
example Midnight
example Midday
exampleexampleexampleexample South wind
exampleexampleexampleexample East wind
exampleexampleexampleexample West wind
exampleexampleexampleexample North wind