npx skills add ...
npx skills add nvidia/skills --skill earth2studio-create-prognostic
Create Earth2Studio prognostic (time-stepping forecast) model wrappers. Do NOT use for diagnostic models, data sources, or installation.
npx skills add nvidia/skills --skill earth2studio-create-prognostic
Do these steps IN ORDER. Do not skip any step.
earth2studio/models/px/<name>.py with triple inheritancetest/models/px/test_<name>.py with mock testsuv run pytest test/models/px/test_<name>.py -vmake format && make lint⚠️ CRITICAL: Always use
uv runfor Python commands:
- ✅
uv run pytest .../uv run python ...- ❌
pytest .../python ...(missing dependencies)Stuck or wrong output: Do not keep retrying the same fix. Follow Self-Improvement to patch this skill before continuing.
Implement a prognostic model wrapper connecting third-party ML weather models to Earth2Studio. Prognostic models time-integrate forward—given initial state, they predict future states by stepping through time (e.g., 6-hour increments).
| Context | Location |
|---|---|
| Harbor eval | Write to /workspace/output/earth2studio/models/px/... |
Harbor + --copy-repo | Full checkout at /workspace/repo |
| Local clone | Directory with pyproject.toml |
Never read evals/targets/ — grader references only.
Load on demand during the matching step:
| File | Content | Load at |
|---|---|---|
references/skeleton-template.py | Full model skeleton with FILL comments | Steps 3–6 |
references/method-templates.py | Canonical method implementations | Steps 4–6 |
references/testing-guide.py | Test skeleton and mock patterns | Step 7 |
references/validation-guide.md | Comparison scripts, PR, code review | Steps 10–11 |
If $ARGUMENTS provided, use it. Otherwise ask:
Please provide a reference inference script URL/path.
Analyze: packages, architecture, I/O shapes, time step, resolution, checkpoint.
Propose pyproject.toml group (alphabetical, add to all). Every
prognostic model must have an optional dependency extra, even when no packages
are required:
[CONFIRM] Present dependencies and ask user to approve.
Edit pyproject.toml: add the model extra alphabetically, even if it is
empty, and update the all aggregate.
File: earth2studio/models/px/<lowercase>.py
Required inheritance (all three):
Required imports:
SPDX header (required at top of every .py file):
Canonical method order:
__init__ 2. input_coords 3. output_coords (@batch_coords)load_default_package 5. load_model 6. to (optional)__call__ (@batch_func) 9. _default_generatorcreate_iteratorinput_coords rules:
batch: np.empty(0)time: np.empty(0) (dynamic)lead_time: starts at np.timedelta64(0, "h")lat: 90 to -90 (north to south); this is the public Earth2Studio convention even if the source model uses the opposite orderlon: 0 to 360input_coords or output_coordsE2STUDIO_VOCAB (282 entries in earth2studio/lexicon/base.py)output_coords: Use handshake_dim/handshake_coords for input validation, then increment lead_time. Prefer a shared coordinate-check helper and call it from output_coords, __call__, and iterator setup before model execution.
__call__: @batch_func decorated, shape (batch, time, lead_time, var, lat, lon).
Reshape to model format → call model → reshape back.
create_iterator: MUST yield initial condition first (step 0).
Use front_hook/rear_hook for perturbation injection.
load_default_package: Lock HuggingFace URLs: hf://org/repo@commit
load_model: Use package.resolve(), map_location="cpu", eval() mode,
decorate with @check_optional_dependencies().
File: test/models/px/test_<name>.py
Required tests:
| Function | Purpose |
|---|---|
test_<model>_call | Single forward pass (parametrize device/time) |
test_<model>_iter | Iterator produces sequence |
test_<model>_exceptions | Invalid coords raise errors |
test_<model>_package | Real weights (@pytest.mark.package) |
Create PhooModelName dummy matching interface for mock tests.
Run tests:
Do not omit the package test. If arbitrary random inputs are not physically valid for the real checkpoint, use a stable model-appropriate synthetic input while still loading real weights and running a forward pass.
earth2studio/models/px/__init__.py (alphabetical)docs/modules/models_px.rst (alphabetical). This is required for
every new prognostic model so the API docs include the generated page.docs/userguide/about/install.md (alphabetical tab) for the
model extra, even when the extra is empty. Include model-specific notes plus
both pip install earth2studio[model-name] and
uv add earth2studio --extra model-name instructions.CHANGELOG.md under ### Added. This is required for every new
prognostic model.Format and lint:
Follow references/validation-guide.md. Create uncommitted vanilla, E2S,
comparison, and sanity-check scripts; do not commit generated outputs or images.
Use PR-safe placeholders for plots so the user can upload images manually.
[CONFIRM] User must visually inspect plots before proceeding.
Follow references/validation-guide.md and use:
references/pr-body-template.mdreferences/pr-comment-template.mdBefore creating the PR, verify pyproject.toml has the model extra, the
all extra includes it, install docs include both pip and uv commands, and
docs/modules/models_px.rst plus CHANGELOG.md are updated.
Do not include machine names, absolute paths, device inventory, or uploaded image links in PR text. Use plot placeholders instead.
| Error | Solution |
|---|---|
OptionalDependencyFailure | uv add --optional <group> <pkg> |
| Coordinate handshake fails | Check handshake_dim indices match dim position |
| Iterator wrong shapes | Debug reshape logic with random input |
ModuleNotFoundError: pytest | Use uv run pytest not pytest |
DO:
uv run python for ALL Python commandsloguru.logger, never print()torch.nn.Module + AutoModelMixin + PrognosticMixincreate_iteratorfront_hook()/rear_hook() in _default_generatorDON'T:
evals/targets/