Handles writing simulation results to various output formats.
More...
#include <ResultWriter.h>
|
| bool | WriteNetCDF (const string &path, const axd &time, const vecInt &hydroUnitIds, const axd &hydroUnitAreas, const vecStr &subBasinLabels, const vecAxd &subBasinValues, const vecStr &hydroUnitLabels, const vecAxxd &hydroUnitValues, const vecStr &hydroUnitFractionLabels=vecStr(), const vecAxxd &hydroUnitFractions=vecAxxd()) |
| |
| bool | WriteCSV (const string &path, const axd &time, const vecStr &labels, const vecAxd &values) |
| |
| bool | AppendToNetCDF (const string &filePath, int timeStep, double time, const axd &subBasinValues, const axxd &hydroUnitValues, const axxd &hydroUnitFractions=axxd()) |
| |
| string | InitializeStreamingNetCDF (const string &path, int timeSize, const vecInt &hydroUnitIds, const axd &hydroUnitAreas, const vecStr &subBasinLabels, const vecStr &hydroUnitLabels, const vecStr &hydroUnitFractionLabels=vecStr()) |
| |
|
| bool | CreateNetCDFStructure (const string &filePath, int timeSize, int numHydroUnits, int numSubBasinItems, int numHydroUnitItems, int numFractions, const vecInt &hydroUnitIds, const axd &hydroUnitAreas, const vecStr &subBasinLabels, const vecStr &hydroUnitLabels, const vecStr &hydroUnitFractionLabels) |
| |
Handles writing simulation results to various output formats.
This class is responsible for writing simulation data to files (NetCDF, CSV, etc.). It decouples the data recording/logging from the output writing concerns, allowing for flexible output strategies (snapshot-based or streaming).
◆ AppendToNetCDF()
| bool ResultWriter::AppendToNetCDF |
( |
const string & | filePath, |
|
|
int | timeStep, |
|
|
double | time, |
|
|
const axd & | subBasinValues, |
|
|
const axxd & | hydroUnitValues, |
|
|
const axxd & | hydroUnitFractions = axxd() ) |
Append a single time step to a streaming NetCDF file. This allows for progressive writing without storing all data in memory.
- Parameters
-
| filePath | Full path to the NetCDF file. |
| timeStep | Current time step index. |
| time | Current time value. |
| subBasinValues | Current sub-basin values. |
| hydroUnitValues | Current hydro unit values. |
| hydroUnitFractions | Current fraction values (optional). |
- Returns
- true if successful, false otherwise.
◆ CreateNetCDFStructure()
| bool ResultWriter::CreateNetCDFStructure |
( |
const string & | filePath, |
|
|
int | timeSize, |
|
|
int | numHydroUnits, |
|
|
int | numSubBasinItems, |
|
|
int | numHydroUnitItems, |
|
|
int | numFractions, |
|
|
const vecInt & | hydroUnitIds, |
|
|
const axd & | hydroUnitAreas, |
|
|
const vecStr & | subBasinLabels, |
|
|
const vecStr & | hydroUnitLabels, |
|
|
const vecStr & | hydroUnitFractionLabels ) |
|
protected |
Create the NetCDF file and define its structure.
- Parameters
-
| filePath | Full path to the file. |
| timeSize | Size of time dimension. |
| numHydroUnits | Number of hydro units. |
| numSubBasinItems | Number of aggregated items. |
| numHydroUnitItems | Number of distributed items. |
| numFractions | Number of land cover fractions. |
| hydroUnitIds | Vector of hydro unit IDs. |
| hydroUnitAreas | Vector of hydro unit areas. |
| subBasinLabels | Labels for sub-basin values. |
| hydroUnitLabels | Labels for hydro unit values. |
| hydroUnitFractionLabels | Labels for fractions. |
- Returns
- true if successful, false otherwise.
◆ InitializeStreamingNetCDF()
| string ResultWriter::InitializeStreamingNetCDF |
( |
const string & | path, |
|
|
int | timeSize, |
|
|
const vecInt & | hydroUnitIds, |
|
|
const axd & | hydroUnitAreas, |
|
|
const vecStr & | subBasinLabels, |
|
|
const vecStr & | hydroUnitLabels, |
|
|
const vecStr & | hydroUnitFractionLabels = vecStr() ) |
Initialize a streaming NetCDF file for progressive writing.
- Parameters
-
| path | Directory path where the output file will be created. |
| timeSize | Total number of time steps. |
| hydroUnitIds | Vector of hydro unit IDs. |
| hydroUnitAreas | Vector of hydro unit areas. |
| subBasinLabels | Labels for sub-basin values. |
| hydroUnitLabels | Labels for hydro unit values. |
| hydroUnitFractionLabels | Labels for fractions (optional). |
- Returns
- Full path to the created file, or empty string on failure.
◆ WriteCSV()
| bool ResultWriter::WriteCSV |
( |
const string & | path, |
|
|
const axd & | time, |
|
|
const vecStr & | labels, |
|
|
const vecAxd & | values ) |
Write results to a CSV file.
- Parameters
-
| path | Directory path where the output file will be created. |
| time | Time series vector. |
| labels | Column labels. |
| values | Vector of value arrays. |
- Returns
- true if successful, false otherwise.
◆ WriteNetCDF()
| bool ResultWriter::WriteNetCDF |
( |
const string & | path, |
|
|
const axd & | time, |
|
|
const vecInt & | hydroUnitIds, |
|
|
const axd & | hydroUnitAreas, |
|
|
const vecStr & | subBasinLabels, |
|
|
const vecAxd & | subBasinValues, |
|
|
const vecStr & | hydroUnitLabels, |
|
|
const vecAxxd & | hydroUnitValues, |
|
|
const vecStr & | hydroUnitFractionLabels = vecStr(), |
|
|
const vecAxxd & | hydroUnitFractions = vecAxxd() ) |
Write results to a NetCDF file.
- Parameters
-
| path | Directory path where the output file will be created. |
| time | Time series vector. |
| hydroUnitIds | Vector of hydro unit IDs. |
| hydroUnitAreas | Vector of hydro unit areas. |
| subBasinLabels | Labels for sub-basin aggregated values. |
| subBasinValues | Vector of sub-basin value arrays. |
| hydroUnitLabels | Labels for distributed hydro unit values. |
| hydroUnitValues | Vector of 2D hydro unit value arrays. |
| hydroUnitFractionLabels | Labels for land cover fractions (optional). |
| hydroUnitFractions | Vector of 2D fraction arrays (optional). |
- Returns
- true if successful, false otherwise.
The documentation for this class was generated from the following files:
- /github/workspace/core/src/base/ResultWriter.h
- /github/workspace/core/src/base/ResultWriter.cpp