Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
94 changes: 90 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ on:
pull_request:
branches:
- "*"
release:
branch: main
types: [released]

jobs:
check:
name: Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the Repository
uses: actions/checkout@v4
Expand All @@ -21,9 +26,23 @@ jobs:
with:
args: check

spelling:
name: Spellcheck
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the Repository
uses: actions/checkout@v7

- name: Spellcheck repo
uses: crate-ci/typos@v1

fmt:
name: Formatting
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the Repository
uses: actions/checkout@v4
Expand All @@ -33,21 +52,88 @@ jobs:
with:
args: "format --diff --check"

build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the Repository
uses: actions/checkout@v7

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Build all packages
run: uv build --all-packages

- name: List the built dist files
run: ls -lh dist/

- name: Upload the package sdist and wheels
uses: actions/upload-artifact@v7
with:
name: dist
path: dist
retention-days: 1

mypy:
name: Typecheck
runs-on: ubuntu-latest
permissions:
contents: read
needs: build
steps:
- name: Checkout the Repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Setup Python
run: uv python install
- name: Download the dist artifact
uses: actions/download-artifact@v8
with:
name: dist
path: dist

- name: Install the typing dependencies
run: |
uv sync --refresh --no-install-workspace \
--all-groups

- name: Install the package
run: uv sync && uv pip install .
- name: Install the workspace packages
run: |
uv pip install dist/*.whl

- name: Typecheck the package
run: uv run mypy -p climatebenchpress.compressor

publish:
name: Publish to PyPi
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: read
id-token: write
if: ${{ github.event_name == 'release' }}
needs:
# require all jobs to succeed
- check
- spelling
- fmt
- build # includes the dist artifact
- mypy
steps:
- name: Download the dist artifact
uses: actions/download-artifact@v8
with:
name: dist
path: dist

- name: List the built dist files
run: ls -lh dist/

- name: Publish the packages
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@

**/__pycache__
**/*.egg-info
**/.DS_Store
**/.ipynb_checkpoints
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default.extend-identifiers]
ower = "ower"
39 changes: 33 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "climatebenchpress.compressor"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
name = "climatebenchpress-compressor"
version = "1.0.0"
requires-python = ">=3.12"
authors = [
{ name = "Tim Reichelt", email = "tim.reichelt@physics.ox.ac.uk" },
{ name = "Juniper Tyree", email = "juniper.tyree@helsinki.fi" },
]
description = "ClimateBenchPress compression benchmark"
readme = "README.md"
license = "MPL-2.0"
keywords = ["climate", "compression", "benchmark", "compressors", "weather"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Atmospheric Science",
"Topic :: System :: Archiving :: Compression",
"Typing :: Typed",
]

dependencies = [
"astropy~=7.2.0",
"cartopy~=0.24.1",
Expand Down Expand Up @@ -52,8 +79,8 @@ dev = [
"types-seaborn~=0.13.2.20250111",
]

[tool.setuptools.packages.find]
where = ["src"]
[tool.hatch.build.targets.wheel]
packages = ["src/climatebenchpress"]

[tool.setuptools.package-data]
"climatebenchpress.compressor" = ["py.typed"]
Expand Down
2 changes: 1 addition & 1 deletion src/climatebenchpress/compressor/compressors/jpeg2000.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def abs_bound_codec(
# Here we use the formula for the PSNR (https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio)
# to convert between the absolute error and the PSNR value.
# The original PSNR formula uses the root mean square error (RMSE),
# therefore JPEG does not guaruantee pointwise error bounds but only
# therefore JPEG does not guarantee pointwise error bounds but only
# average error bounds.
psnr = 20 * (math.log10(data_range) - math.log10(error_bound))

Expand Down
Loading