atmospheric-science-research-skill
Atmospheric Science Research
Think Before Coding
Don't assume. Don't hide confusion. Surface tradeoffs. State assumptions explicitly. If uncertain or multiple interpretations exist — ASK, don't pick silently.
HARD RULES — ALWAYS enforce
- Colormaps:
import cmaps+ discretelevels. NEVER matplotlib built-ins (jet,rainbow,viridis). - No title: no
suptitle()or source/data stamps (e.g. "ERA5 monthly mean") inside the figure. - Review actual PNG: open the rendered PNG with Read tool every RR iteration. NEVER judge by code alone.
- Reuse existing layout: use the project's own directories. Fall back to
data_processed/+figN/only when none exist. - Separate compute from plot: different scripts. Figure-only patches never touch compute.
- Coordinate normalization: verify naming (
lat/latitude,lon/longitude) and convention (0–360 vs −180/180) BEFORE any merge, comparison, or plot.
Workflow
Understand the data first (variables, dims, coords, units), then execute. Pick initial levels from domain knowledge — refine in the RR loop, not by profiling beforehand.
| Situation | Flow |
|---|---|
| New or modified compute/plot | Execute → RR → Doc |
| Figure-only fix (labels, ticks, colors, spacing, DPI, export) | Patch → RR → Doc |
| Review / QC an existing rendered figure | RR only |
Execute
Split into compute + plot. Use subagents when available — agree on output path and variable names first; plot waits if compute fails. Fix and re-run on failure; do NOT enter RR with broken outputs.
Compute — read compute-standards.md first
- Normalize coordinates first (rename
latitude→lat, handle lon convention, ensure lat south→north). - Save intermediates to
data_processed/*.ncwithunitsandlong_nameattributes.
Plot — read plot-standards.md first
Read from saved intermediates, not raw data.
-
Colormap:
import cmaps, discretelevels, NEVER matplotlib built-ins. Absolute → sequential; anomaly/difference → diverging, symmetric, center 0. Comparable panels share cmap + range.Quick lookup (full table in plot-standards.md):
Variable Absolute Anomaly / Difference Temperature temp_19lev,hotcolr_19levtemp_diff_18lev,BlueWhiteOrangeRed,BlWhRePrecipitation precip_11lev,precip3_16levprecip_diff_12lev,CBR_drywet,GMT_drywetSST temp_19lev,cmocean_thermalGHRSST_anomaly,MPL_sstanomGeopotential BlAqGrYeOrRe,BlAqGrYeOrReVi200— SLP MPL_YlOrRd,BlAqGrYeOrRe— Vert. velocity — BlWhRe,NCV_blu_redGeneric anomaly — BlueWhiteOrangeRed,BlWhRe,NCV_blu_red -
Panel labels:
ax.text(-0.02, 1.03, "(a) subtitle", transform=ax.transAxes, fontsize=11, fontweight="bold", va="bottom", ha="right"). -
Colorbar: must show units. Font: DejaVu Sans, 10–12 pt (single) / 8–10 pt (multi), min 7 pt.
-
Contour lines: do NOT add on
contourfunless they convey extra information (e.g. geopotential contours over temperature fill). -
Vectors: skip by resolution (1°→3–5, 0.25°→8–15, 2.5°→1–2; larger domain → more skip). Quiver key: arrow + label in white opaque box flush against lower-right border; arrow sized to fit inside box; ref magnitude = round number near median speed, not max. Full spec in plot-standards.md.
-
Stippling: sparse enough to identify significant regions without obscuring fill. Hatching
"..."or scatter[::3], size 0.3–1.0, alpha 0.4–0.6. High-res (< 0.5°) needs more subsampling. Full spec in plot-standards.md. -
Export: PNG 600 dpi + SVG,
bbox_inches="tight".
Patch (figure-only fix)
- Read existing code. Identify the MINIMUM change needed.
- Patch ONLY affected code — no directory restructuring, no compute rewrite.
- Re-render affected figures only.
RR — Review & Revision Loop
Read review.md + plot-standards.md before starting.
Loop until PASS or BLOCKED.
Each iteration:
- Open actual PNG with Read tool.
- Check against HARD RULES + quick reject checklist (plot-standards.md).
- Sanity glance: values, units, spatial patterns physically plausible?
- Classify:
- Visual defect → REVISE plot code, re-render → step 1.
- Data/diagnostic issue → REVISE compute + replot → step 1.
- Science question → BLOCKED: state clearly, stop.
- Clean → PASS, stop.
- Same defect after 2 fixes → recheck data, coords, units, dtypes from scratch.
- Max 10 iterations. If not PASS, surface ALL remaining issues to user.
Documentation — after RR reaches PASS
Read readme-template.md. Write or update a Chinese README.md:
- New project → full README.
- Later modifications → append to「版本更新」, update affected sections only.
Only produce README.md — no other documentation files.
Failure Rules
- Same error after 2 targeted fixes → recheck data, coordinates, units, dtypes from scratch.
- Preserve original code style when modifying existing code.
- Search the web only after local docs fail.