BeClaude

vic-skill

New
GitHubDocumentationby earth-space-ai

Deep skill / knowledge package for the Variable Infiltration Capacity (VIC) macroscale hydrologic model. SKILL.md routing hub plus reference/ deep-dive docs covering architecture, classic vs image drivers, physics, routing, output, debugging, and contributing.

Community PluginView Source

Overview

VIC, Complete Guide

VIC = Variable Infiltration Capacity macroscale hydrologic model

Maintainer: UW Hydro | Computational Hydrology, University of Washington

Source: https://github.com/UW-Hydro/VIC

Documentation: http://vic.readthedocs.org

Original VIC paper: Liang et al. 1994, JGR, doi:10.1029/94JD00483

VIC 5 paper: Hamman et al. 2018, GMD 11:3481-3496, doi:10.5194/gmd-11-3481-2018

What VIC does: Solves the coupled water and energy balance at the land surface over a regular grid of large (typically 1/16 to 2 degree) cells. Subgrid heterogeneity in soil infiltration capacity, vegetation cover, and elevation is represented statistically rather than spatially. Each grid cell is simulated independently; horizontal routing is performed off-line by a companion model (Lohmann or RVIC). VIC has been used in regional, continental, and global hydrologic studies and is the land component of the Regional Arctic System Model (RASM).

Who this skill is for: Agents, students, and researchers who want to download, build, run, modify, debug, and contribute to VIC.


Quick Decision Tree

code
"What do I need?"
|
+-- First time. What is VIC and how do I install it?
|   Read: reference/getting-started.md
|   (clone UW-Hydro/VIC, pick a driver, install C compiler / netCDF / MPI)
|
+-- I want to run a single basin or set of stations on a laptop
|   Read: reference/running-classic-driver.md
|   (vic_classic.exe, ASCII or binary global parameter file, soil, veg, forcing)
|
+-- I want to run a continental or global gridded simulation in parallel
|   Read: reference/running-image-driver.md
|   (vic_image.exe, NetCDF I/O, MPI, domain file, image parameter file)
|
+-- I need to know what physics VIC actually solves
|   Read: reference/physics-overview.md
|   (variable infiltration curve, ARNO baseflow, two-layer snow,
|    Cherkauer-Lettenmaier frozen soil, lakes, organic soil)
|
+-- I need to control or extend VIC output
|   Read: reference/output-and-postprocess.md
|   (history streams, OUTVAR, AGGFREQ, default fluxes, state files,
|    HowToAddNewOutputVars)
|
+-- I need to route VIC runoff into a streamflow hydrograph
|   Read: reference/routing-and-streamflow.md
|   (Lohmann offline, RVIC, image driver in-line routing, MOSART under CESM)
|
+-- I want to understand the source-code layout before editing
|   Read: reference/architecture.md
|   (vic_run physics core, drivers/{classic,image,cesm,python},
|    drivers/shared_all, extensions/rout_rvic)
|
+-- I want to submit a pull request to UW-Hydro/VIC
|   Read: reference/contributing-pr.md
|   (fork, develop branch, uncrustify, Travis CI, tests/run_tests.py)
|
+-- The model won't compile, won't run, or gives bad output
    Read: reference/debugging.md
    (parameter file format errors, NaN fluxes, water balance closure,
     frozen soil convergence, T iteration failures, TFALLBACK)

What's Inside the VIC Source Tree

