Skip to main content

A Python library for calculating Heating Degree Days (HDD) and Cooling Degree Days (CDD) using NWS API data

Project description

HDD/CDD Calculator

A Python library for calculating Heating Degree Days (HDD) and Cooling Degree Days (CDD) using weather data from the National Weather Service (NWS) API.


Features

  • Calculate HDD and CDD for any geographic location by latitude and longitude.
  • Support for custom base temperatures.
  • Retrieve degree day data for specific date ranges.
  • Graceful handling of errors and invalid inputs.
  • Type hints for improved code clarity and IDE support.
  • Unit tests included for core functionality.
  • Ready for packaging and distribution via PyPI.

Installation

Install the package via pip:

pip install hdd-cdd-calculator

Usage
Basic Usage
from hdd_cdd import get_degree_days_for_location

# Get degree days for a specific location (e.g., White House coordinates)
results = get_degree_days_for_location(38.8977, -77.0365)

for result in results:
    print(f"Date: {result.date}")
    print(f"High: {result.high_temp}°F, Low: {result.low_temp}°F")
    print(f"Mean: {result.mean_temp:.1f}°F")
    print(f"HDD: {result.hdd:.1f}, CDD: {result.cdd:.1f}")
    print()

Advanced Usage with Date Range
from hdd_cdd import get_degree_days_for_period

# Get degree days for New York City for June 2023
results = get_degree_days_for_period(
    lat=40.7128,
    lon=-74.0060,
    start_date="2023-06-01",
    end_date="2023-06-30"
)

total_hdd = sum(result.hdd for result in results)
total_cdd = sum(result.cdd for result in results)

print(f"Total HDD for June 2023: {total_hdd:.1f}")
print(f"Total CDD for June 2023: {total_cdd:.1f}")

Documentation

Full documentation is available in the docs directory.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Additional Project Files
pyproject.toml  Build system configuration.
setup.cfg  Package metadata and configuration.
.gitignore  Recommended ignores for Python projects, including build artifacts, virtual environments, and IDE files.

If you have any questions or want to contribute, feel free to open an issue or submit a pull request!

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

hdd_cdd_calculator-0.1.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

hdd_cdd_calculator-0.1.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file hdd_cdd_calculator-0.1.2.tar.gz.

File metadata

  • Download URL: hdd_cdd_calculator-0.1.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for hdd_cdd_calculator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cca29e173aaac806f522a7e953ea2f2aa11b39d82d527f88177bcd78231d1af3
MD5 1f1ccbb5eb6f1336982c7e466cec3c69
BLAKE2b-256 07a65a49910192368bd2705549cba1cf7c484267e201beb2b5708b2852199bf4

See more details on using hashes here.

File details

Details for the file hdd_cdd_calculator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for hdd_cdd_calculator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a71bc5f03c58867dbaec5f63df82c4b618d007fb2415f7e05b2c2d5ded3637a
MD5 b1952c1ad9ff4ec67b44338cfa0562ef
BLAKE2b-256 3ec6b2dd9596ae67a2277670bc488b9bec659490c6748251d55c5d5520f14750

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