Rust-accelerated drop-in replacements for geocat-comp computational functions
Project description
geocat-rs
Rust-accelerated drop-in replacements for GeoCAT-comp computational functions.
GeoCAT-comp is NCAR's Python replacement for NCL. geocat-rs accelerates the compute-heavy functions using Rust + rayon parallelism, while leaving the xarray/scipy wrapper functions alone (they're already fast).
Performance
Real-world benchmarks on CESM-like 3D atmospheric fields. Every result verified identical to geocat.comp.
The #1 workflow: interp_hybrid_to_pressure
The function CESM researchers use most — converting hybrid-sigma vertical coordinates to standard pressure levels (replacing NCL's vinth2p).
| Grid size | geocat.comp | geocat-rs | Speedup | Max diff |
|---|---|---|---|---|
| 32 lev x 192 lat x 288 lon (1.8M pts) | 161 ms | 21 ms | 7.5x | 0.0 |
| 32 lev x 500 lat x 500 lon (8M pts) | 724 ms | 95 ms | 7.6x | 0.0 |
Tested with 14 drop-in compatibility tests: standard/full CESM grids, custom levels, multiple timesteps, mountain pressure extremes, 4 random seeds. All pass.
Meteorology functions on 3D fields (12.5M elements)
| Function | geocat.comp | geocat-rs | Speedup |
|---|---|---|---|
| Dewpoint temperature | 189 ms | 12 ms | 16x |
| Relative humidity (table lookup) | 353 ms | 17 ms | 21x |
| Relative humidity over water | 223 ms | 16 ms | 14x |
| Saturation vapor pressure | 6.1 ms | 4.5 ms | 1.4x |
WGS84 gradient functions (250K grid points)
| Function | geocat.comp | geocat-rs | Speedup |
|---|---|---|---|
| rad_lat_wgs84 (degree-48 polynomial) | 67 ms | 1.0 ms | 66x |
| arc_lat_wgs84 (degree-49 polynomial) | 69 ms | 1.0 ms | 70x |
Overall across all accelerated functions
| geocat.comp | geocat-rs | |
|---|---|---|
| Total time | 908 ms | 53 ms |
| Overall speedup | 17x |
Accuracy
All functions verified against geocat.comp to machine precision:
| Test suite | Tests | Result |
|---|---|---|
| interp_hybrid_to_pressure compatibility | 14 | All pass (max diff: 0.0) |
| Meteorology functions (scalar + array) | 20 | All pass (rtol < 1e-12) |
| WGS84 gradient functions | 6 | All pass (rtol < 1e-10) |
| Delta pressure | 1 | Pass |
| Total | 44 | All pass |
pytest tests/ -v
python tests/bench_interp_hybrid.py
python tests/bench_workflow.py
Installation
pip install geocat-rs
Requires metrust for interp_hybrid_to_pressure (uses its Rust interpolation engine).
Usage
interp_hybrid_to_pressure (drop-in replacement)
# Before
from geocat.comp import interp_hybrid_to_pressure
# After (same API, 7.5x faster)
from geocat_rs.interp_hybrid import interp_hybrid_to_pressure
# Usage is identical
output = interp_hybrid_to_pressure(
data, ps, hyam, hybm,
new_levels=new_levels,
lev_dim='lev',
)
Meteorology (array functions via Rust + rayon)
from geocat_rs._geocat_rs import meteorology as met
# Scalar
td = met.dewtemp_scalar(300.0, 50.0) # T(K), RH(%) -> Td(K)
hi = met.heat_index_scalar(95.0, 50.0, False) # T(F), RH(%) -> HI(F)
rh = met.relhum_scalar(300.0, 0.01, 101325.0) # T(K), w(kg/kg), P(Pa) -> RH(%)
# Array (rayon-parallel)
import numpy as np
td_array = met.dewtemp_array(temp_k, rh_pct)
rh_array = met.relhum_array(temp_k, mixr, pressure)
svp_array = met.saturation_vapor_pressure_array(temp_f)
WGS84 gradient (66-70x faster)
from geocat_rs._geocat_rs import gradient as grad
radius = grad.rad_lat_wgs84_array(lat_grid.ravel()) # meters
arc = grad.arc_lat_wgs84_array(lat_grid.ravel()) # meters from equator
What's accelerated
| Function | Source | Speedup | Notes |
|---|---|---|---|
interp_hybrid_to_pressure |
Rust column interpolator + rayon | 7.5x | #1 most-used geocat function |
dewtemp |
Rust + rayon | 16x | Dutton formula |
relhum (table) |
Rust + rayon | 21x | NCL lookup table |
relhum_ice / relhum_water |
Rust + rayon | 14x | Alduchov/Murray |
heat_index |
Rust + rayon | -- | NWS Rothfusz regression |
saturation_vapor_pressure |
Rust + rayon | 1.4x | Tetens/FAO-56 |
saturation_vapor_pressure_slope |
Rust + rayon | -- | FAO-56 Eq. 13 |
psychrometric_constant |
Rust + rayon | -- | FAO-56 Eq. 8 |
max_daylight |
Rust + rayon | -- | FAO-56 solar declination |
rad_lat_wgs84 |
Rust + rayon | 66x | Degree-48 polynomial |
arc_lat_wgs84 |
Rust + rayon | 70x | Degree-49 polynomial |
arc_lon_wgs84 |
Rust + rayon | -- | Radius * cos(lat) * lon |
temp_extrapolate |
Rust + rayon | -- | ECMWF Eq. 16 |
geo_height_extrapolate |
Rust + rayon | -- | ECMWF Eq. 15 |
delta_pressure_1d |
Rust | -- | Simmons & Burridge |
What's NOT accelerated (and why)
| Function | Why not |
|---|---|
climatology_average, calendar_average, month_to_season |
xarray groupby — already optimized |
eofunc_eofs, eofunc_pcs |
Wraps eofs library (LAPACK) |
fourier_filter, fourier_*_pass |
numpy FFT (FFTW backend) |
decomposition, recomposition |
scipy spherical harmonics |
interp_multidim, interp_sigma_to_hybrid |
Wraps metpy (already Rust via metrust) |
License
Apache-2.0 (same as GeoCAT-comp)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geocat_rs-0.1.1.tar.gz.
File metadata
- Download URL: geocat_rs-0.1.1.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66813304d38090d97e7869cbc7ef592a2516e729572ce267e9786073131a390f
|
|
| MD5 |
6714b2dc670879eb56c410ca3e2c186d
|
|
| BLAKE2b-256 |
e674fc67c13cea27dd6189068120deaf1afb14a3ee139308ed54dceca62db6d4
|
File details
Details for the file geocat_rs-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 431.8 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cbf8d347baa6025ae08e5ed9c0a5b30f3c357d9fb089cf6454ccbaa61843173
|
|
| MD5 |
b1713163a1097b0cca0f92acdfdd2d99
|
|
| BLAKE2b-256 |
4184a1b46e9a609db92b699418fe9c1add7e03a5fc3faaf422841a0fc9f564a5
|
File details
Details for the file geocat_rs-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 423.5 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c03d1aa4e907153f59307b091458fb941ddf937f7c2b37e0b5edd40ac662355
|
|
| MD5 |
a93c60370e22c8699b8cef709f3d3e49
|
|
| BLAKE2b-256 |
5981d93bd3b8fdab63f250de78fac42a0306d9ddc0341504dedef1b66d0df826
|
File details
Details for the file geocat_rs-0.1.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 274.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7b6069b4787e29c427b81259a08a922180d22df10762473abeabf1a9622677f
|
|
| MD5 |
75e7e3d4c9aa6c60eb3ae9cc2c0f6a13
|
|
| BLAKE2b-256 |
092a4a1cc076298200ca0861c2b2a4883ba056246c6e555ed922c749f457352c
|
File details
Details for the file geocat_rs-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 432.8 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5932bc6786a8b6cd90ca9d7abda38ef89d62e0470bdcd4d0385fe14f73e7eb33
|
|
| MD5 |
b2839708dc0d3861b8cb22992f40fcef
|
|
| BLAKE2b-256 |
57add9648e25d83d4d04a7d43230ef7f976af339a6b51873946f6b304577f6ce
|
File details
Details for the file geocat_rs-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 424.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc4fd28ca3fd666a423f8b61b0204b5c419043246ebca20a5398d2b9932ddd6e
|
|
| MD5 |
2b0d0e8a03e7c1c83d94ef6465f531e0
|
|
| BLAKE2b-256 |
13ac2322344d2b0c5d345a0390891bc39c121cb39c22cb95cfb9f696c09edd2f
|
File details
Details for the file geocat_rs-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 376.5 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a54a4449c66119494aa9abde203d2a003a38ad4b68729e04fd5dd23e1e0eeae
|
|
| MD5 |
8217b1fc5565689dd555e0819590dfaf
|
|
| BLAKE2b-256 |
ba3780e141ba67376a60a0f7935fd484e535a94018fab7354e2a50435ee3a557
|
File details
Details for the file geocat_rs-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 382.1 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a6a8ef7b17f018704a7b491ee2328294ab87daa4bbd5fa79ebfe00f7400857f
|
|
| MD5 |
31717baf2a20be1e803a472a825fddfc
|
|
| BLAKE2b-256 |
903d7383c6790dfb7ce3359e244c3222b6385b4183d7deb6161e4d5e056e39b0
|
File details
Details for the file geocat_rs-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 432.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2428c93194d2372709887679d25eb7770c5f97939e04dad813bf2f107fdd448c
|
|
| MD5 |
8aaf3aed7ae6d4e50ee616431419b371
|
|
| BLAKE2b-256 |
86757b1f92a60738a5e01aba3777283bbcb55907e12c1b10a2db5c5c38da6d01
|
File details
Details for the file geocat_rs-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 424.0 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65f63abb9d53468ce41f12c3f04ae73f33bd8ef58520b12ae6a6b2e103923891
|
|
| MD5 |
589a546f7485c3fbafec0026ab1c15ff
|
|
| BLAKE2b-256 |
e3b8f02749a639fea5d99abd45fcf9177d536c61ea81acdc6e08219feb52cf76
|
File details
Details for the file geocat_rs-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 432.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40b3049510f7f84b19df440ef1258895b6666b044fffb7e9d617a0556dd82260
|
|
| MD5 |
357d30029723dd3f327c5ad62d3020cb
|
|
| BLAKE2b-256 |
c559adc66e6a85fad3589342bc7f9bcc92435dc39bebe11e1b9d46ac6f001dcc
|
File details
Details for the file geocat_rs-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: geocat_rs-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 424.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf87a6e2f653742683f092ca1d380cf8e0141a363f78ecd3aec54459291c8649
|
|
| MD5 |
2189dedd88da2c7d8c37189e8480861e
|
|
| BLAKE2b-256 |
38b9fcb35bd7285e4969773c3a9f1e10f914a1eb317bbf258a74f8ae1a967c2f
|