Skip to main content

Tools to load and manipulate rainfall data from the city of Barcelona, Catalunya.

Project description

bcn-rainfall-core

PyPI version License: MIT coverage badge Ruff uv mypy

Tools to load and manipulate rainfall data from the city of Barcelona, Catalunya; it is the core of the Barcelona Rainfall project and is exposed through the Barcelona Rainfall API.

Requirements

  • Python 3.12
  • Pip

Usage

from bcn_rainfall_core import Rainfall
from bcn_rainfall_core.utils import DataSettings

# With configuration file in default path `config.yml`
rainfall = Rainfall.from_config()

# With configuration file in other path
rainfall_with_path = Rainfall.from_config(path="new/path/to/config.yml")

# With your own configuration
rainfall_with_cfg = Rainfall.from_config(
    cfg=DataSettings(file_url="http://...", start_year=1955, rainfall_precision=2)
)

# With your own configuration from local file
rainfall_with_cfg_from_file = Rainfall.from_config(
    cfg=DataSettings(local_file_path="/dir/my_rainfall_data.csv", start_year=1955, rainfall_precision=2),
    from_file=True,
)


# Have fun with class!
from bcn_rainfall_core.utils import TimeMode, Season

rainfall_avg = rainfall.get_rainfall_average(
    TimeMode.SEASONAL,
    begin_year=1975, 
    end_year=1998, 
    season=Season.WINTER
)
print(rainfall_avg)
...

Tests & Coverage

uv run coverage run -m pytest
uv run coverage report

Code quality

uv tool run mypy --check-untyped-defs .
uv tool run ruff check
uv tool run ruff format

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

bcn_rainfall_core-1.0.5.tar.gz (52.9 kB view details)

Uploaded Source

Built Distribution

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

bcn_rainfall_core-1.0.5-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file bcn_rainfall_core-1.0.5.tar.gz.

File metadata

  • Download URL: bcn_rainfall_core-1.0.5.tar.gz
  • Upload date:
  • Size: 52.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.16

File hashes

Hashes for bcn_rainfall_core-1.0.5.tar.gz
Algorithm Hash digest
SHA256 a419a2dc7d7eb03bd03ac6d4869408b63b0750bbb39e82a471b686c09743f043
MD5 df61ea71cd10baee92873f60e053f8d8
BLAKE2b-256 a68d7d2795e5b492ca5f3311a0a71a5b0d8b3d98ebf24077568b215939767c70

See more details on using hashes here.

File details

Details for the file bcn_rainfall_core-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for bcn_rainfall_core-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8590da68fc88ebb088d439c9d0e5c55b557727f246d7101bb63d2e7b6753ad28
MD5 bb5bd723bd559aeef357ed4558e4e855
BLAKE2b-256 94fff52f9b575abcd684e328c63b8fa9ea8601df4775d243b1f28bbdef55d6de

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