Owned consecutive hourly records with interval-weighted means. Concurrent const queries are safe only while the cache is stable; serialize load/read/destruction with readers and release borrowed records before reload.
More...
#include <HourlyMeteorology.hpp>
|
| std::string | read (std::istream &stream) |
| | Replace the cache with validated consecutive hourly records from a stream.
|
| |
| std::string | load (const std::string &path) |
| | Open a text weather file and replace the cache through read().
|
| |
| std::string | average (double start, double seconds, std::array< double, 5 > &result) const |
| | Compute duration-weighted means of hourly piecewise-constant weather.
|
| |
| bool | empty () const noexcept |
| | Test whether any validated records are stored.
|
| |
| const std::vector< HourlyMetRecord > & | records () const noexcept |
| | Borrow immutable hourly starts and their complete-hour weather values.
|
| |
Owned consecutive hourly records with interval-weighted means. Concurrent const queries are safe only while the cache is stable; serialize load/read/destruction with readers and release borrowed records before reload.
◆ average()
| std::string openswmm::climate::HourlyMeteorology::average |
( |
double | start, |
|
|
double | seconds, |
|
|
std::array< double, 5 > & | result ) const |
Compute duration-weighted means of hourly piecewise-constant weather.
- Parameters
-
| start | Finite absolute SWMM interval-start day within cached coverage. |
| seconds | Finite positive duration seconds; can span multiple days. The last record supplies a complete additional hour, rather than only an endpoint sample. |
| [out] | result | Five means in record order/units (C, percent, m/s, W/m2, W/m2), assigned only on success and retained on normal failure. |
- Returns
- Empty on success, otherwise invalid-request/coverage diagnostic. Uses second offsets to avoid adding tiny durations to large serial-day values; snaps near-hour boundaries within 1e-5 s and tolerates that much missing endpoint span. Normalizes by actually covered duration, not requested duration. No file access, interpolation, record mutation or simulation-clock advancement occurs.
◆ empty()
| bool openswmm::climate::HourlyMeteorology::empty |
( |
| ) |
const |
|
inlinenoexcept |
Test whether any validated records are stored.
- Returns
- True before the first successful read/load or after replacement by a fresh default object. Failed reads retain the old cache and its empty state.
◆ load()
| std::string openswmm::climate::HourlyMeteorology::load |
( |
const std::string & | path | ) |
|
Open a text weather file and replace the cache through read().
- Parameters
-
| path | Filename passed to std::ifstream; no input-relative resolution here. |
- Returns
- Empty on successful parse; open/parse/read diagnostic otherwise. Old records remain on normal failure. The temporary stream is closed on return; subsequent average() calls read only memory. Exceptions can propagate.
◆ read()
| std::string openswmm::climate::HourlyMeteorology::read |
( |
std::istream & | stream | ) |
|
Replace the cache with validated consecutive hourly records from a stream.
- Parameters
-
| [in,out] | stream | Borrowed text input consumed through EOF or first rejection; never closed/rewound. Lines follow Input Tokenizer's comment/whitespace rules. Each nonempty record has exactly date, HH:00 and five numeric weather fields. |
- Returns
- Empty on success; otherwise line/coverage/read diagnostic retaining the previous cache. Requires valid positive SWMM calendar days; hour [0,23], minute zero, finite temperature (-100,70] C, RH [0,100] percent, and nonnegative wind m/s and radiation W/m2. Adjacent starts differ by 3600 seconds within 1e-5 s. Empty input is rejected. Standard stream exceptions/allocation failures propagate.
◆ records()
| const std::vector< HourlyMetRecord > & openswmm::climate::HourlyMeteorology::records |
( |
| ) |
const |
|
inlinenoexcept |
Borrow immutable hourly starts and their complete-hour weather values.
- Returns
- Owned vector reference valid until destruction. A successful reload replaces storage and invalidates element references/iterators; failed reloads retain it. Caller serializes replacement and copies data that must outlive it.
The documentation for this class was generated from the following files: