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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bcn_rainfall_core-1.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 e917a6f7e313f2d73ea46a6be80357c791d3a49501d4cb88b876869e04f8b167
MD5 a52edaa4cb7c38d4dd0bfdc3029197a7
BLAKE2b-256 3468270aeaf30197dc847e0f86cb117295d943690aa60c8caeb439a12553dc59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bcn_rainfall_core-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 38f5a810c216af0fb649ec480583b4913db994a542ea172a31f7dc804ac67cca
MD5 78c2fa714fe1268559e20baed3c06077
BLAKE2b-256 4a0da4910c722de2031563b2140990e44a0932a8e8c020819e94da71355c4ef3

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