OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::climate::HourlyMeteorology Class Reference

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>

Collaboration diagram for openswmm::climate::HourlyMeteorology:

Public Member Functions

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.
 

Detailed Description

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.

Member Function Documentation

◆ 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
startFinite absolute SWMM interval-start day within cached coverage.
secondsFinite positive duration seconds; can span multiple days. The last record supplies a complete additional hour, rather than only an endpoint sample.
[out]resultFive 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ load()

std::string openswmm::climate::HourlyMeteorology::load ( const std::string & path)

Open a text weather file and replace the cache through read().

Parameters
pathFilename 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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

std::string openswmm::climate::HourlyMeteorology::read ( std::istream & stream)

Replace the cache with validated consecutive hourly records from a stream.

Parameters
[in,out]streamBorrowed 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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

The documentation for this class was generated from the following files: