Skip to content
Back to skills

Docs

ASecurity

Parse EPIC output files (.ACY, .DGN, and others) into structured DataFrames, compute derived variables (above-ground biomass, stress indicators), generate summary statistics, and create visualization plots.

  • 200 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 11, 2026
datapythonbash

Works with

  • cli

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add lzwei196/KISS---Knowledge-Infrastructure-for-Scientific-Simulation --skill docs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lzwei196-docs-b5b21848/badge)](https://www.skillsdirectory.com/skills/lzwei196-docs-b5b21848)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Stage 5: Output Parsing and Analysis

## Purpose

Parse EPIC output files (.ACY, .DGN, and others) into structured DataFrames,
compute derived variables (above-ground biomass, stress indicators), generate
summary statistics, and create visualization plots.

## Prerequisites

- Stage 4 (Execution) completed
- Output files exist in output/ directory
- Python with pandas, numpy, matplotlib

## Inputs

| Input | Format | Key Variables |
|-------|--------|---------------|
| {site}.ACY | Text (skip 10 rows) | YR, CPNM, YLDG, YLDF, BIOM, YLN, YLP |
| {site}.DGN | Text (skip 10 rows) | Y, M, D, BIOM, RW, LAI, WS, NS, TS |

## Outputs

| Output | Format | Description |
|--------|--------|-------------|
| {site}_ACY.csv | CSV | Annual yield data |
| {site}_DGN.csv | CSV | Daily simulation data |
| {site}_summary.json | JSON | Summary statistics |
| Yield timeseries plot | PNG | Annual yield visualization |
| Biomass growth curve | PNG | Daily biomass dynamics |

## Procedure

### Parse Annual Yield (ACY)

```python
from geoEpic.io import ACY

acy = ACY('output/site1.ACY')
yield_data = acy.get_var('YLDG')  # Returns DataFrame with YR, CPNM, YLDG
print(yield_data)
```

ACY columns include:
- **YLDG**: Grain yield (t/ha)
- **YLDF**: Forage yield (t/ha)
- **BIOM**: Total biomass (t/ha)
- **YLN/YLP**: Yield nitrogen/phosphorus (kg/ha)
- **LAI**: Peak leaf area index
- **WS/NS/TS**: Stress days (water, nitrogen, temperature)

### Parse Daily General Output (DGN)

```python
from geoEpic.io import DGN

dgn = DGN('output/site1.DGN')
biom = dgn.get_var('BIOM')  # Daily biomass timeseries

# Compute above-ground biomass
dgn_df = dgn.data
dgn_df['AGB'] = dgn_df['BIOM'] - dgn_df['RW']
```

### Using the KI parser tool

```bash
python tools/parse_epic_output.py \
  --output-dir output/ \
  --site-id site1 \
  --export-csv \
  --export-summary
```

### Key Derived Variables

| Variable | Formula | Description |
|----------|---------|-------------|
| AGB | BIOM - RW | Above-ground biomass (t/ha) |
| HI | YLDG / BIOM | Harvest index |
| NUE | YLDG / YLN | Nitrogen use efficiency |
| WUE | YLDG / ET | Water use efficiency |

### Visualization

```python
import matplotlib.pyplot as plt

# Annual yield timeseries
fig, ax = plt.subplots(figsize=(10, 5))
ax.bar(yield_data['YR'], yield_data['YLDG'], color='#2563EB')
ax.set_xlabel('Year')
ax.set_ylabel('Grain Yield (t/ha)')
ax.set_title('EPIC Simulated Crop Yield')
plt.savefig('yield_timeseries.png', dpi=150)

# Daily biomass growth
fig, ax = plt.subplots(figsize=(10, 5))
ax.plot(dgn_df.index, dgn_df['AGB'], color='#2563EB')
ax.set_xlabel('Date')
ax.set_ylabel('Above-Ground Biomass (t/ha)')
plt.savefig('biomass_growth.png', dpi=150)
```

## Verification

1. **Yield reasonableness**:
   - Corn: 5-15 t/ha (typical US Midwest)
   - Soybean: 1.5-4.5 t/ha
   - Winter wheat: 3-10 t/ha
   - Rice: 4-10 t/ha

2. **Biomass dynamics**: Should show S-curve growth during growing season

3. **Stress indicators**: WS, NS, TS should be < 0.3 for well-managed crops

4. **LAI peak**: Corn ~4-6, Soybean ~3-5, Wheat ~4-7

5. **Harvest index**: Corn ~0.45-0.55, Soybean ~0.35-0.45

## Traps

| Trap | Symptom | Root Cause | Fix |
|------|---------|------------|-----|
| All yields = 0 | No crop growth | Wrong PHU, dates, or weather gap | Check OPC and DLY coverage |
| Yield > 30 t/ha | Unrealistically high | Solar radiation in W/m2 not MJ | Fix srad units in DLY |
| Yield very low | Under 2 t/ha for corn | N stress, water stress, or short season | Check NS/WS stress and fertilizer |
| No ACY file | EPIC didn't run or wrong output toggle | PRNT1102.DAT not configured | Enable ACY in output_types |
| Parse error | Malformed output | EPIC version mismatch | Check skip rows (should be 10) |
| AGB negative | RW > BIOM | Possible model error | Clip AGB to max(0, BIOM-RW) |

## Example

```python
from geoEpic.io import ACY, DGN
import json

# Parse and summarize
acy = ACY('output/umstead.ACY')
dgn = DGN('output/umstead.DGN')

summary = {
    'mean_yield': float(acy.data['YLDG'].mean()),
    'peak_biomass': float(dgn.data['BIOM'].max()),
    'peak_lai': float(dgn.data['LAI'].max()),
    'mean_water_stress': float(dgn.data['WS'].mean()),
}

with open('output/summary.json', 'w') as f:
    json.dump(summary, f, indent=2)
```

Files in this skill

  • 01_site_preparation.md1.2 KB
  • 02_forcing_conversion.md1.8 KB
  • 03_soil_profile.md1.5 KB
  • 04_operations_schedule.md1.7 KB
  • 05_run_execution.md1.5 KB
  • 06_output_parsing.md1.2 KB
  • 07_capability_inventory.md4.5 KB
  • format_spec.yaml35.5 KB
  • papers.json6 KB
  • s0_configuration_skill.md2.5 KB
  • s0_workspace_setup.md1.8 KB
  • s1_weather_preparation.md2.3 KB
  • s1_weather_preparation_skill.md4.3 KB
  • s2_soil_preparation.md2.1 KB
  • s2_soil_preparation_skill.md4.3 KB
  • s3_execution.md2.3 KB
  • s3_operations_management_skill.md4.7 KB
  • s4_execution_skill.md3.8 KB
  • s4_output_parsing.md2.2 KB
  • s5_calibration_validation.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…