Skip to content
Back to skills

Docs

ASecurity

> **Stage ID**: s1_installation > **Pipeline order**: 1 of 9 > **Depends on**: none

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

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 15 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-4d5a51b2/badge)](https://www.skillsdirectory.com/skills/lzwei196-docs-4d5a51b2)

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
# Installation & Environment Setup — Skill Document

> **Stage ID**: s1_installation
> **Pipeline order**: 1 of 9
> **Depends on**: none

## Purpose

Install and verify the MODFLOW 6 binary (`mf6`) and the FloPy Python package. Without these, no groundwater simulation can be built or executed. MODFLOW 6 is a standalone Fortran executable; FloPy is the Python interface that generates its input files and reads its output files.

## Prerequisites

Before starting this stage, verify:

- [ ] Python 3.8+ is available (preferably the HydroCraft venv)
- [ ] Internet access for downloading binaries or pip packages (first-time only)
- [ ] Write access to a directory for the mf6 binary

## Inputs

| Input | Type | Source | Description |
|-------|------|--------|-------------|
| python_env | directory | HydroCraft config | Python environment path (`KISSPATH_PYTHON_ENV/`) |

## Procedure

### Step 1: Install FloPy

```bash
source KISSPATH_PYTHON_ENV/bin/activate
pip install flopy
```

Verify:
```bash
python -c "import flopy; print(f'FloPy {flopy.__version__}')"
```

**Expected result**: FloPy version >= 3.4.0 printed.

**If this fails**: Check pip is from the correct venv. See diagnostic triplet dt_mf6_007.

### Step 2: Obtain MODFLOW 6 Binary

**Option A — Pre-built binary (recommended):**

Download from USGS GitHub releases:
```bash
python -c "
import flopy.utils
flopy.utils.get_modflow(bindir='KISSPATH_KI_ROOT/MODFLOW6/bin/')
"
```

This downloads the latest mf6 binary for your platform.

**Option B — Compile from source:**

Requires gfortran and meson:
```bash
git clone https://github.com/MODFLOW-ORG/modflow6.git
cd modflow6
meson setup builddir --prefix=$(pwd)/install
meson compile -C builddir
meson install -C builddir
```

The binary will be at `install/bin/mf6`.

### Step 3: Verify mf6 Binary

```bash
KISSPATH_KI_ROOT/MODFLOW6/bin/mf6 --version
```

**Expected result**: Version string like `mf6: 6.5.0 Release 12/01/2023`

**If this fails**: Check executable permissions (`chmod +x mf6`). On Linux, verify glibc compatibility. See dt_mf6_007.

### Step 4: Run Verification Tool

```bash
python tools/s1/verify_mf6_installation.py
```

**Expected result**: JSON output with `status: "ok"`, `mf6_version`, `flopy_version`.

## Expected Outputs

| Output | Path | Verification |
|--------|------|--------------|
| mf6 binary | `models/MODFLOW6/bin/mf6` | Executable, returns version string |
| FloPy package | Python site-packages | `import flopy` succeeds |

## Validation Checks

1. **FloPy import**: `python -c "import flopy"` exits with code 0
   - Expected: No error
   - If unexpected: See dt_mf6_007

2. **mf6 runs**: `mf6 --version` returns version string
   - Expected: Version >= 6.4.0
   - If unexpected: Check PATH, executable permissions, glibc version

3. **FloPy finds mf6**: `python -c "import flopy; print(flopy.which('mf6'))"`
   - Expected: Returns path to mf6 binary
   - If unexpected: Add mf6 directory to PATH or pass explicit path to `sim.run_simulation(exe_name=...)`

## Common Pitfalls

> **PITFALL**: FloPy version incompatibility with MODFLOW 6 version
> Older FloPy versions may not support newer MODFLOW 6 packages (e.g., CSUB, PRT). Always use FloPy >= 3.4.0 with MODFLOW 6 >= 6.4.0.
> **Do this instead**: `pip install --upgrade flopy`
> See diagnostic triplet dt_mf6_007.

> **PITFALL**: mf6 binary not on PATH
> FloPy's `sim.run_simulation()` searches PATH for `mf6`. If the binary is in a custom location, the run will fail with "mf6 not found".
> **Do this instead**: Pass the full path: `sim.run_simulation(exe_name="/path/to/mf6")`

---

*This skill document is part of the modflow6-knowledge-infrastructure package.*
*Stage 1 of 9 | Tools used: verify_mf6_installation | Related triplets: dt_mf6_007*

Files in this skill

  • REFERENCES.md1.5 KB
  • format_spec.yaml30.6 KB
  • model_couplings.yaml9.9 KB
  • papers.json6.2 KB
  • s1_installation_skill.md3.7 KB
  • s2_grid_discretization_skill.md5.8 KB
  • s3_layer_properties_skill.md5.6 KB
  • s4_boundary_conditions_skill.md7.6 KB
  • s5_stress_periods_skill.md6.1 KB
  • s6_solver_skill.md5.2 KB
  • s7_execution_skill.md5.7 KB
  • s8_output_extraction_skill.md6.3 KB
  • s9_postprocessing_skill.md6.6 KB
  • validation_convention.yaml9.1 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…