38#ifndef OPENSWMM_ENGINE_GAGE_DATA_HPP
39#define OPENSWMM_ENGINE_GAGE_DATA_HPP
333 int count() const noexcept {
return static_cast<int>(
source.size()); }
345 const auto un =
static_cast<std::size_t
>(n);
350 ts_name.assign(un, std::string{});
396 const auto un =
static_cast<std::size_t
>(n);
397 auto g = [&](
auto& v,
auto def) { v.resize(un, def); };
401 ts_name.resize(un, std::string{});
423 g(
st_init,
static_cast<uint8_t
>(0));
424 g(
st_used,
static_cast<uint8_t
>(0));
446 const auto ui =
static_cast<std::size_t
>(idx);
447 auto e = [&](
auto& v) {
449 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(idx));
480 const auto base = ui *
static_cast<std::size_t
>(
MAXPASTRAIN);
481 const auto end = base +
static_cast<std::size_t
>(
MAXPASTRAIN);
484 past_rain.begin() +
static_cast<std::ptrdiff_t
>(end));
536 std::fill(
st_init.begin(),
st_init.end(),
static_cast<uint8_t
>(0));
537 std::fill(
st_used.begin(),
st_used.end(),
static_cast<uint8_t
>(0));
Carrier for an external file reference in a SWMM model.
Time series and rating curve data with bidirectional cursor.
Definition ExchangeLaw.hpp:60
RainFileFormat
Rain data format in an external file.
Definition GageData.hpp:66
@ HLY_PRCP
HLY_PRCP format.
Definition GageData.hpp:72
@ STAN_PRCP
Standard SWMM rain file.
Definition GageData.hpp:73
@ NWS_HOURLY
NWS hourly data.
Definition GageData.hpp:69
@ USER_CSV
Definition GageData.hpp:74
@ UNKNOWN
Definition GageData.hpp:67
@ NWS_15
NWS 15-minute data.
Definition GageData.hpp:68
@ DSI_3260
NCDC DSI 3260 15-minute.
Definition GageData.hpp:71
@ DSI_3240
NCDC DSI 3240 hourly.
Definition GageData.hpp:70
RainSource
Precipitation source type for a rain gage.
Definition GageData.hpp:57
@ FILE_RAIN
Data from an external rain file.
Definition GageData.hpp:59
@ TIMESERIES
Data from an in-file [TIMESERIES].
Definition GageData.hpp:58
Structure-of-Arrays storage for all rain gages.
Definition GageData.hpp:95
std::vector< double > api_rainfall
Current API (antecedent precipitation index) rainfall.
Definition GageData.hpp:240
std::vector< int > rain_units
Rain depth units declared in the [RAINGAGES] FILE row: 0 = IN, 1 = MM.
Definition GageData.hpp:154
std::vector< double > file_first_date
First record date found for this gage's station (OADate, 0 = none).
Definition GageData.hpp:163
std::vector< std::string > comments
Object comment from the INP file (';'-prefixed lines immediately above this gage's data row),...
Definition GageData.hpp:314
std::vector< double > file_last_date
Last record date found for this gage's station (OADate, 0 = none).
Definition GageData.hpp:166
std::vector< bool > is_raining
Current state flag (0 = no rain, 1 = raining).
Definition GageData.hpp:252
std::vector< double > snow_factor
Snow catch deficiency correction factor (1.0 = no correction).
Definition GageData.hpp:205
std::vector< double > file_start_date
[RAINGAGES] FILE StartDate (OADate day, 0 = none / *).
Definition GageData.hpp:176
std::vector< int > ts_index
Time series index (when source == TIMESERIES).
Definition GageData.hpp:114
std::vector< std::string > col_name
Column name in the external multi-column file (source == FILE_RAIN).
Definition GageData.hpp:136
static constexpr int MAXPASTRAIN
Max past hours tracked per gage.
Definition GageData.hpp:290
std::vector< FilePathPair > file_path
External rain file path (when source == FILE_RAIN).
Definition GageData.hpp:123
std::vector< Table > rain_series
Resolved rainfall series for a FILE_RAIN gage (full file record).
Definition GageData.hpp:187
void reset_state() noexcept
Clear dynamic rain values, state-machine cursors and antecedent history.
Definition GageData.hpp:528
int count() const noexcept
Count rain gages from the source-type column.
Definition GageData.hpp:333
std::vector< double > next_rain_date
Simulation time of the next recorded value (decimal days).
Definition GageData.hpp:246
std::vector< std::string > ts_name
Timeseries name (for deferred resolution when TS parsed after gages).
Definition GageData.hpp:128
void grow_to(int n)
Extend rain-gage arrays to a requested total while preserving their prefixes.
Definition GageData.hpp:393
std::vector< double > scale_factor
Rainfall scaling factor (1.0 = no scaling).
Definition GageData.hpp:218
std::vector< int > co_gage_index
Gap #53: Co-gage index — index of the primary gage sharing the same timeseries, or -1 if this gage re...
Definition GageData.hpp:323
std::vector< double > st_rain
Definition GageData.hpp:282
std::vector< uint8_t > st_used
Definition GageData.hpp:284
std::vector< int > interval_sec
Recording interval in seconds.
Definition GageData.hpp:199
std::vector< double > past_rain_accum
Per-gage accumulator for the current partial hour.
Definition GageData.hpp:296
std::vector< int > st_next
Definition GageData.hpp:281
std::vector< double > next_rainfall
Rainfall rate at the next recorded interval (for interpolation).
Definition GageData.hpp:234
void shrink_to_fit()
Release excess vector capacity accumulated during parsing.
Definition GageData.hpp:490
std::vector< uint8_t > st_init
Definition GageData.hpp:283
std::vector< long > file_periods_precip
Number of records with precipitation > 0 for this station.
Definition GageData.hpp:169
std::vector< RainFileFormat > file_format
Rain file format.
Definition GageData.hpp:193
std::vector< double > past_rain_interval
Per-gage seconds in the current partial hour (0..3600).
Definition GageData.hpp:299
std::vector< int > rain_type
Rain data type: 0=INTENSITY, 1=VOLUME, 2=CUMULATIVE.
Definition GageData.hpp:105
std::vector< int > st_cur
Legacy rain-gage state machine (gage_initState / gage_setState / getNextRainfall),...
Definition GageData.hpp:280
void erase_at(int idx)
Erase a gage from the columns visited by this helper.
Definition GageData.hpp:445
std::vector< std::string > station_id
Station ID for a standard SWMM rain file (when source == FILE_RAIN).
Definition GageData.hpp:146
std::vector< double > cumul_rain_accum
Gap #31: Cumulative rainfall accumulator (project rain units).
Definition GageData.hpp:307
std::vector< double > rainfall
Current rainfall rate (project length/time units — inches or mm/hr).
Definition GageData.hpp:228
std::vector< RainSource > source
Precipitation source (TIMESERIES or FILE).
Definition GageData.hpp:108
void resize(int n)
Replace rain-gage configuration and runtime arrays with defaults.
Definition GageData.hpp:344
std::vector< double > past_rain
Flat 2D: [gage * MAXPASTRAIN + hour]. Hourly rain totals.
Definition GageData.hpp:293
Definition TableData.hpp:154