7. Bundling into NetCDF + basin-atlas-style plotting (vflood-netcdf)
For "one file with the whole time series" instead of hundreds of individual .out/
.tif files — and for plotting it the same way basin-atlas plots its own gridded
NetCDF data:
vflood-rri RRI_Input.txt # 1. run the simulation
vflood-netcdf RRI_Input.txt --variables hs,hr,qr --plot-last --plot-max --geotiff-max # 2. bundle + previewWrites <out folder>/simulation.nc — dimensions (time, lat, lon), one variable per
requested output, CF-ish metadata (units, standard_name where one applies). Read via
netCDF4.Dataset (matching basin-atlas's own choice over xarray), lat/lon are
cell-center coordinates with lat descending (row 0 of every VFlood-RRI grid is the
northernmost row — this is not flipped to force ascending lat; check lat[:]
ordering rather than assume it, same caveat basin-atlas's own render_musim_geotiff.py
already documents for its inputs).
--plot-last additionally renders one PNG per variable (the last timestep) using
atlas_plot.py's ATLAS_VAR_CONFIGS — a per-variable (vmin, vmax, colormap) styling
table in the same spirit as basin-atlas's own VAR_CONFIGS dict, with optional
watershed-boundary masking via shapely.contains_xy (same approach as basin-atlas's
render_nc_preview.py):
from vflood_rri.atlas_plot import plot_netcdf_frame
plot_netcdf_frame("simulation.nc", "hs", time_index=-1, out_png="hs_final.png",
boundary="watershed.geojson") # optional--plot-max renders the peak frame instead of the last one — the last timestep
isn't necessarily the interesting one (a run's own recession tail can extend well past the
actual peak). For each variable it finds the timestep where that variable's own domain-wide
maximum occurs (postprocess.domain_max_series + hydrograph_stats) and prints which
step and real date that was:
vflood-netcdf: wrote simulation_qr_max.png (qr_max=405.4195 at step 120, t=432000s, date=2023-09-22 00:00)Needs start_date.txt for the printed date — falls back to just step/seconds without one.
--geotiff-max writes that same peak frame as a real georeferenced GeoTIFF
instead of (or alongside) the PNG — simulation_<var>_max.tif, opens directly in
QGIS/ArcGIS, same as vflood-export --formats geotiff (§6) but for the one frame that
actually matters. Independent of --plot-max — pass either or both. VFloodControl's own
"Bundle NetCDF" button always passes all three (--plot-last --plot-max --geotiff-max).
Options:
--variables hs,hr,hg,qr,gampt_ff which variables to bundle (default: hs,hr,qr)
--out <path> default: <out folder>/simulation.nc
--plot-last also render a preview PNG per variable (last timestep)
--plot-max also render + report the peak frame per variable
--geotiff-max also write the peak frame as a real georeferenced GeoTIFF