Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9bd8245
adjustments to package metadata and dependencies
Zeitsperre Apr 22, 2026
771aa26
add clisops-core core functionality
Zeitsperre Apr 27, 2026
a5606a2
update pre-commit hooks, address new issues
Zeitsperre Apr 27, 2026
51a8b51
optional dask
Zeitsperre Apr 27, 2026
7ee6540
drop Python3.10, adjust deps, disable mypy
Zeitsperre Apr 28, 2026
cc8b275
add name
Zeitsperre Apr 28, 2026
e1e97fd
WIP - migrate testing for core subset, update deps, testdata fetching
Zeitsperre May 5, 2026
aa1044b
linting adjustments
Zeitsperre May 12, 2026
4d11e26
add pytest-loguru, better handle xesmf
Zeitsperre May 12, 2026
1235854
add testing data geometries
Zeitsperre Jun 1, 2026
1ceaeea
move version to own file, bump sphinx, adjust loguru
Zeitsperre Jun 1, 2026
9b1f8df
whitespace fixes
Zeitsperre Jun 1, 2026
6b10b86
add create_weights_mask
Zeitsperre Jun 1, 2026
194af84
adjust tests
Zeitsperre Jun 1, 2026
f71def7
typing fixes
Zeitsperre Jun 1, 2026
ad5ed34
add missing fixtures
Zeitsperre Jun 1, 2026
664cf41
migrate more utils
Zeitsperre Jun 1, 2026
30da056
add regrid
Zeitsperre Jun 1, 2026
177ab52
loguru fixes
Zeitsperre Jun 1, 2026
e6d85fe
linting
Zeitsperre Jun 1, 2026
103b146
ruff reformatting
Zeitsperre Jun 1, 2026
8148a30
prek fixes
Zeitsperre Jun 2, 2026
57eadd2
add roocs-grids, filelock staging, encoding funcs
Zeitsperre Jun 5, 2026
f4b9cb8
bump minimum xarray
Zeitsperre Jun 5, 2026
06d210b
remove version handler
Zeitsperre Jun 5, 2026
8f6353f
WIP - try using standard filelock object
Zeitsperre Jun 5, 2026
3c8a494
migrate new subset_gridpoint
tlogan2000 Jun 10, 2026
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
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ignore =
E,
F,
RST210,
RST213,
W503
per-file-ignores =
rst-roles =
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
strategy:
matrix:
os: [ 'ubuntu-latest' ]
python-version: [ 3.10", "3.11", "3.12", "3.13", "3.14" ]
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
defaults:
run:
shell: bash -l {0}
Expand Down Expand Up @@ -139,6 +139,7 @@ jobs:
parallel: true

finish:
name: Finish
needs:
- test-pypi
- test-conda
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repos:
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.9
rev: v0.15.12
hooks:
- id: ruff-check
args: [ '--fix', '--show-fixes' ]
Expand All @@ -61,10 +61,10 @@ repos:
rev: v2.16
hooks:
- id: vulture
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.20.2
# hooks:
# - id: mypy
- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
hooks:
Expand All @@ -82,12 +82,12 @@ repos:
- id: check-github-workflows
- id: check-readthedocs
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.23.1
rev: v1.24.1
hooks:
- id: zizmor
args: [ '--config=.zizmor.yml' ]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
rev: v8.30.1
hooks:
- id: gitleaks
- repo: meta
Expand Down
12 changes: 10 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ Development Lead
Co-Developers
-------------

None yet. Why not be the first?
* Ag Stephens <ag.stephens@stfc.ac.uk> `@agstephens <https://github.com/agstephens>`_
* Carsten Ehbrecht <ehbrecht@dkrz.de> `@cehbrecht <https://github.com/cehbrecht>`_
* Martin Schupfner <schupfner@dkrz.de> `@sol1105 <https://github.com/sol1105>`_
* Pascal Bourgault <bourgault.pascal@ouranos.ca> `@aulemahal <https://github.com/aulemahal>`_

Contributors
------------

None yet. Why not be the first?
* Marco Braun <braun.marco@ouranos.ca> `@vindelico <https://github.com/vindelico>`_
* Charles Gauthier <gauthier.charles@ouranos.ca> `@charlesgauthier-udm <https://github.com/charlesgauthier-udm>`_
* David Huard <huard.david@ouranos.ca> `@huard <https://github.com/huard>`_
* Travis Logan <logan.travis@ouranos.ca> `@tlogan2000 <https://github.com/tlogan2000>`_
* Gabriel Rondeau-Genesse <rondeau-genesse.gabriel@ouranos.ca> `@RondeauG <https://github.com/RondeauG>`_
* Eleanor Smith `@ellesmith88 <https://github.com/ellesmith88>`_
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ contact:
email: 'smith.trevorj@ouranos.ca'
orcid: "https://orcid.org/0000-0001-5393-8359"
repository-code: "https://github.com/roocs/clisops-core"
abstract: "A Python package for peforming core subsetting and spatial operations in clisops"
abstract: "A Python package for performing core subsetting and spatial operations in clisops."
license: "BSD-3-Clause"
version: "0.1.0"
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ clisops-core
| Development Status | |status| |build| |coveralls| |
+----------------------------+-----------------------------------------------------+

A Python package for peforming core subsetting and spatial operations in clisops
A Python package for performing core subsetting and spatial operations in clisops.

* Free software: BSD license
* Documentation: https://clisops-core.readthedocs.io.
Expand Down
20 changes: 19 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python >=3.10,<3.15
- python >=3.11,<3.15
- bottleneck >=1.3.1
- cftime >=1.4.1
- cf-xarray
- filelock >=3.15.4
- geopandas >=1.0.0
- loguru >=0.5.3
- numpy >=2.2
- packaging >=23.2
- pandas >=2.0
- pooch >=1.8.0
- xarray >=2025.6.0
# Performance
- dask >=2024.12
# Extras
- roocs-grids >=0.1.2
- xesmf >=0.9.2
# Dev tools and testing
- pip >=26.0.1
- bump-my-version >=1.3.0
Expand All @@ -18,6 +34,8 @@ dependencies:
- prek >=0.3.0
- pytest >=9.0.2
- pytest-cov >=7.0.0
- pytest-loguru >=0.4.1
- pytest-xdist >=3.2.0
- ruff >=0.15.9
- tox >=4.52.0
- tox-gh >=1.7.1
Expand Down
3 changes: 2 additions & 1 deletion environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ channels:
dependencies:
- python >=3.12,<3.13
# Docs
- sphinx >=8.2
- nbsphinx >=0.9.8
- sphinx >=9.0
- sphinx-codeautolink >=0.16.2
- sphinx-copybutton >=0.5.2
- sphinx-intl
Expand Down
60 changes: 48 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,26 @@ lint = [
"vulture >=2.14",
"yamllint >=1.38.0"
]
io = [
"h5netcdf >=1.5.0",
"h5py>=3.12.1"
]
test = [
# Base testing support
"coverage[toml] >=7.13.4",
"pytest >=9.0.2",
"pytest-cov >=7.0.0"
"pytest-cov >=7.0.0",
"pytest-loguru >=0.4.1",
"pytest-xdist >=3.2.0",
{include-group = "io"}
]
docs = [
# Documentation and example support
"ipykernel",
"ipython >=8.10.0",
"jupyter_client",
"nbsphinx >=0.9.8",
"sphinx >=8.2.0",
"sphinx >=9.0.0",
"sphinx-codeautolink >=0.16.2",
"sphinx-copybutton >=0.5.2",
"sphinx-intl",
Expand Down Expand Up @@ -59,7 +66,7 @@ maintainers = [
{name = "Trevor James Smith", email = "smith.trevorj@ouranos.ca"}
]
readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">=3.10.0"
requires-python = ">=3.11.0"
keywords = ["clisops-core"]
license = "BSD-3-Clause"
license-files = ["LICENSE"]
Expand All @@ -70,7 +77,6 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand All @@ -80,12 +86,28 @@ classifiers = [
]
dynamic = ["description", "version"]
dependencies = [
"bottleneck >=1.3.1",
"cftime >=1.4.1",
"cf-xarray",
"filelock >=3.15.4",
"geopandas >=1.0.0",
"loguru >=0.5.3",
"numpy >=2.2",
"packaging >=23.2",
"pandas >=2.0",
"pooch >=1.8.0",
"pyproj",
"scipy",
"shapely",
"xarray >=2025.6.0"
]

[project.optional-dependencies]
extras = []


performance = ["dask >=2024.12"]
regrid = [
"roocs_grids >=0.1.2",
"xesmf >=0.9.2"
]

[project.urls]
# "Homepage" = "https://clisops-core.readthedocs.io/"
Expand Down Expand Up @@ -145,7 +167,7 @@ regex = true
replace = "version: \"{new_version}\""

[[tool.bumpversion.files]]
filename = "src/clisops_core/__init__.py"
filename = "src/clisops_core/_version.py"
search = "__version__ = \"{current_version}\""
replace = "__version__ = \"{new_version}\""

Expand All @@ -170,7 +192,8 @@ values = [
]

[tool.codespell]
ignore-words-list = "astroid,socio-economic,thirdparty"
ignore-words-list = "astroid,scrip,socio-economic,thirdparty"
skip = "docs/_build"

[tool.coverage.paths]
source = ["src/clisops_core/", "*/site-packages/clisops_core/"]
Expand All @@ -182,7 +205,10 @@ source = ["clisops_core"]

[tool.deptry]
extend_exclude = ["extras"]
pep621_dev_dependency_groups = ["extras"]

[tool.deptry.per_rule_ignores]
DEP001 = ["dask"]
DEP002 = ["bottleneck"]

[tool.flit.sdist]
include = [
Expand All @@ -193,6 +219,7 @@ include = [
"LICENSE",
"Makefile",
"README.rst",
"clisops_core/**/*.py",
"environment-dev.yml",
"environment-docs.yml",
"docs/_static/_images/*.gif",
Expand Down Expand Up @@ -267,12 +294,21 @@ minversion = "9.0"
addopts = [
"-ra",
"--color=yes",
"--verbose"
"--numprocesses=0",
"--maxprocesses=8",
"--dist=worksteal",
"--strict-config",
"--strict-markers"
]
filterwarnings = ["ignore::UserWarning"]
testpaths = [
"tests"
]
markers = [
"online: mark test to need internet connection",
"slow: mark test to be slow",
"thread_unsafe: mark test to be thread unsafe"
]

[tool.ruff]
src = ["clisops_core"]
Expand Down Expand Up @@ -335,7 +371,7 @@ lines-after-imports = 2
no-lines-before = ["future", "standard-library"]

[tool.ruff.lint.mccabe]
max-complexity = 15
max-complexity = 30

[tool.ruff.lint.per-file-ignores]
"docs/**" = ["E402"]
Expand Down
35 changes: 31 additions & 4 deletions src/clisops_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""A Python package for peforming core subsetting and spatial operations in clisops"""
"""A Python package for performing core subsetting and spatial operations in clisops."""

###################################################################################
# BSD 3-Clause License
Expand Down Expand Up @@ -32,6 +32,33 @@
# OF THE POSSIBILITY OF SUCH DAMAGE.
###################################################################################

__author__ = """Trevor James Smith"""
__email__ = "smith.trevorj@ouranos.ca"
__version__ = "0.1.0"
import warnings

from loguru import logger

from clisops_core._version import __version__ as __version__
from clisops_core.subset import (
create_mask,
subset_bbox,
subset_gridpoint,
subset_level,
subset_level_by_values,
subset_shape,
subset_time,
subset_time_by_components,
subset_time_by_values,
)


def showwarning(message, *args, **kwargs): # numpydoc ignore=PR01
"""Inject warnings from `warnings.warn` into `loguru`."""
logger.warning(message)
showwarning_(message, *args, **kwargs)


showwarning_ = warnings.showwarning
warnings.showwarning = showwarning

# Disable logging for clisops_core and remove the logger that is instantiated on import
logger.disable("clisops_core")
logger.remove()
10 changes: 10 additions & 0 deletions src/clisops_core/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""The version information for the CLISOPS-core package."""
# This information is located in its own file so that it can be loaded
# without importing the main package when its dependencies are not installed.
# See: https://packaging.python.org/guides/single-sourcing-package-version

__author__ = """Trevor James Smith"""
__email__ = "smith.trevorj@ouranos.ca"
__copyright__ = "Copyright 2026. United Kingdom Research and Innovation and Ouranos Inc."
__license__ = "BSD-3-Clause"
__version__ = "0.1.0"
1 change: 0 additions & 1 deletion src/clisops_core/clisops_core.py

This file was deleted.

Loading
Loading