Class for writing time-series data to NetCDF file.
More...
#include <time_series_writer.hpp>
|
| | TimeSeriesWriter (const std::string &file_path, bool create=true) |
| | Constructor to create a TimeSeriesWriter object for writing time-series data with a single variable.
|
| |
| | TimeSeriesWriter (const std::string &file_path, bool create, const std::vector< std::string > &channel_names, const std::vector< std::string > &channel_units={}, size_t buffer_size=kDefaultBufferSize) |
| | Constructor to create a TimeSeriesWriter with predefined channels and buffering.
|
| |
| | ~TimeSeriesWriter () |
| | Destructor flushes any remaining buffered rows.
|
| |
| | TimeSeriesWriter (const TimeSeriesWriter &)=delete |
| |
| TimeSeriesWriter & | operator= (const TimeSeriesWriter &)=delete |
| |
| | TimeSeriesWriter (TimeSeriesWriter &&)=delete |
| |
| TimeSeriesWriter & | operator= (TimeSeriesWriter &&)=delete |
| |
| void | WriteValuesAtTimestep (const std::string &variable_name, size_t timestep, std::span< const double > values) |
| | Writes multiple values for a time-series variable at a specific timestep.
|
| |
| void | WriteValueAtTimestep (const std::string &variable_name, size_t timestep, const double &value) |
| | Writes a single value for a time-series variable at a specific timestep.
|
| |
| void | WriteRowAtTimestep (size_t timestep, std::span< const double > row) |
| | Writes a full row (all channels) at a specific timestep.
|
| |
| void | Flush () |
| | Flushes any remaining buffered rows.
|
| |
| void | Close () |
| | Manually closes the underlying NetCDF file and flush any remaining buffered rows.
|
| |
| void | Open () |
| | Manually (re)opens the underlying NetCDF file.
|
| |
| const NetCdfFile & | GetFile () const |
| | Gets the NetCDF file object.
|
| |
| const std::vector< std::string > & | GetChannelNames () const |
| | Gets the channel names.
|
| |
| const std::vector< std::string > & | GetChannelUnits () const |
| | Gets the channel units.
|
| |
| size_t | GetNumChannels () const |
| | Gets the number of channels.
|
| |
| size_t | GetBufferSize () const |
| | Gets the buffer size.
|
| |
|
| static constexpr size_t | kDefaultBufferSize {0} |
| | Default buffer size (number of rows to accumulate before auto-flush, 0 = no buffering)
|
| |
Class for writing time-series data to NetCDF file.
◆ TimeSeriesWriter() [1/4]
| kynema::util::TimeSeriesWriter::TimeSeriesWriter |
( |
const std::string & |
file_path, |
|
|
bool |
create = true |
|
) |
| |
|
explicit |
Constructor to create a TimeSeriesWriter object for writing time-series data with a single variable.
- Parameters
-
| file_path | Path to the output NetCDF file |
| create | Whether to create a new file or open an existing one |
◆ TimeSeriesWriter() [2/4]
| kynema::util::TimeSeriesWriter::TimeSeriesWriter |
( |
const std::string & |
file_path, |
|
|
bool |
create, |
|
|
const std::vector< std::string > & |
channel_names, |
|
|
const std::vector< std::string > & |
channel_units = {}, |
|
|
size_t |
buffer_size = kDefaultBufferSize |
|
) |
| |
Constructor to create a TimeSeriesWriter with predefined channels and buffering.
- Parameters
-
| file_path | Path to the output NetCDF file |
| create | Whether to create a new file or open an existing one |
| channel_names | Names of the channels (columns) stored in the time-series variable |
| channel_units | Optional units for each channel (same size as channel_names if provided) |
| buffer_size | Number of rows to buffer before auto-flush (0 = no buffering) |
◆ ~TimeSeriesWriter()
| kynema::util::TimeSeriesWriter::~TimeSeriesWriter |
( |
| ) |
|
Destructor flushes any remaining buffered rows.
◆ TimeSeriesWriter() [3/4]
◆ TimeSeriesWriter() [4/4]
◆ Close()
| void kynema::util::TimeSeriesWriter::Close |
( |
| ) |
|
Manually closes the underlying NetCDF file and flush any remaining buffered rows.
◆ Flush()
| void kynema::util::TimeSeriesWriter::Flush |
( |
| ) |
|
Flushes any remaining buffered rows.
◆ GetBufferSize()
| size_t kynema::util::TimeSeriesWriter::GetBufferSize |
( |
| ) |
const |
◆ GetChannelNames()
| const std::vector< std::string > & kynema::util::TimeSeriesWriter::GetChannelNames |
( |
| ) |
const |
◆ GetChannelUnits()
| const std::vector< std::string > & kynema::util::TimeSeriesWriter::GetChannelUnits |
( |
| ) |
const |
◆ GetFile()
| const NetCdfFile & kynema::util::TimeSeriesWriter::GetFile |
( |
| ) |
const |
Gets the NetCDF file object.
◆ GetNumChannels()
| size_t kynema::util::TimeSeriesWriter::GetNumChannels |
( |
| ) |
const |
Gets the number of channels.
◆ Open()
| void kynema::util::TimeSeriesWriter::Open |
( |
| ) |
|
Manually (re)opens the underlying NetCDF file.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ WriteRowAtTimestep()
| void kynema::util::TimeSeriesWriter::WriteRowAtTimestep |
( |
size_t |
timestep, |
|
|
std::span< const double > |
row |
|
) |
| |
Writes a full row (all channels) at a specific timestep.
- Parameters
-
| timestep | Current timestep index |
| row | Vector of values to write at the current timestep |
◆ WriteValueAtTimestep()
| void kynema::util::TimeSeriesWriter::WriteValueAtTimestep |
( |
const std::string & |
variable_name, |
|
|
size_t |
timestep, |
|
|
const double & |
value |
|
) |
| |
Writes a single value for a time-series variable at a specific timestep.
- Parameters
-
| variable_name | Name of the variable to write |
| timestep | Current timestep index |
| value | Value to write at the current timestep |
◆ WriteValuesAtTimestep()
| void kynema::util::TimeSeriesWriter::WriteValuesAtTimestep |
( |
const std::string & |
variable_name, |
|
|
size_t |
timestep, |
|
|
std::span< const double > |
values |
|
) |
| |
Writes multiple values for a time-series variable at a specific timestep.
- Parameters
-
| variable_name | Name of the variable to write |
| timestep | Current timestep index |
| values | Vector of values to write at the current timestep |
◆ kDefaultBufferSize
| constexpr size_t kynema::util::TimeSeriesWriter::kDefaultBufferSize {0} |
|
staticconstexpr |
Default buffer size (number of rows to accumulate before auto-flush, 0 = no buffering)
The documentation for this class was generated from the following files: