Skip to content

Commit a688afc

Browse files
sunt05claude
andcommitted
feat: Extend attribution module with q2 humidity support
Add multi-variable attribution capability following the same Shapley decomposition framework used for T2. The q2 (2m specific humidity) attribution uses latent heat flux (QE) and the scale factor gamma = 1/(rho*Lv) to decompose humidity differences into physical mechanisms. New functions: - attribute_q2(): Decompose q2 differences between two scenarios - diagnose_q2(): Automatic anomaly detection for humidity - attribute(): Generic dispatcher for T2/q2 - diagnose(): Generic dispatcher for T2/q2 - _cal_gamma_humidity(): Scale factor for latent heat - _cal_r_eff_humidity(): Back-calculate moisture resistance The design maximises code reuse - both T2 and q2 follow the same flux-gradient physics pattern (X = X_ref + r * F * gamma). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 37a5ea7 commit a688afc

File tree

2 files changed

+485
-1
lines changed

2 files changed

+485
-1
lines changed

src/supy/util/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,18 @@
5858
from ._spinup import get_spinup_state
5959

6060
from ._attribution import (
61+
# Variable-specific functions
6162
attribute_t2,
63+
attribute_q2,
6264
diagnose_t2,
65+
diagnose_q2,
66+
# Generic dispatchers
67+
attribute,
68+
diagnose,
69+
# Result container
6370
AttributionResult,
6471
T2Attribution,
72+
Q2Attribution,
6573
)
6674

6775
# from ._config import SUEWSConfig, init_config_from_yaml

0 commit comments

Comments
 (0)