Skip to main content

A Python package to fetch current weather data using OpenWeatherMap API

Project description

BlockX Weather

A Python package for weather data processing and calculations.

Installation

pip install blockx-weather

Features

  • Create and manage weather data objects
  • Convert temperatures between different units (Celsius, Fahrenheit, Kelvin)
  • Calculate heat index (feels like temperature) based on temperature and humidity
  • Calculate wind chill factor based on temperature and wind speed
  • Calculate dew point based on temperature and humidity
  • Command-line interface (CLI) for quick access to all features
  • No external API dependencies - works offline

Usage

As a Library

from blockx_weather import (
    WeatherData, 
    convert_temperature, 
    calculate_heat_index, 
    calculate_wind_chill, 
    calculate_dew_point
)

# Create a weather data object
weather = WeatherData("London", "GB")
weather.set_temperature(20.5, 19.8, "metric")
weather.set_atmosphere(humidity=65, pressure=1013)
weather.set_wind(speed=5.5, direction=180)
weather.set_description("clear sky")
weather.set_timestamp()

# Convert temperature between units
temp_f = convert_temperature(25.0, "metric", "imperial")  # Celsius to Fahrenheit
print(f"25.0°C = {temp_f:.2f}°F")

# Calculate heat index
hi = calculate_heat_index(30.0, 80.0, "metric")  # 30°C with 80% humidity
print(f"Heat index: {hi:.2f}°C")

# Calculate wind chill
wc = calculate_wind_chill(5.0, 20.0, "metric")  # 5°C with 20 m/s wind
print(f"Wind chill: {wc:.2f}°C")

# Calculate dew point
dp = calculate_dew_point(20.0, 65.0, "metric")  # 20°C with 65% humidity
print(f"Dew point: {dp:.2f}°C")

Via Command Line

The package provides several CLI commands:

# Generate sample weather data
blockx-weather sample "London" --temp 20.5 --units metric

# Convert temperature between units
blockx-weather convert 25.0 --from metric --to imperial

# Calculate heat index
blockx-weather heat-index 30.0 80.0 --units metric

# Calculate wind chill
blockx-weather wind-chill 5.0 20.0 --units metric

# Calculate dew point
blockx-weather dew-point 20.0 65.0 --units metric

Development

Setup

  1. Clone the repository
  2. Install development dependencies:
    pip install -e ".[dev]"
    

Running Tests

python -m unittest discover tests

License

MIT License

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

blockx_weather-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

blockx_weather-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file blockx_weather-0.1.0.tar.gz.

File metadata

  • Download URL: blockx_weather-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for blockx_weather-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03a04db218b0f405adb74712f6c7a0d998a93bd2bf80970a046fde43772fbbf1
MD5 327805ef18e38246d245d1007b7d3e5c
BLAKE2b-256 d9579086dd8825053ea46220614885dbea3a249cc5e07b85c8aaf3a2629aa184

See more details on using hashes here.

File details

Details for the file blockx_weather-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: blockx_weather-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for blockx_weather-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b076b2d984eabf1fcaadd42e5bc3ca3ceb1b83698664135b921e8f1fe8cbba8
MD5 c753d7161315eb0a1a17baa4fd305c1d
BLAKE2b-256 efacfad6efc49302ceeaea9a26993112388a7c77ee457b2bfbacb56f552d1397

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