APEX

Runs and validates APEX0806 agro-hydrological simulations via staged Fortran binary workflows.

155|6|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation --skill apex-lzwei196
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: APEX
Source: https://github.com/lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation/tree/main/models/APEX
Command: npx skills add https://github.com/lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation --skill apex-lzwei196

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, pandas, openpyxl, and includes scripts (resource) and references (resource) components.

What problem does it solve? Running the APEX (Agricultural Policy/Environmental eXtender) model requires deep operational expertise: dozens of fixed-width Fortran input files, strict unit conventions, version-specific operation codes, and silent failure modes. This Skill externalizes that expertise so an AI agent can reliably configure, execute, and validate APEX0806 crop, hydrology, and water-quality simulations without hand-editing fragile input decks. ## Core Features & Use Cases - Ten-stage pipeline tools: workspace setup from a validated template, CMFD/MSWX/NASA POWER weather conversion to .DLY/.WP1/.WND, HWSD soil conversion to .SOL, site/control editing, Wine-based binary execution, and output parsing to CSV. - Diagnostic recovery: 24 symptom-diagnosis-remedy triplets plus the official XLSM format specification for every APEX input file, enabling systematic debugging instead of guesswork. - Validation support: dag.yaml defines observable outputs (YLDG yield, ET, WYLD, sediment, N/P losses) with units, observability shapes, and scoring conventions including detrending for regional aggregate comparisons. - Use Case: Simulate corn yield at a new location (e.g., Bengbu, China) by building CMFD forcing, HWSD soil, and a 25-year spin-up, then score simulated YLDG against FAOSTAT or GDHY observations. ## Quick Start Ask the agent to run the APEX preflight check and then execute the bundled Riesel TX example workspace, parsing the annual output into a CSV results file.

Frequently Asked Questions about APEX

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run an APEX simulation at a new location?

Copy the validated template workspace, then build CMFD weather forcing and HWSD soil for your latitude and longitude, update the site and control files, and run the APEX0806 binary via Wine. Enable a 20-25 year spin-up so soil water and nutrient pools equilibrate to the new climate before scoring results.

What is the difference between APEX0806 and APEX1501?

APEX1501 has a confirmed P-cycling NaN bug that produces zero biomass for annual crops, so this Skill uses APEX0806. Operation codes also differ: APEX0806 uses plant 136, fertilize 261, harvest 292, and fertilizer codes 53/54, while 1501 codes silently misfire in 0806 runs.

Why does my APEX run produce zero crop yield?

Zero yield usually comes from using the APEX1501 binary, mixing APEX1501 operation codes into an APEX0806 run, or skipping the required spin-up period. Check diagnostics/triplets.yaml first, verify op codes 136/261/292, and ensure at least 20 years of spin-up for non-template climates.

Can I write APEX input files from scratch?

No. APEX inputs are Fortran fixed-width files with rigid column positions, so they must always be copied from the validated example template and modified in place via targeted string replacement. Column positions come from the XLSM editor specification in reference/apex_formats.json.

Why does APEX0806 fail when launched with nohup or in the background?

APEX0806 writes status messages to the Windows console handle CONOUT$, which fails under Wine without a controlling tty, causing a forrtl severe (38) error. Always invoke it through Python subprocess with captured output, as the s6_run_apex tool does.

How do I compare APEX simulated yield against FAOSTAT or GDHY data?

Classify gridded or national yields as regional aggregate time series and use pbias as the determining metric. Detrend both simulation and observation with linear residuals or first differences before computing correlation, since fixed-management runs cannot reproduce technology trends.