SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
gageblend.h File Reference

Volume-conserving weighted blend of rain-gage time series. More...

#include <QString>
#include <QVector>
#include <QtGlobal>
Include dependency graph for gageblend.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GageBlend::SeriesPoint
 One (time, value) entry of a rainfall series. More...
 
struct  GageBlend::SourceGage
 A contributing gage: its series plus everything needed to read it. More...
 
struct  GageBlend::Box
 A constant-intensity interval, [t0, t1), in depth/hour. More...
 
struct  GageBlend::BlendResult
 Outcome of one blend. More...
 

Namespaces

namespace  GageBlend
 

Enumerations

enum class  GageBlend::RainType {
  GageBlend::Intensity = 0 ,
  GageBlend::Volume = 1 ,
  GageBlend::Cumulative = 2
}
 Rain-data format, matching SWMM_GageRainType. More...
 

Functions

QVector< BoxGageBlend::toBoxes (const SourceGage &source)
 Expand one source into explicit intensity boxes.
 
double GageBlend::boxDepth (const QVector< Box > &boxes)
 Total depth carried by a box list.
 
double GageBlend::engineDepth (const QVector< SeriesPoint > &points, qint64 intervalSec, RainType rainType=RainType::Intensity, double scaleFactor=1.0)
 Total depth of an emitted series under the ENGINE's boxcar rule.
 
BlendResult GageBlend::blend (const QVector< SourceGage > &sources, const QVector< double > &weights)
 Blend sources under weights into one INTENSITY series.
 

Variables

constexpr int GageBlend::kMaxGridCells = 200000
 Ceiling on grid cells, so a pathological gcd cannot melt the model.
 
constexpr double GageBlend::kVolumeTolerance = 1e-9
 Relative tolerance for the volume-conservation check.
 

Detailed Description

Volume-conserving weighted blend of rain-gage time series.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Produces the single synthetic series that represents a weighted combination of several rain gages — the data half of an interpolated-gage assignment.

The blend must reproduce the ENGINE's reading of a rainfall series, not the intuitive one. Per Gage.cpp::updateAllGages, an entry at t_k is a BOXCAR, not a hold: it applies over [t_k, t_k + I) where I is the GAGE's recording interval, and rainfall is zero in the gaps between boxes and after the last entry. An entry that starts before the previous box ends preempts it.

Consequently the blend cannot simply union timestamps and combine values — that silently changes total depth whenever the sources' intervals differ. Instead each source is expanded to explicit boxes in the intensity domain, and those boxes are integrated exactly onto a common grid of pitch gcd(intervals). Volume is then conserved cell-wise, and therefore globally, for any mix of intervals and alignments.

Output is always INTENSITY: it is the only rain type whose stored value does not depend on the interval field, so a later edit to the interval — or the h:mm truncation the INP writer applies — cannot silently rescale the total.

Leaf module: no Qt-GUI, engine, or GDAL dependency. Times are plain seconds since the epoch so the module stays testable without QDateTime.