reuters-temperature-storms 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reuters_temperature_storms-1.0.0/.editorconfig +15 -0
- reuters_temperature_storms-1.0.0/.gitattributes +8 -0
- reuters_temperature_storms-1.0.0/.github/climate-method-story.png +0 -0
- reuters_temperature_storms-1.0.0/.github/dependabot.yml +20 -0
- reuters_temperature_storms-1.0.0/.github/workflows/continuous-deployment.yaml +92 -0
- reuters_temperature_storms-1.0.0/.gitignore +19 -0
- reuters_temperature_storms-1.0.0/.pre-commit-config.yaml +43 -0
- reuters_temperature_storms-1.0.0/.python-version +1 -0
- reuters_temperature_storms-1.0.0/LICENSE +21 -0
- reuters_temperature_storms-1.0.0/MANIFEST.in +7 -0
- reuters_temperature_storms-1.0.0/Makefile +36 -0
- reuters_temperature_storms-1.0.0/PKG-INFO +35 -0
- reuters_temperature_storms-1.0.0/README.md +15 -0
- reuters_temperature_storms-1.0.0/pyproject.toml +195 -0
- reuters_temperature_storms-1.0.0/scripts/check_release_artifacts.py +94 -0
- reuters_temperature_storms-1.0.0/setup.cfg +4 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/__init__.py +77 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/_catalog.py +294 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/_wave_tracking.py +1407 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/anomalies.py +373 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/anomaly_run.py +420 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/cell_geometry.py +192 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/cell_run.py +385 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/cell_scores.py +274 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/cell_state.py +325 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/cells.py +319 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/cli.py +820 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/components.py +94 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/daily_run.py +266 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/data/names_library.csv +2381 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/footprint_geometry.py +603 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/footprint_run.py +402 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/footprints.py +430 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/identity.py +170 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/naming.py +612 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/py.typed +0 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/records.py +2630 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/run_state.py +367 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/runner.py +469 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/schemas.py +1110 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/score_run.py +443 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/series.py +134 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/source.py +205 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/state_builder.py +186 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/state_run.py +389 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/tracker.py +1513 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms/weighted_scores.py +100 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/PKG-INFO +35 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/SOURCES.txt +84 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/dependency_links.txt +1 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/entry_points.txt +3 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/requires.txt +13 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/scm_file_list.json +81 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/scm_version.json +8 -0
- reuters_temperature_storms-1.0.0/src/reuters_temperature_storms.egg-info/top_level.txt +1 -0
- reuters_temperature_storms-1.0.0/tests/__init__.py +1 -0
- reuters_temperature_storms-1.0.0/tests/data/saved-wave-batches.json +231 -0
- reuters_temperature_storms-1.0.0/tests/data/wave-footprints.json +140 -0
- reuters_temperature_storms-1.0.0/tests/fixtures.py +189 -0
- reuters_temperature_storms-1.0.0/tests/test_anomalies.py +445 -0
- reuters_temperature_storms-1.0.0/tests/test_cell_scores.py +314 -0
- reuters_temperature_storms-1.0.0/tests/test_cell_stage.py +364 -0
- reuters_temperature_storms-1.0.0/tests/test_cell_state.py +760 -0
- reuters_temperature_storms-1.0.0/tests/test_cli.py +381 -0
- reuters_temperature_storms-1.0.0/tests/test_cli_tracking.py +89 -0
- reuters_temperature_storms-1.0.0/tests/test_footprint_stage.py +639 -0
- reuters_temperature_storms-1.0.0/tests/test_footprints.py +760 -0
- reuters_temperature_storms-1.0.0/tests/test_identity.py +166 -0
- reuters_temperature_storms-1.0.0/tests/test_naming.py +623 -0
- reuters_temperature_storms-1.0.0/tests/test_records.py +2601 -0
- reuters_temperature_storms-1.0.0/tests/test_release_artifacts.py +197 -0
- reuters_temperature_storms-1.0.0/tests/test_run_state.py +106 -0
- reuters_temperature_storms-1.0.0/tests/test_runner.py +1224 -0
- reuters_temperature_storms-1.0.0/tests/test_schemas.py +668 -0
- reuters_temperature_storms-1.0.0/tests/test_score_cli.py +251 -0
- reuters_temperature_storms-1.0.0/tests/test_score_run.py +280 -0
- reuters_temperature_storms-1.0.0/tests/test_series.py +76 -0
- reuters_temperature_storms-1.0.0/tests/test_state_builder.py +388 -0
- reuters_temperature_storms-1.0.0/tests/test_state_run.py +560 -0
- reuters_temperature_storms-1.0.0/tests/test_tracker.py +895 -0
- reuters_temperature_storms-1.0.0/tests/test_wave_cells.py +825 -0
- reuters_temperature_storms-1.0.0/tests/test_wave_footprint_reference.py +138 -0
- reuters_temperature_storms-1.0.0/tests/test_wave_tracking.py +1313 -0
- reuters_temperature_storms-1.0.0/tests/test_weighted_scores.py +324 -0
- reuters_temperature_storms-1.0.0/uv.lock +2711 -0
- reuters_temperature_storms-1.0.0/zizmor.yml +4 -0
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "monthly"
|
|
7
|
+
groups:
|
|
8
|
+
python-dependencies:
|
|
9
|
+
patterns: ["*"]
|
|
10
|
+
|
|
11
|
+
- package-ecosystem: "github-actions"
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: "weekly"
|
|
15
|
+
day: "monday"
|
|
16
|
+
time: "06:00"
|
|
17
|
+
timezone: "Etc/UTC"
|
|
18
|
+
groups:
|
|
19
|
+
github-actions:
|
|
20
|
+
patterns: ["*"]
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
name: Continuous deployment
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
tags: ["[0-9]*.[0-9]*.[0-9]*"]
|
|
10
|
+
pull_request:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
check:
|
|
19
|
+
name: Check project
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
- uses: astral-sh/setup-uv@v10.3.0
|
|
27
|
+
with:
|
|
28
|
+
version: "0.10.7"
|
|
29
|
+
enable-cache: false
|
|
30
|
+
- run: uv sync --locked --group dev --group test --extra aws
|
|
31
|
+
- run: make check hooks
|
|
32
|
+
|
|
33
|
+
test-python:
|
|
34
|
+
name: Test Python ${{ matrix.python }}
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
env:
|
|
37
|
+
UV_PYTHON: ${{ matrix.python }}
|
|
38
|
+
strategy:
|
|
39
|
+
fail-fast: false
|
|
40
|
+
matrix:
|
|
41
|
+
python: ["3.11", "3.12", "3.13", "3.14"]
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v7
|
|
44
|
+
with:
|
|
45
|
+
persist-credentials: false
|
|
46
|
+
fetch-depth: 0
|
|
47
|
+
- uses: astral-sh/setup-uv@v10.3.0
|
|
48
|
+
with:
|
|
49
|
+
version: "0.10.7"
|
|
50
|
+
enable-cache: false
|
|
51
|
+
- run: uv sync --locked --group test --extra aws --python "$PYTHON_VERSION"
|
|
52
|
+
env:
|
|
53
|
+
PYTHON_VERSION: ${{ matrix.python }}
|
|
54
|
+
- run: make test
|
|
55
|
+
|
|
56
|
+
package-verification:
|
|
57
|
+
name: Verify package distribution
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/checkout@v7
|
|
61
|
+
with:
|
|
62
|
+
persist-credentials: false
|
|
63
|
+
fetch-depth: 0
|
|
64
|
+
- uses: astral-sh/setup-uv@v10.3.0
|
|
65
|
+
with:
|
|
66
|
+
version: "0.10.7"
|
|
67
|
+
enable-cache: false
|
|
68
|
+
- run: uv sync --locked --group dev
|
|
69
|
+
- run: make package-check
|
|
70
|
+
- uses: actions/upload-artifact@v7
|
|
71
|
+
with:
|
|
72
|
+
name: release-candidate
|
|
73
|
+
path: dist/
|
|
74
|
+
if-no-files-found: error
|
|
75
|
+
|
|
76
|
+
release:
|
|
77
|
+
name: PyPI release
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
needs: [check, test-python, package-verification]
|
|
80
|
+
if: >-
|
|
81
|
+
github.event_name == 'push' &&
|
|
82
|
+
startsWith(github.ref, 'refs/tags/') &&
|
|
83
|
+
vars.PYPI_PUBLISH_ENABLED == 'true'
|
|
84
|
+
environment: pypi
|
|
85
|
+
permissions:
|
|
86
|
+
id-token: write
|
|
87
|
+
steps:
|
|
88
|
+
- uses: actions/download-artifact@v8
|
|
89
|
+
with:
|
|
90
|
+
name: release-candidate
|
|
91
|
+
path: dist/
|
|
92
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
.env
|
|
3
|
+
.env.*
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.py[cod]
|
|
6
|
+
*.egg-info/
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
.cache/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
.coverage
|
|
13
|
+
htmlcov/
|
|
14
|
+
*.log
|
|
15
|
+
wave-results/
|
|
16
|
+
wave-results-state/
|
|
17
|
+
example-footprints/
|
|
18
|
+
example-waves/
|
|
19
|
+
example-waves-state/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v6.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-merge-conflict
|
|
8
|
+
- id: check-toml
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-json
|
|
11
|
+
- id: detect-private-key
|
|
12
|
+
- id: check-added-large-files
|
|
13
|
+
exclude: ^(data/all_storms\.parquet|uv\.lock)$
|
|
14
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
15
|
+
rev: v0.16.3
|
|
16
|
+
hooks:
|
|
17
|
+
- id: ruff
|
|
18
|
+
args: [--fix]
|
|
19
|
+
- id: ruff-format
|
|
20
|
+
- repo: https://github.com/rhysd/actionlint
|
|
21
|
+
rev: v1.7.12
|
|
22
|
+
hooks:
|
|
23
|
+
- id: actionlint
|
|
24
|
+
- repo: https://github.com/asottile/blacken-docs
|
|
25
|
+
rev: 1.20.0
|
|
26
|
+
hooks:
|
|
27
|
+
- id: blacken-docs
|
|
28
|
+
additional_dependencies: [black]
|
|
29
|
+
files: \.(md|rst)$
|
|
30
|
+
- repo: local
|
|
31
|
+
hooks:
|
|
32
|
+
- id: ty
|
|
33
|
+
name: ty
|
|
34
|
+
entry: uv run ty check
|
|
35
|
+
language: system
|
|
36
|
+
types: [python]
|
|
37
|
+
pass_filenames: false
|
|
38
|
+
- id: zizmor
|
|
39
|
+
name: zizmor
|
|
40
|
+
entry: uv run zizmor .github/workflows
|
|
41
|
+
language: system
|
|
42
|
+
files: ^\.github/workflows/.*\.ya?ml$
|
|
43
|
+
pass_filenames: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Reuters Graphics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.DEFAULT_GOAL := help
|
|
2
|
+
UV ?= uv
|
|
3
|
+
|
|
4
|
+
.PHONY: help bootstrap check test hooks build package-check
|
|
5
|
+
|
|
6
|
+
help:
|
|
7
|
+
@echo 'bootstrap check test hooks build package-check'
|
|
8
|
+
|
|
9
|
+
bootstrap:
|
|
10
|
+
$(UV) sync --group dev --group test --extra aws --locked
|
|
11
|
+
$(UV) run pre-commit install
|
|
12
|
+
|
|
13
|
+
check:
|
|
14
|
+
$(UV) run ruff check .
|
|
15
|
+
$(UV) run ruff format --check .
|
|
16
|
+
$(UV) run ty check
|
|
17
|
+
$(UV) run deptry .
|
|
18
|
+
$(UV) run zizmor .github/workflows
|
|
19
|
+
|
|
20
|
+
test:
|
|
21
|
+
$(UV) run --group test pytest
|
|
22
|
+
|
|
23
|
+
hooks:
|
|
24
|
+
$(UV) run pre-commit run --all-files
|
|
25
|
+
|
|
26
|
+
build:
|
|
27
|
+
$(UV) build --clear
|
|
28
|
+
$(UV) run twine check dist/*
|
|
29
|
+
$(UV) run python scripts/check_release_artifacts.py dist
|
|
30
|
+
|
|
31
|
+
package-check: build
|
|
32
|
+
@set -e; temp_dir=$$(mktemp -d); trap 'rm -rf "$$temp_dir"' EXIT; \
|
|
33
|
+
$(UV) venv "$$temp_dir/venv"; \
|
|
34
|
+
$(UV) pip install --python "$$temp_dir/venv/bin/python" dist/*.whl; \
|
|
35
|
+
cd "$$temp_dir" && "$$temp_dir/venv/bin/rts" --help; \
|
|
36
|
+
"$$temp_dir/venv/bin/python" -c 'from reuters_temperature_storms import load_name_library; assert len(load_name_library().entries) == 2380'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: reuters-temperature-storms
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: How to calculate the supersized heat waves tracked by the Reuters Climate Monitor
|
|
5
|
+
Author: Reuters Graphics
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Source, https://github.com/palewire/reuters-temperature-storms
|
|
8
|
+
Project-URL: Issues, https://github.com/palewire/reuters-temperature-storms/issues
|
|
9
|
+
Keywords: Reuters,climate,temperature,storms
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/plain
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: click>=8.1
|
|
22
|
+
Requires-Dist: numpy>=2.0
|
|
23
|
+
Requires-Dist: scipy>=1.15
|
|
24
|
+
Requires-Dist: pyproj>=3.6
|
|
25
|
+
Requires-Dist: shapely>=2.1
|
|
26
|
+
Requires-Dist: pyarrow>=25.0
|
|
27
|
+
Requires-Dist: fsspec>=2026.7.0
|
|
28
|
+
Requires-Dist: pandas>=3.0
|
|
29
|
+
Requires-Dist: geopandas>=1.2
|
|
30
|
+
Requires-Dist: pandera[pandas]>=0.34
|
|
31
|
+
Provides-Extra: aws
|
|
32
|
+
Requires-Dist: s3fs>=2026.7.0; extra == "aws"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
How to calculate the supersized heat waves tracked by the Reuters Climate Monitor
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
How to calculate the supersized heat waves tracked by the [Reuters Climate Monitor](https://www.reuters.com/graphics/CLIMATE-AUTOMATED/MONITOR/akpeykqqapr/heat-storms/).
|
|
2
|
+
|
|
3
|
+
The code in this repository generated the analysis published in an October 20, 2026 Reuters story headlined ["Giant ‘heat storms’ are scorching the Earth. This is the story of the biggest one on record."](https://www.reuters.com/investigates/special-report/climate-heatstorms-science/). The same logic is used by the [Reuters Climate Monitor](https://www.reuters.com/graphics/CLIMATE-AUTOMATED/MONITOR/akpeykqqapr/heat-storms/) to track heat storms in real time.
|
|
4
|
+
|
|
5
|
+
The inspiration and methodology are explained in ["How (and why) we developed ‘The Age of Heat Storms’"](https://www.reuters.com/investigates/special-report/climate-heatstorms-methodology/).
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
For the Reuters analysis, temperature readings were drawn from the [ERA5 reanalysis dataset](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=overview) published by the [European Centre for Medium-Range Weather Forecasts](https://www.ecmwf.int/)’ [Copernicus](https://climate.copernicus.eu/) program. That data is not included here.
|
|
10
|
+
|
|
11
|
+
Using different temperature readings and baseline climatologies will lead to differing results. Additionally, small differences in computer architecture may affect temperature readings and percentile scores by very small amounts.
|
|
12
|
+
|
|
13
|
+
The storm names assigned by Reuters are generated using a lottery system with a seeded value so that the results are reproducible. On some computer systems, the seed may not reliably return the same name list. In such a circumstance, you can refer to the table of storms and the names we use in our stories and visualizations, which is included in the repository.
|
|
14
|
+
|
|
15
|
+
If you have questions about the code or data, you're encouraged to contact [Ben Welsh](mailto:ben.welsh@thomsonreuters.com) and [Maurice Tamman](mailto:maurice.tamman@reuters.com) at Reuters.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=84.0.0", "setuptools_scm>=10.2.1"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "reuters-temperature-storms"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"click>=8.1",
|
|
11
|
+
"numpy>=2.0",
|
|
12
|
+
"scipy>=1.15",
|
|
13
|
+
"pyproj>=3.6",
|
|
14
|
+
"shapely>=2.1",
|
|
15
|
+
"pyarrow>=25.0",
|
|
16
|
+
"fsspec>=2026.7.0",
|
|
17
|
+
"pandas>=3.0",
|
|
18
|
+
"geopandas>=1.2",
|
|
19
|
+
"pandera[pandas]>=0.34",
|
|
20
|
+
]
|
|
21
|
+
authors = [{ name = "Reuters Graphics" }]
|
|
22
|
+
description = "How to calculate the supersized heat waves tracked by the Reuters Climate Monitor"
|
|
23
|
+
readme = { text = "How to calculate the supersized heat waves tracked by the Reuters Climate Monitor", content-type = "text/plain" }
|
|
24
|
+
keywords = ["Reuters", "climate", "temperature", "storms"]
|
|
25
|
+
license = "MIT"
|
|
26
|
+
license-files = ["LICENSE"]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 4 - Beta",
|
|
29
|
+
"Programming Language :: Python",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Programming Language :: Python :: 3.13",
|
|
34
|
+
"Programming Language :: Python :: 3.14",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Source = "https://github.com/palewire/reuters-temperature-storms"
|
|
40
|
+
Issues = "https://github.com/palewire/reuters-temperature-storms/issues"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
rts = "reuters_temperature_storms.cli:main"
|
|
44
|
+
reuters-temperature-storms = "reuters_temperature_storms.cli:main"
|
|
45
|
+
|
|
46
|
+
[project.optional-dependencies]
|
|
47
|
+
aws = ["s3fs>=2026.7.0"]
|
|
48
|
+
|
|
49
|
+
[dependency-groups]
|
|
50
|
+
dev = [
|
|
51
|
+
"deptry",
|
|
52
|
+
"pre-commit",
|
|
53
|
+
"ruff",
|
|
54
|
+
"setuptools-scm",
|
|
55
|
+
"twine",
|
|
56
|
+
"ty",
|
|
57
|
+
"zizmor",
|
|
58
|
+
]
|
|
59
|
+
test = [
|
|
60
|
+
"duckdb>=1.4",
|
|
61
|
+
"pytest",
|
|
62
|
+
"pytest-timeout",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.package-dir]
|
|
67
|
+
"" = "src"
|
|
68
|
+
|
|
69
|
+
[tool.setuptools.packages.find]
|
|
70
|
+
where = ["src"]
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.package-data]
|
|
73
|
+
reuters_temperature_storms = ["data/*.csv", "py.typed"]
|
|
74
|
+
|
|
75
|
+
[tool.setuptools_scm]
|
|
76
|
+
|
|
77
|
+
[tool.ruff]
|
|
78
|
+
target-version = "py311"
|
|
79
|
+
|
|
80
|
+
[tool.ruff.lint]
|
|
81
|
+
select = [
|
|
82
|
+
"D", # Google-style docstrings
|
|
83
|
+
"E", # pycodestyle
|
|
84
|
+
"F", # pyflakes
|
|
85
|
+
"B", # flake8-bugbear
|
|
86
|
+
"C4", # flake8-comprehensions - comprehension improvements
|
|
87
|
+
"DTZ", # flake8-datetimez - timezone-aware datetimes
|
|
88
|
+
"G", # flake8-logging-format - logging formatting
|
|
89
|
+
"LOG", # flake8-logging - logging best practices
|
|
90
|
+
"W", # pycodestyle warnings
|
|
91
|
+
"I", # isort - import sorting
|
|
92
|
+
"UP", # pyupgrade - modern Python idioms
|
|
93
|
+
"N", # pep8-naming - naming conventions
|
|
94
|
+
"ANN", # flake8-annotations - type annotations
|
|
95
|
+
"YTT", # flake8-2020 - sys.version_info checks
|
|
96
|
+
"S", # flake8-bandit - security issues
|
|
97
|
+
"BLE", # flake8-blind-except - blind except statements
|
|
98
|
+
"FA", # flake8-future-annotations - future annotations
|
|
99
|
+
"ICN", # flake8-import-conventions - import conventions
|
|
100
|
+
"PIE", # flake8-pie - misc lints
|
|
101
|
+
"Q", # flake8-quotes - quote consistency
|
|
102
|
+
"RSE", # flake8-raise - raise statement improvements
|
|
103
|
+
"RET", # flake8-return - return statement improvements
|
|
104
|
+
"SLOT", # flake8-slots - __slots__ usage
|
|
105
|
+
"SIM", # flake8-simplify - code simplification
|
|
106
|
+
"TID", # flake8-tidy-imports - tidy imports
|
|
107
|
+
"PTH", # flake8-use-pathlib - pathlib usage
|
|
108
|
+
"PT", # flake8-pytest-style - pytest conventions
|
|
109
|
+
"TC", # flake8-type-checking - type-only imports
|
|
110
|
+
"FLY", # flynt - f-string conversion
|
|
111
|
+
"PERF", # perflint - performance improvements
|
|
112
|
+
"RUF", # ruff-specific rules
|
|
113
|
+
]
|
|
114
|
+
ignore = [
|
|
115
|
+
"E501", # Line length
|
|
116
|
+
"UP046", # Generic class `Loader` uses `Generic` subclass instead of type parameters
|
|
117
|
+
"S101", # Allow assert
|
|
118
|
+
"SIM103", # Allow for True/False returns after a test
|
|
119
|
+
"SIM108", # Don't force ternary expressions
|
|
120
|
+
"SIM117", # Allow for nested with statements
|
|
121
|
+
"PERF401", # For for appending to a list
|
|
122
|
+
"RUF001", # Allow for curly quotes
|
|
123
|
+
"RUF005", # Allow for adding lists
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[tool.ruff.lint.per-file-ignores]
|
|
127
|
+
"tests/*" = [
|
|
128
|
+
"ANN", # Annotations
|
|
129
|
+
"S105", # Possible hardcoded password
|
|
130
|
+
"S108", # Temp directory
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
[tool.ruff.lint.pydocstyle]
|
|
134
|
+
convention = "google"
|
|
135
|
+
|
|
136
|
+
[tool.ruff.format]
|
|
137
|
+
docstring-code-format = true
|
|
138
|
+
|
|
139
|
+
[tool.pytest.ini_options]
|
|
140
|
+
addopts = [
|
|
141
|
+
"--strict-config",
|
|
142
|
+
"--strict-markers",
|
|
143
|
+
"--durations=10",
|
|
144
|
+
"--durations-min=1.0",
|
|
145
|
+
]
|
|
146
|
+
testpaths = ["tests"]
|
|
147
|
+
python_files = "test_*.py"
|
|
148
|
+
timeout = 60
|
|
149
|
+
xfail_strict = true
|
|
150
|
+
markers = [
|
|
151
|
+
"unit: Unit tests",
|
|
152
|
+
"component: Component tests",
|
|
153
|
+
"integration: Integration tests",
|
|
154
|
+
"e2e: End-to-end tests",
|
|
155
|
+
"slow: Tests excluded from the fast development test group",
|
|
156
|
+
]
|
|
157
|
+
filterwarnings = [
|
|
158
|
+
"ignore::FutureWarning:numpy.*",
|
|
159
|
+
"ignore::DeprecationWarning:dateutil.*",
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
[tool.ty.environment]
|
|
163
|
+
python-version = "3.11"
|
|
164
|
+
|
|
165
|
+
[tool.ty.src]
|
|
166
|
+
include = ["src/reuters_temperature_storms"]
|
|
167
|
+
exclude = [
|
|
168
|
+
"tests/**",
|
|
169
|
+
"build/**",
|
|
170
|
+
".venv/**",
|
|
171
|
+
".github/**",
|
|
172
|
+
".vscode/**",
|
|
173
|
+
"**/__pycache__",
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[tool.ty.rules]
|
|
177
|
+
invalid-argument-type = "error"
|
|
178
|
+
invalid-return-type = "error"
|
|
179
|
+
invalid-key = "error"
|
|
180
|
+
invalid-assignment = "error"
|
|
181
|
+
invalid-method-override = "error"
|
|
182
|
+
unresolved-attribute = "error"
|
|
183
|
+
possibly-missing-attribute = "error"
|
|
184
|
+
missing-type-argument = "error"
|
|
185
|
+
no-matching-overload = "error"
|
|
186
|
+
unsound-return-statement = "error"
|
|
187
|
+
possibly-unresolved-reference = "warn"
|
|
188
|
+
unused-ignore-comment = "error"
|
|
189
|
+
|
|
190
|
+
[tool.deptry]
|
|
191
|
+
known_first_party = ["reuters_temperature_storms"]
|
|
192
|
+
|
|
193
|
+
[tool.deptry.per_rule_ignores]
|
|
194
|
+
# pandas and GeoPandas use pyarrow for Parquet; fsspec loads optional s3fs.
|
|
195
|
+
DEP002 = ["pyarrow", "s3fs"]
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Check the Reuters names and typing marker in built release distributions."""
|
|
2
|
+
|
|
3
|
+
import csv
|
|
4
|
+
import io
|
|
5
|
+
import tarfile
|
|
6
|
+
import zipfile
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def check_artifacts(directory: Path) -> None:
|
|
13
|
+
"""Verify package assets match the source in one wheel and one sdist.
|
|
14
|
+
|
|
15
|
+
Steps:
|
|
16
|
+
1. Read the bundled source name library and require one wheel and one source distribution.
|
|
17
|
+
2. Compare the packaged CSV bytes with source and require the typing marker in both archives.
|
|
18
|
+
3. Report success only when every required package asset matches.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
directory: Directory containing the built wheel and source distribution.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
None. Raises ClickException when assets are missing or differ.
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
>>> check_artifacts(Path("dist")) # doctest: +SKIP
|
|
28
|
+
"""
|
|
29
|
+
source = Path(__file__).resolve().parents[1] / "src/reuters_temperature_storms"
|
|
30
|
+
names_path = source / "data/names_library.csv"
|
|
31
|
+
expected = names_path.read_bytes()
|
|
32
|
+
rows = list(csv.reader(io.StringIO(expected.decode("utf-8"))))
|
|
33
|
+
if len(rows) != 2381:
|
|
34
|
+
raise click.ClickException("Expected a CSV header and 2,380 Reuters names.")
|
|
35
|
+
wheels = list(directory.glob("*.whl"))
|
|
36
|
+
sdists = list(directory.glob("*.tar.gz"))
|
|
37
|
+
if len(wheels) != 1 or len(sdists) != 1:
|
|
38
|
+
raise click.ClickException(
|
|
39
|
+
"Expected exactly one wheel and one source distribution."
|
|
40
|
+
)
|
|
41
|
+
csv_member = f"reuters_temperature_storms/data/{names_path.name}"
|
|
42
|
+
with zipfile.ZipFile(wheels[0]) as wheel:
|
|
43
|
+
if csv_member not in wheel.namelist():
|
|
44
|
+
raise click.ClickException("Wheel is missing the Reuters names CSV.")
|
|
45
|
+
if wheel.read(csv_member) != expected:
|
|
46
|
+
raise click.ClickException("Wheel names CSV differs from the source.")
|
|
47
|
+
if "reuters_temperature_storms/py.typed" not in wheel.namelist():
|
|
48
|
+
raise click.ClickException("Wheel is missing the typing marker.")
|
|
49
|
+
with tarfile.open(sdists[0]) as sdist:
|
|
50
|
+
prefixes = {member.name.split("/", 1)[0] for member in sdist.getmembers()}
|
|
51
|
+
if len(prefixes) != 1:
|
|
52
|
+
raise click.ClickException(
|
|
53
|
+
"Expected one source-distribution root directory."
|
|
54
|
+
)
|
|
55
|
+
prefix = prefixes.pop()
|
|
56
|
+
if f"{prefix}/src/{csv_member}" not in sdist.getnames():
|
|
57
|
+
raise click.ClickException(
|
|
58
|
+
"Source distribution is missing the Reuters names CSV."
|
|
59
|
+
)
|
|
60
|
+
csv_file = sdist.extractfile(f"{prefix}/src/{csv_member}")
|
|
61
|
+
if csv_file is None or csv_file.read() != expected:
|
|
62
|
+
raise click.ClickException(
|
|
63
|
+
"Source-distribution names CSV differs from the source."
|
|
64
|
+
)
|
|
65
|
+
if f"{prefix}/src/reuters_temperature_storms/py.typed" not in sdist.getnames():
|
|
66
|
+
raise click.ClickException(
|
|
67
|
+
"Source distribution is missing the typing marker."
|
|
68
|
+
)
|
|
69
|
+
click.echo("Wheel and sdist preserve the exact Reuters CSV and typing marker.")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@click.command()
|
|
73
|
+
@click.argument("directory", type=click.Path(path_type=Path, exists=True))
|
|
74
|
+
def main(directory: Path) -> None:
|
|
75
|
+
"""Verify a built distribution directory.
|
|
76
|
+
|
|
77
|
+
Steps:
|
|
78
|
+
1. Accept an existing distribution directory through Click.
|
|
79
|
+
2. Run the wheel and source-distribution asset checks and report the result.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
directory: Directory containing the wheel and source distribution.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
None. Prints success or exits with an error through Click.
|
|
86
|
+
|
|
87
|
+
Examples:
|
|
88
|
+
$ uv run python scripts/check_release_artifacts.py dist
|
|
89
|
+
"""
|
|
90
|
+
check_artifacts(directory)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
main()
|