计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
weather-model-run-discovery【效率与协作】Resolve the newest complete numerical weather prediction cycle and forecast objects across provider mirrors without downloading full payloads.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Resolve a numerical weather prediction run before downloading model fields. Probe exact objects or narrow prefixes, verify a request-specific completion contract, and return the newest qualifying initialization with its source metadata.
This skill decides which run and objects exist. Use
weather-model-data-fetching afterward to transfer or subset the data.
404, has only early forecast hours, or is
still changing.Do not activate this skill when the initialization is already fixed or when the task is to download, decode, or interpret model variables.
Collect the following request contract:
A run is complete only when every sentinel required by the consumer exists. Examples include:
The presence of forecast hour zero does not prove that a run is complete.
HeadObject, HTTP HEAD, or a narrow paginated
prefix listing. A probe should retrieve metadata, not the model payload.Use a provider's documented cycle status page as supporting evidence, not as a substitute for probing the exact objects the consumer requires.
Keep provider-specific key construction separate from the selection rule. This
example accepts a metadata-only probe callback so it can be used with S3,
HTTP, or a test fixture.
from datetime import datetime, timedelta, timezone
def candidate_cycles(now, cycle_hours, lookback):
now = now.astimezone(timezone.utc).replace(minute=0, second=0, microsecond=0)
allowed = sorted(set(cycle_hours), reverse=True)
candidates = []
for days_back in range((lookback // 24) + 2):
day = (now - timedelta(days=days_back)).date()
for hour in allowed:
cycle = datetime(day.year, day.month, day.day, hour, tzinfo=timezone.utc)
if cycle <= now and now - cycle <= timedelta(hours=lookback):
candidates.append(cycle)
return sorted(set(candidates), reverse=True)
def resolve_latest(now, cycle_hours, lookback, required_objects, probe):
"""Return one complete run; probe(uri) returns metadata or None."""
attempts = []
for cycle in candidate_cycles(now, cycle_hours, lookback):
requested = required_objects(cycle)
found = {name: probe(uri) for name, uri in requested.items()}
missing = [name for name, metadata in found.items() if not metadata]
attempts.append({"cycle": cycle.isoformat(), "missing": missing})
if not missing:
return {
"initialization": cycle.isoformat(),
"objects": [
{"role": name, "uri": requested[name], **found[name]}
for name in requested
],
"attempts": attempts,
}
raise LookupError(f"no complete run within {lookback} hours: {attempts}")
The caller must make required_objects express the real completion contract;
checking a single convenient file defeats the purpose of discovery.
For public NOAA Open Data buckets, inspect exact objects without loading AWS credentials:
aws s3api head-object --no-sign-request \
--bucket BUCKET \
--key "EXACT/DOCUMENTED/OBJECT"
aws s3api list-objects-v2 --no-sign-request \
--bucket BUCKET \
--prefix "MODEL.DATE/DOMAIN/PRECISE-RUN-PREFIX" \
--max-items 100
Paginate narrow listings. S3 returns at most one page at a time, and a
successful listing still needs defensive response parsing. 403 and 404
from HeadObject can be intentionally nonspecific; distinguish a missing
public object from a permission or endpoint error before falling back.
Return enough information for the fetcher and provenance layer to use the exact same objects:
{
"requested_at_utc": "2026-09-18T08:45:00Z",
"model": "hrrr",
"product": "prs",
"initialization": "2026-09-18T06:00:00Z",
"required_forecast_hours": [0, 6, 18],
"provider": "aws",
"objects": [
{
"role": "pressure_f018",
"uri": "s3://bucket/exact-key",
"size_bytes": 123456,
"etag": "opaque-object-identity",
"last_modified": "2026-09-18T07:12:34Z"
}
],
"fallback_cycles_rejected": []
}
Keep ETags as opaque identity values. They are not guaranteed to be full-file MD5 checksums.
408, 429, and transient 5xx responses with bounded
exponential backoff and jitter; honor Retry-After.f000: Later required forecast hours are still
publishing. Test the actual terminal sentinels.