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.4.tar.gz (52.3 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.4-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bcn_rainfall_core-1.0.4.tar.gz
Algorithm Hash digest
SHA256 e5fa86b8dab769ac57be15ce48b0e9f8ac42410204b5bfdeafe318b08204cad0
MD5 0e0f0d363b1bfbe9e981ae1ff5a61f9d
BLAKE2b-256 ef07b5daf6747d1183fbbd8dcdf529e2757560f7d01d00685f1d3bc713069ac0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bcn_rainfall_core-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fcd3a4de53fefc6ca1bf8efb822419accfa3e1741396f9fc51c429b757e9959f
MD5 95990c9618e747dcd8b48f6c01496675
BLAKE2b-256 239625fdab8bb0a1c2312940903567c8660e989ac1e33c2628583ff9eefe825d

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