Skip to content
Back to skills

Docs

ASecurity

Run the EPIC crop model binary for one or more sites using the Geo-EPIC workspace framework. This stage handles workspace assembly, EPICCONT.DAT configuration, parallel execution, and output collection.

  • 200 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 11, 2026
documentationpythonbash

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-4460036b/badge)](https://www.skillsdirectory.com/skills/lzwei196-docs-4460036b)

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 4: EPIC Model Execution

## Purpose

Run the EPIC crop model binary for one or more sites using the Geo-EPIC workspace
framework. This stage handles workspace assembly, EPICCONT.DAT configuration,
parallel execution, and output collection.

## Prerequisites

- Stages 0-3 completed (config, weather, soil, operations)
- info.csv populated with site list
- All referenced .DLY, .SOL, .SIT, .OPC files exist

## Inputs

| Input | Format | Location |
|-------|--------|----------|
| config.yml | YAML | workspace root |
| info.csv | CSV | workspace root |
| Weather files | .DLY, .WP1, .WND | weather/ |
| Soil files | .SOL | soil/ |
| Site files | .SIT | sites/ |
| Operations | .OPC | opc/ |
| Model files | .DAT + .exe | model/ |

## Outputs

| Output | Format | Location |
|--------|--------|----------|
| {site}.ACY | Text | output/ |
| {site}.DGN | Text | output/ |
| Run logs | Text | log/ |

## Procedure

### Using Geo-EPIC Workspace

```python
from geoEpic.core import Workspace

ws = Workspace('config.yml')
ws.run()  # Runs all sites from info.csv
```

### Using the KI wrapper tool

```bash
python tools/run_epic_workspace.py \
  --workspace /path/to/workspace \
  --timeout 30
```

### Manual single-site execution

```bash
cd model/
# Configure EPICCONT.DAT (line 1: duration, year, month, day)
# Configure EPICRUN.DAT (site_id and flags)
# Ensure all file references are correct
./EPIC1102.exe
```

### Execution Flow (per site)

1. **Copy model directory** to cache (`/dev/shm/geo_epic_{user}/{uuid}/`)
2. **Write file references**:
   - `WDLSTCOM.DAT` → `1.DLY`
   - `WPM1USEL.DAT` → `1.WP1` with lat/lon/elev
   - `WINDUSEL.DAT` → `1.WND`
   - `SITECOM.DAT` → `{site}.SIT`
   - `SOILCOM.DAT` → `{site}.SOL`
   - `OPSCCOM.DAT` → `{site}.OPC`
3. **Write EPICRUN.DAT**: `{site_id:>9s} 1  0  0  0  1  1  1/`
4. **Execute binary** with stdin piped (handles prompts)
5. **Collect outputs** from cache to `output/`
6. **Cleanup** temp directory

### EPICCONT.DAT Configuration

Line 1: `[duration:4][year:4][month:4][day:4]`

```
   6201501011.00...
```
Means: 6 years starting 2015-01-01.

### Parallel Execution

Geo-EPIC uses `pebble` for parallel site execution:

```python
ws = Workspace('config.yml')
ws.run(num_workers=8)  # 8 parallel processes
```

Each site runs in an isolated temp directory, so concurrent execution is safe.

## Verification

1. **Return code**: EPIC should exit with code 0
2. **Output files exist**: `{site}.ACY` and `{site}.DGN` in output/
3. **Output file size > 0**: Empty files indicate failed simulation
4. **Log check**: No fatal errors in log files
5. **Quick ACY check**: `head -15 output/{site}.ACY` should show yield data

## Traps

| Trap | Symptom | Root Cause | Fix |
|------|---------|------------|-----|
| Windows .exe on Linux | Permission denied or exec format error | PE binary needs Wine | Install Wine or use Linux-compiled EPIC |
| Missing .DLY file | EPIC crashes or uses weather gen | DLY not in correct location | Check WDLSTCOM.DAT points to 1.DLY |
| EPICRUN.DAT format wrong | EPIC reads wrong site | Site ID > 9 chars or wrong flags | Keep SiteID ≤ 9 chars |
| Timeout too short | Sites never complete | Complex simulation | Increase timeout in config.yml |
| /dev/shm full | Cannot create temp dir | Too many parallel runs | Clean up old cache dirs |
| File references wrong | EPIC reads wrong files | COM.DAT files point to wrong paths | Verify all COM.DAT contents |
| EPICCONT dates don't match DLY | Uses weather generator | DLY doesn't cover period | Align DLY date range with EPICCONT |

## Example

```python
from geoEpic.core import Workspace

# Load workspace
ws = Workspace('config.yml')

# Run specific site
ws.run(site_ids=['umstead'])

# Check output
import os
for f in os.listdir('output/'):
    print(f, os.path.getsize(f'output/{f}'))
```

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…