Skip to main content

Tells if, and how hard, it's raining at any location in Singapore

Project description

sgrain

Tells if it's currently raining at a given latitude and longitude in Singapore. The data comes from rain radar images at https://www.weather.gov.sg/weather-rain-area-50km/. The image is updated every 5 minutes.

Link to project: https://github.com/nlannuzel/sgrain

Package installation

From Github:

pip install git+https://github.com/nlannuzel/sgrain

... or from Pypi:

pip install nlannuzel.sgrain

Package usage

For example:

#!/usr/bin/env python3

from nlannuzel.sgrain.rain import RainAreas
from nlannuzel.sgrain.geo import Location

rain = RainAreas()

# Download the latest radar image from https://www.weather.gov.sg/weather-rain-area-50km/
rain.load_image()

# https://maps.app.goo.gl/9aA7i8chryYwuhUT8
picnic_spot = Location(1.313383, 103.815203)

# Returns a number from 0 to 31
intensity = rain.intensity_at(picnic_spot)

message = f"At location {picnic_spot}, time {rain.rounded_dt}: "
if intensity == 0:
	message += "it's not raining."
elif intensity < 10:
	msg += "it's raining a little bit ({intensity}), bring a umbrella."
else:
	msg += "it's raining a lot ({intensity}), cancel the picnic."
print(message)

One liner: python -m

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nlannuzel_sgrain-1.0.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nlannuzel_sgrain-1.0.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file nlannuzel_sgrain-1.0.0.tar.gz.

File metadata

  • Download URL: nlannuzel_sgrain-1.0.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for nlannuzel_sgrain-1.0.0.tar.gz
Algorithm Hash digest
SHA256 be19517159584b09f4e6a96f9e0ed765366af0eaca36d639c117ebaa3fefaf34
MD5 5f195cf3ae53d464a7a1588f8038d640
BLAKE2b-256 284a95e8b112e86e2ffbb6685d30542b4d656b362dc07c9226242063ebc72695

See more details on using hashes here.

File details

Details for the file nlannuzel_sgrain-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nlannuzel_sgrain-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a0aade7ab8bbd547779cc8f664d3cecb8207d3036222be863eae026513abcbf
MD5 1135a3103d69026ac6aa7b4ac8e5d91e
BLAKE2b-256 871d48dd097c1384893f0e248ff676e3ebbbaf64700ff3329d1502fd3156d4f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page