{"id":"78d19dd7-b992-40e8-b186-804328e7c55a","slug":"earth2studio-deterministic-forecast","kind":"skill","name":"earth2studio-deterministic-forecast","summary":"Build deterministic forecast scripts with Earth2Studio (model, data source, IO, inference). Do NOT use for ensemble, diagnostics, data-only fetch, or install.","owner":"NVIDIA","repoUrl":"https://github.com/NVIDIA/skills/tree/HEAD/skills/earth2studio-deterministic-forecast","license":"Apache-2.0","licenseTier":"permissive","trust":"official","stars":3586,"match":null,"fewStars":false,"format":"skill","createdAt":null,"addedAt":"2026-10-14T05:44:38.600Z","logoUrl":"https://avatars.githubusercontent.com/u/1728152?v=4","linkOnly":false,"collection":{"name":"skills","repo":"nvidia/skills"},"skillPath":"skills/earth2studio-deterministic-forecast","categories":["data-analytics","browser-web","developer-tools"],"tags":["agentic-ai","ai-agents","claude-code","codex","coding-agents","cuda","developer-tools","llm"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-14T05:44:38.599Z","sample":false,"url":"https://conduits.dev/tools/earth2studio-deterministic-forecast","language":"Python","transports":[],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# Earth2Studio Deterministic Forecast Skill\n\nGuide users through building deterministic (single-member) weather forecast\ninference scripts using `earth2studio.run.deterministic`.\n\n## Prerequisites\n\n- Earth2Studio installed with CUDA-capable GPU\n- Python 3.10+, network access for model weights and data\n\n## Live Doc References\n\nFetch relevant docs to verify current APIs before recommending components:\n\n| Component | URL |\n|-----------|-----|\n| Prognostic models | <https://nvidia.github.io/earth2studio/modules/models_px.html> |\n| Data sources (analysis) | <https://nvidia.github.io/earth2studio/modules/datasources_analysis.html> |\n| Data sources (forecast) | <https://nvidia.github.io/earth2studio/modules/datasources_forecast.html> |\n| IO backends | <https://nvidia.github.io/earth2studio/modules/io.html> |\n| `run.deterministic` | <https://github.com/NVIDIA/earth2studio/blob/main/earth2studio/run.py> |\n\n## Workflow\n\n### 1. Gather Requirements (skip what's already provided)\n\n- Time horizon (hours/days/weeks)\n- Variables of interest (t2m, wind, geopotential, etc.)\n- Region (global or specific like CONUS)\n- GPU/VRAM available\n\n### 2. Select Model\n\nFetch prognostic models page. Filter by time horizon, region, VRAM. Note model's:\n- Input variables (`input_coords[\"variable\"]`)\n- Time step size (`output_coords[\"lead_time\"]`)\n\n### 3. Select Data Source\n\nData source must provide all model input variables. Verify via lexicon at\n`earth2studio/lexicon/<source>.py`. Common pairings: Global models → GFS/ARCO/IFS;\nRegional → HRRR.\n\n### 4. Select IO Backend\n\nDefault: `ZarrBackend`. Use `NetCDF4Backend` for legacy tools, `XarrayBackend`\nfor in-memory/small runs.\n\n### 5. Calculate nsteps\n\n`nsteps = forecast_hours / model_step_hours`\n\nExample: 5-day forecast with 6h step → `nsteps = 120 / 6 = 20`\n\n### 6. Decide: output_coords Filtering\n\n- **Filter variables** (`output_coords`) when user requests specific variables (e.g., \"t2m and wind\") - reduces output size\n- **Save all variables** (omit `output_coords`) when user says \"all variables\" or doesn't specify - preserves full model output\n\n### 7. Generate Script\n\n```python\nfrom collections import OrderedDict\nimport numpy as np\nimport torch\nfrom earth2studio.models.px import <ModelClass>\nfrom earth2studio.data import <DataSourceClass>\nfrom earth2studio.io import <IOBackendClass>\nfrom earth2studio.run import deterministic\n\nmodel = <ModelClass>.load_model(<ModelClass>.load_default_package())\ndata = <DataSourceClass>()\nio = <IOBackendClass>(\"<output_path>\")\n\n# Include output_coords ONLY if user requested specific variables\noutput_coords = OrderedDict({\"variable\": np.array([\"t2m\", \"u10m\"])})\n\nio = deterministic(\n    time=[\"YYYY-MM-DDTHH:MM:SS\"],\n    nsteps=<N>,\n    prognostic=model,\n    data=data,\n    io=io,\n    output_coords=output_coords,  # omit if saving all variables\n    device=torch.device(\"cuda\"),\n)\n```\n\n### 8. Manual Loop Alternative\n\nWhen user explicitly requests manual implementation (NOT using `earth2studio.run.deterministic`), follow this checklist in order:\n\n1. **fetch_data** - Get initial conditions: `x, coords = fetch_data(data, time, model.input_coords, device)`\n2. **Setup total_coords** - Build coordinate arrays for time and lead_time dimensions\n3. **io.add_array** - Initialize IO backend with total_coords before loop\n4. **create_iterator** - Create prognostic iterator: `model_iter = model.create_iterator(x, coords)`\n5. **Loop through nsteps** - `for step, (x, coords) in enumerate(model_iter): if step >= nsteps: break`\n6. **map_coords** - Filter output variables if needed: `x_out, coords_out = map_coords(x, coords, output_coords)`\n7. **split_coords** - Prepare for IO write: `x_out, coords_out = split_coords(x_out, coords_out)`\n8. **io.write** - Write each step to backend\n\n### 9. Explain Next Steps\n\n- How to change forecast time or run multiple initializations\n- How to read output (`xr.open_zarr(...)`)\n- Point to diagnostic workflow for post-processing\n\n## Ownership\n\n**Owns:** Model selection, data source compatibility, IO backend selection,\nnsteps calculation, generating `earth2studio.run.deterministic` scripts.\n\n**Does not own:** Ensemble workflows, diagnostics, data-only fetch, installation,\nmodel training.\n\n## Troubleshooting\n\nSee `references/troubleshooting.md` for common errors and solutions.\n\n## Reminders\n\n- **Always fetch live docs** before recommending models or data sources - APIs change between releases\n- **Verify lexicon compatibility** - Model input variables must exist in data source's VOCAB\n- **Use `load_default_package()`** - This is the standard pattern for loading model weights\n- **Time format is ISO 8601** - Use `\"YYYY-MM-DDTHH:MM:SS\"` format for the `time` argument\n- **Wind speed needs both components** - If user asks for \"wind speed\", include both `u10m` and `v10m`\n- **nsteps is integer division** - `nsteps = total_hours // model_step_hours`\n- **ZarrBackend is the default** - Only suggest alternatives if user has specific requirements\n- **GPU is required** - All prognostic models require CUDA; CPU inference is not supported"}