code
VIC/                                       <- UW-Hydro/VIC repository root
+-- ci/                                    <- Travis CI scripts and Dockerfile
+-- docs/                                  <- mkdocs source for vic.readthedocs.org
+-- samples/                               <- sample parameters + plotting notebooks
|   +-- get_sample_data.bash               <- pulls VIC_sample_data submodule
|   +-- vic_parameters.txt                 <- example constants file
|   +-- notebooks/
+-- tests/                                 <- run_tests.py, test_image_driver.py, etc.
|   +-- examples/                          <- Stehekin example global parameter files
|   +-- system/, science/, unit/, release/
+-- tools/                                 <- code_format/run_uncrustify.bash, ide/
+-- vic/
    +-- vic_run/                           <- physics core (driver-independent)
    |   +-- include/                       <- vic_def.h, vic_run.h, vic_log.h,
    |   |                                     vic_physical_constants.h
    |   +-- src/                           <- runoff.c, frozen_soil.c, snow_melt.c,
    |                                         calc_surf_energy_bal.c, lakes.eb.c,
    |                                         photosynth.c, ... (~60 files)
    +-- drivers/
    |   +-- classic/                       <- vic_classic.exe (ASCII / binary I/O)
    |   +-- image/                         <- vic_image.exe (NetCDF + MPI)
    |   +-- cesm/                          <- CESM/RASM coupling (Fortran bindings)
    |   +-- python/                        <- Python CFFI bindings (vic.lib)
    |   +-- shared_all/                    <- shared C source for every driver
    |   |   +-- src/put_data.c, vic_history.c, history_metadata.c, ...
    |   +-- shared_image/                  <- shared between image-like drivers
    +-- extensions/
        +-- rout_rvic/                     <- in-line RVIC routing (image driver)
        +-- rout_stub/                     <- no-op stub (default, no routing)

For most users: edit a global parameter file, point it at soil, veg, forcing, and (optionally) snow band and lake files, then run vic_classic.exe -g global.txt or mpiexec -np N vic_image.exe -g global.txt. Source-code edits live in vic/vic_run/src/ (physics) and vic/drivers/<driver>/src/ (driver glue).


Critical Rules

  1. Pick the right driver before you start. Classic for offline single-cell

to small-basin runs and quick tests. Image for parallel gridded runs that need NetCDF I/O. CESM only inside RASM (treat as experimental). Python for unit testing and embedding the vic_run API. Mixing classic inputs with image-driver runs requires the samples/notebooks/example_reformat_vic4_parameters_to_vic5image.ipynb conversion or the Ascii_to_NetCDF_params tutorial.

  1. **AreaFract, Pfactor, zone_fract, and Cv must each sum to 1.0

exactly per cell. When `SNOW_BAND` is on, the area-weighted `elevation` must equal the mean grid cell `elev`. VIC prints `* WARNING ***` when these are violated. The model still runs but the water balance silently drifts.

  1. Forcing time stamps are period-beginning. A run starting

1979-01-01 00:00:00 expects the first forcing record to cover 00:00:00 to 01:00:00 for an hourly run. History output is also period-beginning. Sub-daily inputs are interpreted in the time zone given by off_gmt in the soil parameter file.

  1. **MODEL_STEPS_PER_DAY >= SNOW_STEPS_PER_DAY >= RUNOFF_STEPS_PER_DAY,

each must divide evenly into the others, and SNOW_STEPS_PER_DAY >= 4.** In FULL_ENERGY = TRUE mode, MODEL_STEPS_PER_DAY must equal SNOW_STEPS_PER_DAY. Forcings must be supplied at the snow timestep.

  1. Routing is separate. Classic VIC writes per-cell runoff and baseflow;

convert to streamflow by running Lohmann or RVIC offline. The image driver can call RVIC in-line via make ROUT=rout_rvic, but you still need an RVIC parameter file and a domain file that exactly matches the VIC grid.

  1. `uncrustify` your changes before submitting a pull request. Travis CI

runs tools/code_format/run_uncrustify.bash and fails on style drift. Use the same uncrustify 0.64+ binary that the project ships.

  1. The science test suite needs the `VIC_sample_data` submodule. Run

samples/get_sample_data.bash once after cloning. The Stehekin Basin sample (10 days of forcing) backs the system and example test configurations.


Quick Start (Classic Driver, Stehekin Basin)

bash
# 1. Get the code and the sample data
git clone https://github.com/UW-Hydro/VIC.git
cd VIC
./samples/get_sample_data.bash

# 2. Build the classic driver
cd vic/drivers/classic
make
ls vic_classic.exe        # should now exist

