Modeling for the Rio Grande Project Drought Resilience Efforts (DRE) Initiative
This repo contains a minimal setup for running a rainfall/runoff workflow with gridded inputs.
-
run.sh
main runner script containing the shell commands for running grass modules in sequence. -
data/
rainfall depth inputs (text files), e.g.rain_1h_depths.txt,rain_24h_depths.txt. -
spatial_data/
geospatial rasters used by the workflow:dem.tif: original demdem_modified.tif: processed dem used for modelingesa.tif: land cover rastern_low.tif: manning n (low roughness) rasterhsg.md: notes/metadata for hydrologic soil group inputs
-
LICENSE
project license.
This repo also includes a GRASS + Bash + R workflow to download PRISM climate rasters and compute area-weighted watershed time series for precipitation and temperature.
import_prism_rasters.sh— import PRISM zip rasters into GRASScreate_prism_grid_4km.sh— build PRISM 4 km grid vectorunion_prism_area_grid.sh— intersect grid with watershed and compute cell areascalc_weighted_avg_prism.sh— compute area-weighted daily ppt/tmax/tminprec_analysis.R— precipitation statistics and plots
Run inside an active GRASS GIS session:
m.prism.download dataset=0,2,4 start_date=1990-01-01 end_date=2023-12-31bash import_prism_rasters.sh
sh create_prism_grid_4km.sh
sh union_prism_area_grid.sh
sh calc_weighted_avg_prism.shRscript prec_analysis.RThis repo includes a Bash script that automates a SIMWE (r.sim.water) run and then computes the sum of discharge raster values within a buffered corridor around a line defined by two coordinates.
Given gridded inputs (DEM, dx, dy, Manning’s n) and a rainfall intensity:
- Runs
r.sim.waterto generate depth and discharge rasters. - Builds a 2-point line vector from
(x1, y1)→(x2, y2). - Buffers the line as a vector polygon (robust for short lines).
- Rasterizes the buffered polygon to create a mask.
- Extracts discharge values where the mask is present.
- Calculates the sum of extracted discharge values for the last output timestep (equal to
niterations).
Note: The “last timestep” discharge map
q_<outprefix>.<niterations>exists only ifniterationsis a multiple ofoutput_step.
simw_line_sum_pure.sh— pure Bash (nog.parser) SIMWE + line-buffer + discharge-sum workflow
- GRASS GIS (with
r.sim.water,v.in.ascii,v.buffer,v.to.rast,r.mapcalc,r.univar) - A GRASS Location/Mapset containing the rasters:
elevation(DEM)dx,dyman(Manning’s n raster or constant)
- Coordinates
x1,y1,x2,y2in the same CRS as your GRASS Location.
Run inside an active GRASS session:
chmod +x simw_line_sum_pure.sh
./simw_line_sum_pure.sh \
elevation=dem_3m_mod dx=dx_mod dy=dy_mod man=n_low \
rain=23 niterations=60 output_step=60 nprocs=4 \
outprefix=2y1h_mod \
x1=-1030077.451885954 y1=1125099.4959982967 \
x2=-1030095.7392827778 y2=1125112.068581797 \
buffer=3