XAI-Cons: Observational Constraint Analysis
Overview
This skill specializes in Observational Constraint (Emergent Constraint, EC) analysis - a powerful method that leverages inter-model differences and historical observations to reduce uncertainty in future climate projections.
Core Principle:
If a significant statistical relationship exists between a historical variable (x_hist) and a future prediction variable (y_future) across multiple climate models, then observations of x_hist can "constrain" predictions of y_future, thereby narrowing the uncertainty range.
Mathematical Expression:
y_future = β × x_historical + ε
Where:
x_historical: Historical simulation variable (e.g., 1980-2014 South Atlantic SST)
y_future: Future prediction target (e.g., 2041-2060 East Asia temperature)
β: Regression slope (EC sensitivity)
ε: Residual
Three Core Steps:
- Establish Emergent Relationship - Significant inter-model correlation (p<0.05)
- Physical Mechanism Validation - Verify physical linkage through diagnostics
- Constraint Quality Assessment - Evaluate using RRV, RMSE, CRPS, etc.
For detailed methodology → See references/methods.md
When to Use This Skill
Automatic Trigger Keywords:
Method-related:
- "observational constraint", "emergent constraint", "EC analysis"
- "inter-model regression", "reduce uncertainty", "constrain prediction"
- "CMIP6 evaluation", "multi-model analysis"
Research content:
- "South Atlantic", "East Asia", "teleconnection"
- "SST-TAS relationship", "sea surface temperature"
- "Walker circulation", "atmospheric wave train"
- "residual analysis", "remove global signal"
Analysis tasks:
- "evaluate EC reliability", "calculate variance reduction"
- "lead-lag correlation", "SVD covariance analysis", "binning analysis"
Core Functionality
1. EC Relationship Establishment
Tasks:
- Load CMIP6 multi-model historical and future data
- Calculate regional averages (e.g., South Atlantic SST, East Asia TAS)
- Perform inter-model linear regression
- Statistical tests (R², correlation r, p-value)
- Plot scatter + regression line + observational constraint point
Key Outputs:
- Regression coefficient β (EC sensitivity)
- R² (explained variance)
- Correlation coefficient r and p-value
- Constrained prediction value and uncertainty range
2. Reliability Assessment ⭐
Tasks:
- Use binning analysis to evaluate EC significance
- Compare with random EC to exclude spurious correlations
- Calculate credibility for different correlation strengths
- Generate prior/posterior distribution comparison
Why Important:
Not all statistically significant correlations are reliable ECs! Need to assess:
- Is correlation coefficient strong enough (typically r>0.3)?
- Better than random correlations?
- Does constraint actually reduce uncertainty (positive variance reduction)?
Reference Code:
scripts/examples/src/binning_inference.py ⭐ Core method
scripts/examples/src/plot_random_EC.py - Random EC comparison
scripts/examples/src/plot_PDF_ECS.py - Probability distributions
Key Outputs:
- 66% and 90% confidence intervals
- Prior/posterior distributions
- Variance reduction percentage
- Comparison with random ECs
3. Physical Mechanism Diagnostics
3a. Residual Analysis
Purpose: Answer "Why this region?"
Tasks:
- Remove linear influence of global warming signal
- Calculate residual:
residual = SA_SST - (β·Global_SST + intercept)
- Verify residual uncorrelated with global SST (r≈0)
- Analyze spatial correlation between residual and global temperature field
- Identify unique teleconnection patterns and wave train pathways
Key Outputs:
- Spatial correlation maps
- Wave train pathway identification
- Percentage of significantly correlated regions
3b. Mediation Analysis
Example: Walker circulation
Tasks:
- Calculate mediator variable (e.g., Walker circulation index)
- Analyze mediation effects:
- Path a: predictor → mediator
- Path b: mediator → response
- Path c': partial correlation controlling for mediator
- Calculate mediation percentage
3c. Spatiotemporal Diagnostics
Lead-lag Correlation:
- Calculate correlation at different time lags (±5 years)
- Determine causal temporal relationship
SVD Covariance Analysis:
- Identify coupled spatial modes
- Confirm large-scale patterns, not point-to-point artifacts
Spatial Regression:
- Regression at each global grid point
- Spatial distribution of regression coefficients
- Significance testing
Composite Analysis:
- High SST vs Low SST groups (top/bottom 1/3 of models)
- Temperature difference fields
- t-test significance
4. Uncertainty Quantification
Tasks:
- Calculate prior (unconstrained) uncertainty
- Calculate posterior (constrained) uncertainty
- Variance reduction:
VR = 1 - (σ_posterior / σ_prior)²
- Confidence interval calculation
Key Metrics:
- Variance reduction percentage (should be positive)
- 66% confidence interval width
- 90% confidence interval width
- Reliability rating
Quick Start Examples
Example 1: Basic EC Analysis
User says:
"Perform observational constraint analysis for South Atlantic SST
and East Asia temperature using CMIP6 data,
historical period 1980-2014, future period 2041-2060"
Skill executes:
- Reference code in
scripts/examples/
- Generate scripts adapted to your data
- Perform inter-model regression
- Calculate statistics
- Plot EC scatter diagram
- Apply observational constraint
Example 2: Reliability Assessment
User says:
"My EC relationship is r=0.39, R²=0.15, p=0.006.
Use binning method to evaluate if this EC is reliable"
Skill executes:
- Apply logic from
binning_inference.py
- Generate binning analysis code for your data
- Calculate credibility at different correlation strengths
- Compare your r=0.39 with distribution
- Provide reliability assessment
Example 3: Physical Mechanism Diagnostics
User says:
"Analyze South Atlantic SST's unique teleconnection.
After removing global warming signal,
check if still correlated with East Asia"
Skill executes:
- Calculate South Atlantic SST residual (remove global SST influence)
- Verify residual uncorrelated with global SST
- Calculate spatial correlation between residual and global temperature
- Identify significantly correlated regions
- Search for wave train pathways
- Generate comprehensive analysis figure
Available Resources
Core Tools (scripts/examples/src/)
binning_inference.py ⭐⭐⭐
- Gold standard for EC reliability assessment
- Applicable to any EC relationship
- Directly usable (adjust data paths)
tools.py
- Statistical analysis utilities
- Plotting tools
- Histograms, modal analysis, etc.
plot_PDF_ECS.py
- Probability density function visualization
- Prior/posterior distribution comparison
plot_random_EC.py
- Random EC generation and comparison
- Significance assessment
Literature Examples
Bonan et al. (2025) Nature Geoscience
- EC analysis of ocean overturning circulation
- Physical constraint methodology
Kornhuber et al. (2024) PNAS
- Complete EC analysis case study
- Full workflow from data to figures
Pakistan Case Study
- Multi-level diagnostic analysis
- EOF, MCA, composite analysis
- Publication-ready figure standards
Documentation:
scripts/examples/README.md - Detailed example code documentation
references/methods.md - Comprehensive methodology and theory
references/workflow.md - Step-by-step analysis workflow (if available)
references/best_practices.md - Best practices and FAQ (if available)
Key Statistical Thresholds
EC Reliability Assessment Standards:
| Metric |
Excellent |
Good |
Acceptable |
Weak |
| Correlation r |
>0.6 |
0.4-0.6 |
0.3-0.4 |
<0.3 |
| R² |
>0.36 |
0.16-0.36 |
0.09-0.16 |
<0.09 |
| p-value |
<0.01 |
0.01-0.03 |
0.03-0.05 |
>0.05 |
| Variance Reduction |
>50% |
30-50% |
10-30% |
<10% or negative |
Note:
- These are empirical thresholds, not absolute standards
- Must combine with binning analysis for comprehensive judgment
- Physical mechanism support is crucial
Best Practices
✅ Recommended:
Always assess reliability
- Don't rely solely on p-values
- Must perform binning analysis
- Check if variance reduction is positive
Seek physical mechanisms
- EC relationship must have physical explanation
- Pure statistical correlation insufficient for publication
- Use multiple diagnostic methods for cross-validation
Sensitivity testing
- Different time periods
- Different region definitions
- Different observational datasets
❌ Avoid These Pitfalls:
- Cherry-picking - Testing many variable pairs and only reporting significant ones
- Ignoring uncertainty - Constrained range may still be large
- Over-interpreting weak correlations - r<0.3 rarely reliable
- Ignoring model dependence - Outlier models may drive correlation
Technical Stack
Required Python Packages:
numpy - Numerical computation
scipy - Statistical analysis
matplotlib - Plotting
xarray - Multi-dimensional data (NetCDF)
netCDF4 - NetCDF file I/O
Recommended Packages:
pandas - Tabular data
cartopy - Map plotting
seaborn - Advanced visualization
statsmodels - Advanced statistics
Output Deliverables
Figures:
Main Figures:
- EC scatter plot (regression line + observational constraint)
- Spatial regression pattern map
- Physical mechanism composite figure (4-6 panels)
Supplementary Figures:
- Binning analysis plot
- Residual teleconnection map
- Lead-lag correlation curve
- SVD covariance pattern
- Walker circulation mediation effects
- Composite analysis
Data:
- Regression statistics (β, R², r, p)
- Pre/post constraint predictions and uncertainties
- Variance reduction percentage
- Binning analysis statistics
- Physical diagnostic metrics
Text:
- Methods section draft
- Results section draft
- Supplementary materials description
- Reviewer response templates
Related Resources
Internal:
scripts/examples/README.md - Example code documentation
scripts/examples/src/ - Core utility functions
scripts/examples/*.ipynb - Literature implementation examples
scripts/examples/Pakistan/ - Complete case study
External References:
- Hall et al. (2019). "Progressing emergent constraints on future climate change". Nature Climate Change.
- Brient, F. (2020). "Evaluating the robustness of emergent constraints".
- Cox et al. (2018). "Emergent constraint on ECS from global temperature variability". Nature.
Last Updated: 2025-10-27
Version: 1.0
Maintainer: Climate-AI Research Team
Based On: South Atlantic - East Asia Teleconnection Research
1---2name: xai-cons3description: Perform observational constraint (Emergent Constraint, EC) analysis for climate research. Use historical observations to constrain future climate projections from CMIP6 multi-model ensembles, reducing prediction uncertainty. Includes inter-model regression analysis, EC relationship establishment, physical mechanism diagnostics (residual analysis, teleconnection pathways, Walker circulation, lead-lag correlation, SVD), uncertainty quantification (variance reduction, confidence intervals), and reliability assessment (binning analysis, random EC comparison). Use when conducting observational constraint analysis, CMIP multi-model evaluation, reducing prediction uncertainty, validating inter-model relationships, or climate teleconnection research. Applicable to any climate variable pairs (e.g., SST-TAS, precipitation-circulation).4---5
6# XAI-Cons: Observational Constraint Analysis
7
8## Overview
9
10This skill specializes in **Observational Constraint (Emergent Constraint, EC)** analysis - a powerful method that leverages inter-model differences and historical observations to reduce uncertainty in future climate projections.
11
12**Core Principle:**
13If a significant statistical relationship exists between a historical variable (x_hist) and a future prediction variable (y_future) across multiple climate models, then observations of x_hist can "constrain" predictions of y_future, thereby narrowing the uncertainty range.
14
15**Mathematical Expression:**
16```
17y_future = β × x_historical + ε
18```
19
20Where:
21- `x_historical`: Historical simulation variable (e.g., 1980-2014 South Atlantic SST)
22- `y_future`: Future prediction target (e.g., 2041-2060 East Asia temperature)
23- `β`: Regression slope (EC sensitivity)
24- `ε`: Residual
25
26**Three Core Steps:**
271. **Establish Emergent Relationship** - Significant inter-model correlation (p<0.05)
282. **Physical Mechanism Validation** - Verify physical linkage through diagnostics
293. **Constraint Quality Assessment** - Evaluate using RRV, RMSE, CRPS, etc.
30
31**For detailed methodology** → See `references/methods.md`
32
33---
34
35## When to Use This Skill
36
37### Automatic Trigger Keywords:
38
39**Method-related:**
40- "observational constraint", "emergent constraint", "EC analysis"
41- "inter-model regression", "reduce uncertainty", "constrain prediction"
42- "CMIP6 evaluation", "multi-model analysis"
43
44**Research content:**
45- "South Atlantic", "East Asia", "teleconnection"
46- "SST-TAS relationship", "sea surface temperature"
47- "Walker circulation", "atmospheric wave train"
48- "residual analysis", "remove global signal"
49
50**Analysis tasks:**
51- "evaluate EC reliability", "calculate variance reduction"
52- "lead-lag correlation", "SVD covariance analysis", "binning analysis"
53
54---
55
56## Core Functionality
57
58### 1. EC Relationship Establishment
59
60**Tasks:**
61- Load CMIP6 multi-model historical and future data
62- Calculate regional averages (e.g., South Atlantic SST, East Asia TAS)
63- Perform inter-model linear regression
64- Statistical tests (R², correlation r, p-value)
65- Plot scatter + regression line + observational constraint point
66
67**Key Outputs:**
68- Regression coefficient β (EC sensitivity)
69- R² (explained variance)
70- Correlation coefficient r and p-value
71- Constrained prediction value and uncertainty range
72
73---
74
75### 2. Reliability Assessment ⭐
76
77**Tasks:**
78- Use **binning analysis** to evaluate EC significance
79- Compare with random EC to exclude spurious correlations
80- Calculate credibility for different correlation strengths
81- Generate prior/posterior distribution comparison
82
83**Why Important:**
84Not all statistically significant correlations are reliable ECs! Need to assess:
851. Is correlation coefficient strong enough (typically r>0.3)?
862. Better than random correlations?
873. Does constraint actually reduce uncertainty (positive variance reduction)?
88
89**Reference Code:**
90- `scripts/examples/src/binning_inference.py` ⭐ Core method
91- `scripts/examples/src/plot_random_EC.py` - Random EC comparison
92- `scripts/examples/src/plot_PDF_ECS.py` - Probability distributions
93
94**Key Outputs:**
95- 66% and 90% confidence intervals
96- Prior/posterior distributions
97- Variance reduction percentage
98- Comparison with random ECs
99
100---
101
102### 3. Physical Mechanism Diagnostics
103
104#### 3a. Residual Analysis
105**Purpose:** Answer "Why this region?"
106
107**Tasks:**
108- Remove linear influence of global warming signal
109- Calculate residual: `residual = SA_SST - (β·Global_SST + intercept)`
110- Verify residual uncorrelated with global SST (r≈0)
111- Analyze spatial correlation between residual and global temperature field
112- Identify unique teleconnection patterns and wave train pathways
113
114**Key Outputs:**
115- Spatial correlation maps
116- Wave train pathway identification
117- Percentage of significantly correlated regions
118
119---
120
121#### 3b. Mediation Analysis
122**Example:** Walker circulation
123
124**Tasks:**
125- Calculate mediator variable (e.g., Walker circulation index)
126- Analyze mediation effects:
127 - Path a: predictor → mediator
128 - Path b: mediator → response
129 - Path c': partial correlation controlling for mediator
130- Calculate mediation percentage
131
132---
133
134#### 3c. Spatiotemporal Diagnostics
135
136**Lead-lag Correlation:**
137- Calculate correlation at different time lags (±5 years)
138- Determine causal temporal relationship
139
140**SVD Covariance Analysis:**
141- Identify coupled spatial modes
142- Confirm large-scale patterns, not point-to-point artifacts
143
144**Spatial Regression:**
145- Regression at each global grid point
146- Spatial distribution of regression coefficients
147- Significance testing
148
149**Composite Analysis:**
150- High SST vs Low SST groups (top/bottom 1/3 of models)
151- Temperature difference fields
152- t-test significance
153
154---
155
156### 4. Uncertainty Quantification
157
158**Tasks:**
159- Calculate prior (unconstrained) uncertainty
160- Calculate posterior (constrained) uncertainty
161- Variance reduction: `VR = 1 - (σ_posterior / σ_prior)²`
162- Confidence interval calculation
163
164**Key Metrics:**
165- Variance reduction percentage (should be positive)
166- 66% confidence interval width
167- 90% confidence interval width
168- Reliability rating
169
170---
171
172## Quick Start Examples
173
174### Example 1: Basic EC Analysis
175
176**User says:**
177```
178"Perform observational constraint analysis for South Atlantic SST
179and East Asia temperature using CMIP6 data,
180historical period 1980-2014, future period 2041-2060"
181```
182
183**Skill executes:**
1841. Reference code in `scripts/examples/`
1852. Generate scripts adapted to your data
1863. Perform inter-model regression
1874. Calculate statistics
1885. Plot EC scatter diagram
1896. Apply observational constraint
190
191---
192
193### Example 2: Reliability Assessment
194
195**User says:**
196```
197"My EC relationship is r=0.39, R²=0.15, p=0.006.
198Use binning method to evaluate if this EC is reliable"
199```
200
201**Skill executes:**
2021. Apply logic from `binning_inference.py`
2032. Generate binning analysis code for your data
2043. Calculate credibility at different correlation strengths
2054. Compare your r=0.39 with distribution
2065. Provide reliability assessment
207
208---
209
210### Example 3: Physical Mechanism Diagnostics
211
212**User says:**
213```
214"Analyze South Atlantic SST's unique teleconnection.
215After removing global warming signal,
216check if still correlated with East Asia"
217```
218
219**Skill executes:**
2201. Calculate South Atlantic SST residual (remove global SST influence)
2212. Verify residual uncorrelated with global SST
2223. Calculate spatial correlation between residual and global temperature
2234. Identify significantly correlated regions
2245. Search for wave train pathways
2256. Generate comprehensive analysis figure
226
227---
228
229## Available Resources
230
231### Core Tools (`scripts/examples/src/`)
232
233**`binning_inference.py`** ⭐⭐⭐
234- Gold standard for EC reliability assessment
235- Applicable to any EC relationship
236- Directly usable (adjust data paths)
237
238**`tools.py`**
239- Statistical analysis utilities
240- Plotting tools
241- Histograms, modal analysis, etc.
242
243**`plot_PDF_ECS.py`**
244- Probability density function visualization
245- Prior/posterior distribution comparison
246
247**`plot_random_EC.py`**
248- Random EC generation and comparison
249- Significance assessment
250
251### Literature Examples
252
253**Bonan et al. (2025) Nature Geoscience**
254- EC analysis of ocean overturning circulation
255- Physical constraint methodology
256
257**Kornhuber et al. (2024) PNAS**
258- Complete EC analysis case study
259- Full workflow from data to figures
260
261**Pakistan Case Study**
262- Multi-level diagnostic analysis
263- EOF, MCA, composite analysis
264- Publication-ready figure standards
265
266**Documentation:**
267- `scripts/examples/README.md` - Detailed example code documentation
268- `references/methods.md` - Comprehensive methodology and theory
269- `references/workflow.md` - Step-by-step analysis workflow (if available)
270- `references/best_practices.md` - Best practices and FAQ (if available)
271
272---
273
274## Key Statistical Thresholds
275
276### EC Reliability Assessment Standards:
277
278| Metric | Excellent | Good | Acceptable | Weak |
279|--------|-----------|------|------------|------|
280| **Correlation r** | >0.6 | 0.4-0.6 | 0.3-0.4 | <0.3 |
281| **R²** | >0.36 | 0.16-0.36 | 0.09-0.16 | <0.09 |
282| **p-value** | <0.01 | 0.01-0.03 | 0.03-0.05 | >0.05 |
283| **Variance Reduction** | >50% | 30-50% | 10-30% | <10% or negative |
284
285**Note:**
286- These are empirical thresholds, not absolute standards
287- Must combine with binning analysis for comprehensive judgment
288- Physical mechanism support is crucial
289
290---
291
292## Best Practices
293
294### ✅ Recommended:
295
2961. **Always assess reliability**
297 - Don't rely solely on p-values
298 - Must perform binning analysis
299 - Check if variance reduction is positive
300
3012. **Seek physical mechanisms**
302 - EC relationship must have physical explanation
303 - Pure statistical correlation insufficient for publication
304 - Use multiple diagnostic methods for cross-validation
305
3063. **Sensitivity testing**
307 - Different time periods
308 - Different region definitions
309 - Different observational datasets
310
311### ❌ Avoid These Pitfalls:
312
3131. **Cherry-picking** - Testing many variable pairs and only reporting significant ones
3142. **Ignoring uncertainty** - Constrained range may still be large
3153. **Over-interpreting weak correlations** - r<0.3 rarely reliable
3164. **Ignoring model dependence** - Outlier models may drive correlation
317
318---
319
320## Technical Stack
321
322**Required Python Packages:**
323- `numpy` - Numerical computation
324- `scipy` - Statistical analysis
325- `matplotlib` - Plotting
326- `xarray` - Multi-dimensional data (NetCDF)
327- `netCDF4` - NetCDF file I/O
328
329**Recommended Packages:**
330- `pandas` - Tabular data
331- `cartopy` - Map plotting
332- `seaborn` - Advanced visualization
333- `statsmodels` - Advanced statistics
334
335---
336
337## Output Deliverables
338
339### Figures:
340**Main Figures:**
3411. EC scatter plot (regression line + observational constraint)
3422. Spatial regression pattern map
3433. Physical mechanism composite figure (4-6 panels)
344
345**Supplementary Figures:**
3461. Binning analysis plot
3472. Residual teleconnection map
3483. Lead-lag correlation curve
3494. SVD covariance pattern
3505. Walker circulation mediation effects
3516. Composite analysis
352
353### Data:
354- Regression statistics (β, R², r, p)
355- Pre/post constraint predictions and uncertainties
356- Variance reduction percentage
357- Binning analysis statistics
358- Physical diagnostic metrics
359
360### Text:
361- Methods section draft
362- Results section draft
363- Supplementary materials description
364- Reviewer response templates
365
366---
367
368## Related Resources
369
370**Internal:**
371- `scripts/examples/README.md` - Example code documentation
372- `scripts/examples/src/` - Core utility functions
373- `scripts/examples/*.ipynb` - Literature implementation examples
374- `scripts/examples/Pakistan/` - Complete case study
375
376**External References:**
377- Hall et al. (2019). "Progressing emergent constraints on future climate change". *Nature Climate Change*.
378- Brient, F. (2020). "Evaluating the robustness of emergent constraints".
379- Cox et al. (2018). "Emergent constraint on ECS from global temperature variability". *Nature*.
380
381---
382
383**Last Updated:** 2025-10-27
384**Version:** 1.0
385**Maintainer:** Climate-AI Research Team
386**Based On:** South Atlantic - East Asia Teleconnection Research