Skip to main content

Deterministic weather generation for games and simulations

Project description

weather

A deterministic weather generation library for games and simulations.
Given a single time input (and optional location/climate parameters), it returns a complete, reproducible weather report.

Features

  • Fully deterministic – same input always yields same output.
  • Supports game minutes, real‑time, or current UTC.
  • Optional latitude, longitude, elevation for fine‑tuning.
  • Built‑in Köppen climate profiles (extensible).
  • Includes:
    • Temperature, pressure, humidity, dew point, wind (speed/direction/cardinal)
    • Precipitation probability, cloud cover, instability (CAPE‑like)
    • 20+ weather conditions (clear, rain, snow, thunderstorm, blizzard, etc.)
    • Special atmospheric phenomena: aurora, rainbow, sun dog, halo
    • Moon phase (with year drift) and seasonal events (equinoxes/solstices)
    • Flavor text and ASCII art for every condition
  • All disasters can be enabled/disabled per profile.

Installation

Copy weather.py into your project and import:

from weather import weather, WeatherData, list_koppen_codes

(No external dependencies – only the Python standard library.)

Usage

Basic – current weather at default location

w = weather()
print(f"{w.condition} at {w.temperature}°C")
print(w.ascii_art)
print(w.flavor)

Specify game minutes

w = weather(game_minutes=123456)

Use real time (UTC)

from datetime import datetime

w = weather(real_time=datetime(2025, 6, 1, 12, 0))

Scale time (e.g., 1 real minute = 12 game minutes)

w = weather(real_time=datetime.now(), real_time_scale=12)

Set location (latitude affects aurora; elevation applies lapse rate)

w = weather(latitude=60.0, elevation=200, koppen="Dfd")

List available Köppen codes

print(list_koppen_codes())

Allow all disasters (overrides profile)

w = weather(koppen="Cfb", allow_all_disasters=True)

WeatherData fields

Field Type Description
game_minutes int Internal game minute count
datetime_str str Formatted "Year X, Day Y, HH:MM"
temperature float Air temperature (°C)
feels_like float Apparent temperature (°C)
pressure float Atmospheric pressure (hPa)
humidity float Relative humidity (%)
dew_point float Dew point (°C)
wind_speed float Wind speed (m/s)
wind_direction float Wind direction (degrees)
wind_cardinal str Cardinal direction (N, NNE, etc.)
condition str Weather condition (e.g., "light rain")
cloud_cover int Cloud cover (%)
precipitation_prob float Precipitation probability (%)
instability float CAPE‑like instability (J/kg)
moon_phase str Moon phase name
moon_emoji str Moon phase emoji
season_event str|None Solstice/equinox if within ±2 days
flavor str Descriptive flavor text
ascii_art str ASCII art representing the condition

- Update LOGS -

-Update 0.0.1-

  • Bro, this is 0.0.1. Why you even looking here?

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

weatherz-0.0.1.dev1.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

weatherz-0.0.1.dev1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file weatherz-0.0.1.dev1.tar.gz.

File metadata

  • Download URL: weatherz-0.0.1.dev1.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for weatherz-0.0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 e4306c3e7912945982ff4e4a5cffe5171dffd1b01f36652d79bd662899c7b0c7
MD5 32cebd7776e05b0cb860ecbebbf91a3b
BLAKE2b-256 2cda26488f1015b59b6c3fe76d8ee3124fc6cf23b58e72aef787b25c835ca64e

See more details on using hashes here.

File details

Details for the file weatherz-0.0.1.dev1-py3-none-any.whl.

File metadata

  • Download URL: weatherz-0.0.1.dev1-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for weatherz-0.0.1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 168bbdbbb7d2cff0b0fbc8960a8fe0649fc0f3dea3ed2972d7d57ad9763fc93e
MD5 4ec2ed8b3d970ee9e57bb86522e318c8
BLAKE2b-256 66fd90eb9ea6e338c6602a3afed690bbd51147abff8ec1fdff873276c7b5e9cd

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