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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bcn_rainfall_core-1.0.7.tar.gz
Algorithm Hash digest
SHA256 c1974ad82876b902a8aaf6f1ef632a87f95cb9a7ee0bd72fee535c108a967594
MD5 6e68631e2a862788d3ba32846fe8f419
BLAKE2b-256 eef6250e22652281ba2506a6249a69f7ac84eb65cb22c69b38113ac6d2a969d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bcn_rainfall_core-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3b708cc823124269c68ae5b3a8c3eaf5472139ffb12f199b57b3df01072ddc4e
MD5 871db919744c939e1c2f003a88227583
BLAKE2b-256 81260a54e41b6977ae97842293475fedd2b4e56223956883e3382439dd5c7e2f

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