Skip to content

PREP-NexT/VIC-CaMa-Flood

Repository files navigation

VIC-CaMa-Flood Pipeline

This repository provides a streamlined pipeline for driving the CaMa-Flood (v4.2.0+) hydrodynamic model using global runoff data from the VIC model.

Prerequisites

  • CaMa-Flood: Compiled and installed (e.g., MAIN_cmf executable is ready).
  • Python 3: With xarray, pandas, numpy, and netCDF4 installed.
  • VIC Runoff Data: NetCDF files (e.g., 0.25° resolution) covering the simulation period.

Pipeline Workflow

1. Data Conversion (NetCDF to Binary)

CaMa-Flood requires daily runoff forcing in plain binary (float32) format. The convert_nc_to_bin.py script reorders the longitude from [0, 360] to [-180, 180] and extracts daily layers.

Batch process all files:

# Run this in the directory containing your VIC .nc files
for f in *.nc; do
    python3 convert_nc_to_bin.py -d . -n "$f"
done

Note: This creates a runoff/ subdirectory with files named Roff____YYYYMMDD.one.

2. Configuration & Simulation

The shell script VIC_global_sim_0p25_1960-2024.sh automates the multi-year simulation.

  1. Update Paths: Open the script and modify the following variables:
    • CURRDIR: Path to your script directory.
    • BASE: Path to your CaMa-Flood installation root.
    • CROFDIR: Path to the converted binary runoff files.
    • FMAP: Path to your CaMa-Flood river map (e.g., glb_noAntarctica_15min).
  2. Set Time Range: Adjust YSTA (1960) and YEND (2024) if necessary.
  3. Run:
    bash VIC_global_sim_0p25_1960-2024.sh

Critical Checks

  • Runoff Units:
    • VIC runoff in NetCDF is often stored as mm/day (or mm/step), but metadata might sometimes say m/day.
    • The pipeline currently assumes input is mm/day and uses DROFUNIT = 86400000 to convert to m/s.
    • Verification: If your results are off by a factor of 1000, check if your input is actually m/day. If so, set DROFUNIT = 86400.
  • Longitude Order: The conversion script automatically rolls the longitude to center at 0° (Greenwich), matching CaMa-Flood's standard map orientation.

Reference Info

  • VIC Runoff Metadata: See dim_info_of_VIC_runoff_nc.txt for the expected NetCDF structure.

Results at a Glance

Some comparisons between the simulations and the GRDC observations in Southeast Asia are made. The results can be found @results_visualization/.

About

Baked setup for CaMa-Flood driven by VIC runoff

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors