cdo-toolkit 0.1.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.
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ dist/
5
+ *.egg-info/
6
+ logs/
7
+ .venv/
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, Institut Pierre-Simon Laplace (IPSL) and contributors
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: cdo-toolkit
3
+ Version: 0.1.0
4
+ Summary: CDO-based NetCDF regridding with chunking, parallel workers, and optional CMIP filename helpers
5
+ Project-URL: Repository, https://github.com/orlando-code/cdo-toolkit
6
+ Project-URL: Documentation, https://github.com/orlando-code/cdo-toolkit#readme
7
+ Project-URL: Issues, https://github.com/orlando-code/cdo-toolkit/issues
8
+ Author-email: Orlando Timmerman <rt582@cam.ac.uk>
9
+ License: BSD-3-Clause
10
+ License-File: LICENSE
11
+ Keywords: cdo,climate,netcdf,regridding,xarray
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: cdo>=1.6.1
22
+ Requires-Dist: numpy>=1.24.0
23
+ Requires-Dist: psutil>=7.2.2
24
+ Requires-Dist: rich>=12.6.0
25
+ Requires-Dist: xarray>=2023.1.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=8.3.3; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # cdo-toolkit
31
+
32
+ CDO-based NetCDF regridding toolkit: weight caching, time-chunked processing, parallel workers, Rich progress UI, and optional surface/seafloor level extraction.
33
+
34
+ Works with **general NetCDF files**. CMIP6 filename helpers (`tos_Omon_...` variable filtering, `nominal_resolution` metadata) live in `cdo_toolkit.cmip` but are optional.
35
+
36
+ ## Requirements
37
+
38
+ - Python ≥ 3.10
39
+ - [CDO](https://code.mpimet.mpg.de/projects/cdo) binary on `PATH` (e.g. `conda install -c conda-forge cdo`)
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ pip install cdo-toolkit
45
+ # editable from source
46
+ pip install -e .
47
+ ```
48
+
49
+ ## CLI
50
+
51
+ ```bash
52
+ cdo-toolkit /path/to/data -o /path/to/out -r 1.0 1.0 -w 4
53
+ python -m cdo_toolkit /path/to/file.nc --extract-surface
54
+ ```
55
+
56
+ ## Python API
57
+
58
+ ```python
59
+ from pathlib import Path
60
+ from cdo_toolkit import CDORegridPipeline, regrid_directory, regrid_single_file
61
+
62
+ regrid_directory(Path("data/"), target_resolution=(1.0, 1.0), max_workers=8)
63
+ ```
64
+
65
+ ## Package layout
66
+
67
+ | Module | Role |
68
+ |--------|------|
69
+ | `pipeline` | `CDORegridPipeline` core |
70
+ | `api` | High-level `regrid_directory`, `regrid_single_file`, … |
71
+ | `workers` | Process-pool worker entrypoints |
72
+ | `ui` | Rich progress bars |
73
+ | `cmip` | Optional CMIP6 filename/metadata helpers |
74
+ | `paths` | Weight-cache and intermediate-file path helpers |
75
+
76
+ ## License
77
+
78
+ BSD-3-Clause
@@ -0,0 +1,49 @@
1
+ # cdo-toolkit
2
+
3
+ CDO-based NetCDF regridding toolkit: weight caching, time-chunked processing, parallel workers, Rich progress UI, and optional surface/seafloor level extraction.
4
+
5
+ Works with **general NetCDF files**. CMIP6 filename helpers (`tos_Omon_...` variable filtering, `nominal_resolution` metadata) live in `cdo_toolkit.cmip` but are optional.
6
+
7
+ ## Requirements
8
+
9
+ - Python ≥ 3.10
10
+ - [CDO](https://code.mpimet.mpg.de/projects/cdo) binary on `PATH` (e.g. `conda install -c conda-forge cdo`)
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install cdo-toolkit
16
+ # editable from source
17
+ pip install -e .
18
+ ```
19
+
20
+ ## CLI
21
+
22
+ ```bash
23
+ cdo-toolkit /path/to/data -o /path/to/out -r 1.0 1.0 -w 4
24
+ python -m cdo_toolkit /path/to/file.nc --extract-surface
25
+ ```
26
+
27
+ ## Python API
28
+
29
+ ```python
30
+ from pathlib import Path
31
+ from cdo_toolkit import CDORegridPipeline, regrid_directory, regrid_single_file
32
+
33
+ regrid_directory(Path("data/"), target_resolution=(1.0, 1.0), max_workers=8)
34
+ ```
35
+
36
+ ## Package layout
37
+
38
+ | Module | Role |
39
+ |--------|------|
40
+ | `pipeline` | `CDORegridPipeline` core |
41
+ | `api` | High-level `regrid_directory`, `regrid_single_file`, … |
42
+ | `workers` | Process-pool worker entrypoints |
43
+ | `ui` | Rich progress bars |
44
+ | `cmip` | Optional CMIP6 filename/metadata helpers |
45
+ | `paths` | Weight-cache and intermediate-file path helpers |
46
+
47
+ ## License
48
+
49
+ BSD-3-Clause
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "cdo-toolkit"
7
+ version = "0.1.0"
8
+ description = "CDO-based NetCDF regridding with chunking, parallel workers, and optional CMIP filename helpers"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "BSD-3-Clause" }
12
+ authors = [{ name = "Orlando Timmerman", email = "rt582@cam.ac.uk" }]
13
+ keywords = ["netcdf", "regridding", "cdo", "climate", "xarray"]
14
+ classifiers = [
15
+ "License :: OSI Approved :: BSD License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Intended Audience :: Science/Research",
22
+ "Topic :: Scientific/Engineering",
23
+ ]
24
+ dependencies = [
25
+ "cdo>=1.6.1",
26
+ "numpy>=1.24.0",
27
+ "psutil>=7.2.2",
28
+ "rich>=12.6.0",
29
+ "xarray>=2023.1.0",
30
+ ]
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest>=8.3.3",
35
+ ]
36
+
37
+ [project.scripts]
38
+ cdo-toolkit = "cdo_toolkit.cli:main"
39
+
40
+ [project.urls]
41
+ Repository = "https://github.com/orlando-code/cdo-toolkit"
42
+ Documentation = "https://github.com/orlando-code/cdo-toolkit#readme"
43
+ Issues = "https://github.com/orlando-code/cdo-toolkit/issues"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/cdo_toolkit"]
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
50
+ addopts = "-ra -q"
@@ -0,0 +1,44 @@
1
+ # generated by rye
2
+ # use `rye lock` or `rye sync` to update this lockfile
3
+ #
4
+ # last locked with the following flags:
5
+ # pre: false
6
+ # features: []
7
+ # all-features: false
8
+ # with-sources: false
9
+ # generate-hashes: false
10
+ # universal: false
11
+
12
+ -e file:.
13
+ cdo==1.6.1
14
+ # via cdo-toolkit
15
+ markdown-it-py==4.2.0
16
+ # via rich
17
+ mdurl==0.1.2
18
+ # via markdown-it-py
19
+ numpy==2.2.6
20
+ # via cdo-toolkit
21
+ # via pandas
22
+ # via xarray
23
+ packaging==26.2
24
+ # via cdo
25
+ # via xarray
26
+ pandas==2.3.3
27
+ # via xarray
28
+ psutil==7.2.2
29
+ # via cdo-toolkit
30
+ pygments==2.20.0
31
+ # via rich
32
+ python-dateutil==2.9.0.post0
33
+ # via pandas
34
+ pytz==2026.2
35
+ # via pandas
36
+ rich==15.0.0
37
+ # via cdo-toolkit
38
+ six==1.17.0
39
+ # via cdo
40
+ # via python-dateutil
41
+ tzdata==2026.2
42
+ # via pandas
43
+ xarray==2025.6.1
44
+ # via cdo-toolkit
@@ -0,0 +1,44 @@
1
+ # generated by rye
2
+ # use `rye lock` or `rye sync` to update this lockfile
3
+ #
4
+ # last locked with the following flags:
5
+ # pre: false
6
+ # features: []
7
+ # all-features: false
8
+ # with-sources: false
9
+ # generate-hashes: false
10
+ # universal: false
11
+
12
+ -e file:.
13
+ cdo==1.6.1
14
+ # via cdo-toolkit
15
+ markdown-it-py==4.2.0
16
+ # via rich
17
+ mdurl==0.1.2
18
+ # via markdown-it-py
19
+ numpy==2.2.6
20
+ # via cdo-toolkit
21
+ # via pandas
22
+ # via xarray
23
+ packaging==26.2
24
+ # via cdo
25
+ # via xarray
26
+ pandas==2.3.3
27
+ # via xarray
28
+ psutil==7.2.2
29
+ # via cdo-toolkit
30
+ pygments==2.20.0
31
+ # via rich
32
+ python-dateutil==2.9.0.post0
33
+ # via pandas
34
+ pytz==2026.2
35
+ # via pandas
36
+ rich==15.0.0
37
+ # via cdo-toolkit
38
+ six==1.17.0
39
+ # via cdo
40
+ # via python-dateutil
41
+ tzdata==2026.2
42
+ # via pandas
43
+ xarray==2025.6.1
44
+ # via cdo-toolkit
@@ -0,0 +1,47 @@
1
+ """CDO-based NetCDF regridding toolkit."""
2
+
3
+ from cdo_toolkit.api import (
4
+ extract_seafloor_single_file,
5
+ regrid_directory,
6
+ regrid_directory_both_levels,
7
+ regrid_large_files,
8
+ regrid_single_file,
9
+ regrid_single_file_both_levels,
10
+ regrid_single_file_extreme_levels,
11
+ )
12
+ from cdo_toolkit.cmip import (
13
+ filter_files_by_variables,
14
+ get_cmip_variable_name,
15
+ parse_variable_list,
16
+ pick_representative_file,
17
+ representative_files_by_directory,
18
+ )
19
+ from cdo_toolkit.errors import default_log_dir, init_regrid_error_log, log_regrid_error
20
+ from cdo_toolkit.paths import is_intermediate_nc, is_weights_or_cache_file, weight_cache_dir_for_input
21
+ from cdo_toolkit.pipeline import CDORegridPipeline
22
+ from cdo_toolkit.workers import process_single_file_standalone
23
+
24
+ __all__ = [
25
+ "CDORegridPipeline",
26
+ "default_log_dir",
27
+ "extract_seafloor_single_file",
28
+ "filter_files_by_variables",
29
+ "get_cmip_variable_name",
30
+ "init_regrid_error_log",
31
+ "is_intermediate_nc",
32
+ "is_weights_or_cache_file",
33
+ "log_regrid_error",
34
+ "parse_variable_list",
35
+ "pick_representative_file",
36
+ "process_single_file_standalone",
37
+ "representative_files_by_directory",
38
+ "regrid_directory",
39
+ "regrid_directory_both_levels",
40
+ "regrid_large_files",
41
+ "regrid_single_file",
42
+ "regrid_single_file_both_levels",
43
+ "regrid_single_file_extreme_levels",
44
+ "weight_cache_dir_for_input",
45
+ ]
46
+
47
+ __version__ = "0.1.0"
@@ -0,0 +1,6 @@
1
+ """Allow ``python -m cdo_toolkit``."""
2
+
3
+ from cdo_toolkit.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()