# 3. Run the sample basin (10 days)
cd ../../../tests/examples
mkdir -p out
../../vic/drivers/classic/vic_classic.exe \
    -g global_param.classic.STEHE.txt

# 4. Inspect the fluxes file
ls out/
head out/fluxes_*.txt

The same flow with the image driver:

bash
cd vic/drivers/image
make                              # requires netCDF4 and MPI
mpiexec -np 4 ./vic_image.exe \
    -g ../../../tests/examples/global_param.image.STEHE.feb.txt

Full walkthroughs in reference/getting-started.md, reference/running-classic-driver.md, and reference/running-image-driver.md.


Reference Documents

DocumentWhat's inside
reference/getting-started.mdRepo layout, picking a driver, dependencies (gcc, clang, netCDF4, MPI, Python+CFFI), building each driver, what success looks like
reference/architecture.mdvic/vic_run physics core, drivers/{classic,image,cesm,python}, drivers/shared_all, drivers/shared_image, extensions/rout_rvic, key data structures (atmos_data, soil_con, cell_data, veg_var, energy, snow_data, lake_var)
reference/physics-overview.mdVariable infiltration capacity surface runoff, ARNO baseflow, gravity drainage between layers (Brooks-Corey), two-layer snowpack energy balance, canopy snow interception, blowing snow, frozen soil (Cherkauer-Lettenmaier finite difference) vs Liang-1999 quick flux, spatial frost, organic soil thermal properties, dynamic lake/wetland, optional carbon cycle
reference/running-classic-driver.mdvic_classic.exe -g, global parameter file structure (simulation, energy, soil-T, precip, forcing, parameters, lakes, output), soil parameter file column layout, vegetation library and parameter files, snow band file, ASCII vs binary forcings
reference/running-image-driver.mdDomain NetCDF (mask, area, frac), parameter NetCDF (Stehekin example), NetCDF forcings, MPI launch, OpenMP threads, in-line RVIC routing toggle, restarting from a NetCDF state file
reference/output-and-postprocess.mdHistory streams (OUTFILE, AGGFREQ, OUT_FORMAT, OUTVAR with <format> <type> <multiplier> <aggtype>), default fluxes/snow/fdepth files, state file contents, HowToAddNewOutputVars end-to-end, log files
reference/routing-and-streamflow.mdWhy routing is separate, Lohmann offline (UW-Hydro/VIC_Routing, deprecated), RVIC offline (UW-Hydro/RVIC), in-line RVIC inside the image driver (make ROUT=rout_rvic, ROUT_PARAM, OUT_DISCHARGE, RVIC ring state), MOSART under CESM/RASM
reference/debugging.mdParameter file format errors, energy balance convergence failures (snow_intercept, calc_atmos_energy_bal, calc_surf_energy_bal, solve_T_profile), TFALLBACK and the *_FBFLAG outputs, water balance closure check, frozen soil instability, ET > PET, image driver MPI gotchas
reference/contributing-pr.mdFork, branching off develop, naming convention, atomic commits, tools/code_format/run_uncrustify.bash, running tests/run_tests.py (unit, system, examples, science), opening the PR, Travis CI gates, the UW-Hydro release cycle

Install & Usage

1
Create the skills directory
mkdir -p .claude/skills
2
Download the skill file
mkdir -p .claude/skills && curl -o .claude/skills/vic-skill.md https://raw.githubusercontent.com/earth-space-ai/vic-skill/main/SKILL.md
3
Invoke in Claude Code
/vic-skill
View source on GitHub

Frequently Asked Questions

What is vic-skill?

Deep skill / knowledge package for the Variable Infiltration Capacity (VIC) macroscale hydrologic model. SKILL.md routing hub plus reference/ deep-dive docs covering architecture, classic vs image drivers, physics, routing, output, debugging, and contributing.

How to install vic-skill?

To install vic-skill, create the .claude/skills directory in your project, then run the curl command to download the skill file. Once installed, invoke it in Claude Code with /vic-skill.

What is vic-skill best for?

vic-skill is a community categorized under Documentation. Created by earth-space-ai.