TECA
The Toolkit for Extreme Climate Analysis
teca_cf_time_axis_data Class Reference

A dataset used to read NetCDF CF2 time and metadata in parallel. More...

#include <teca_cf_time_axis_data.h>

Inheritance diagram for teca_cf_time_axis_data:
[legend]
Collaboration diagram for teca_cf_time_axis_data:
[legend]

Public Types

using elem_t = std::pair< p_teca_variant_array, teca_metadata >
 
- Public Types inherited from teca_dataset
using allocator = teca_variant_array::allocator
 

Public Member Functions

std::shared_ptr< teca_cf_time_axis_datashared_from_this ()
 
std::shared_ptr< teca_cf_time_axis_data const > shared_from_this () const
 
virtual p_teca_dataset new_instance () const override
 virtual constructor. return a new dataset of the same type. More...
 
virtual p_teca_dataset new_copy (allocator alloc=allocator::malloc) const override
 
virtual p_teca_dataset new_shallow_copy () override
 
void transfer (unsigned long file_id, elem_t &&data)
 
elem_t & get (unsigned long file_id)
 access the file's element More...
 
const elem_t & get (unsigned long file_id) const
 
void append (const const_p_teca_dataset &other)
 append the data from the other instance More...
 
void shallow_append (const const_p_teca_dataset &other)
 
std::string get_class_name () const override
 return a unique string identifier More...
 
int get_type_code () const override
 return an integer identifier uniquely naming the dataset type More...
 
 operator bool () const noexcept
 covert to boolean. More...
 
bool empty () const noexcept override
 return true if the dataset is empty. More...
 
int to_stream (teca_binary_stream &) const override
 serialize the dataset to/from the given stream for I/O or communication More...
 
int from_stream (teca_binary_stream &) override
 deserialize the dataset from the given stream for I/O or communication More...
 
int to_stream (std::ostream &) const override
 stream to/from human readable representation More...
 
int from_stream (std::istream &) override
 read from stream in a human readable representation More...
 
void copy (const const_p_teca_dataset &other, allocator alloc=allocator::malloc) override
 
void shallow_copy (const p_teca_dataset &other) override
 
void swap (const p_teca_dataset &other) override
 swap internals of the two objects More...
 
 teca_cf_time_axis_data ()
 
virtual teca_metadataget_metadata () noexcept
 get the dataset metadata More...
 
virtual const teca_metadataget_metadata () const noexcept
 get the dataset metadata More...
 
- Public Member Functions inherited from teca_dataset
virtual int set_request_indices (const std::string &request_key, const unsigned long ids[2])
 
virtual int get_request_indices (unsigned long ids[2]) const
 
virtual int get_request_index (unsigned long &index) const
 
virtual int set_request_index (const std::string &request_key, unsigned long index)
 
 operator bool () const noexcept
 
virtual void copy_metadata (const const_p_teca_dataset &other)
 copy metadata. always a deep copy. More...
 
virtual const teca_metadataget_metadata () const noexcept
 get the dataset metadata More...
 
virtual void set_metadata (const teca_metadata &md)
 set the dataset metadata More...
 
void set_index_request_key (const std::vector< std::string > &vals)
 
int get_index_request_key (std::vector< std::string > &vals) const
 
void set_index_request_key (const p_teca_variant_array &vals)
 
int get_index_request_key (p_teca_variant_array vals) const
 
void set_index_request_key (const std::initializer_list< std::string > &l)
 
void set_index_request_key (const std::string *vals)
 
int get_index_request_key (std::string *vals) const
 
void set_index_request_key (const std::string &val_1)
 
int get_index_request_key (std::string &val_1) const
 

Static Public Member Functions

static p_teca_cf_time_axis_data New ()
 
static teca_metadataget_metadata (elem_t &elem)
 given an element extract metadata More...
 
static const teca_metadataget_metadata (const elem_t &elem)
 given an element extract metadata More...
 
static p_teca_variant_array get_variant_array (elem_t &elem)
 given an element extract the time axis More...
 
static const_p_teca_variant_array get_variant_array (const elem_t &elem)
 given an element extract the time axis More...
 

Protected Member Functions

 teca_cf_time_axis_data (const teca_cf_time_axis_data &other)=delete
 
 teca_cf_time_axis_data (teca_cf_time_axis_data &&other)=delete
 
teca_cf_time_axis_dataoperator= (const teca_cf_time_axis_data &other)=delete
 
- Protected Member Functions inherited from teca_dataset
 teca_dataset (const teca_dataset &)=delete
 
 teca_dataset (const teca_dataset &&)=delete
 
void operator= (const p_teca_dataset &other)=delete
 
void operator= (p_teca_dataset &&other)=delete
 

Additional Inherited Members

- Protected Attributes inherited from teca_dataset
teca_metadatametadata
 

Detailed Description

A dataset used to read NetCDF CF2 time and metadata in parallel.

The dataset contains elements (one per file) of type: std::pair<p_teca_variant_array, teca_metadata> holding the time axis and associated NetCDF attributes.

Constructor & Destructor Documentation

◆ teca_cf_time_axis_data()

teca_cf_time_axis_data::teca_cf_time_axis_data ( )
Note
This constructor is public to enable std::make_shared. Do not use.

Member Function Documentation

◆ append()

void teca_cf_time_axis_data::append ( const const_p_teca_dataset &  other)

append the data from the other instance

◆ copy()

void teca_cf_time_axis_data::copy ( const const_p_teca_dataset &  other,
allocator  alloc = allocator::malloc 
)
overridevirtual

Deep copy data and metdata.

Parameters
[in]otherThe dataset to copy.
[in]allocThe allocator to use for alloctions of data structures to hold the copy. The default is a CPU based allocator.

Reimplemented from teca_dataset.

◆ empty()

bool teca_cf_time_axis_data::empty ( ) const
overridevirtualnoexcept

return true if the dataset is empty.

Reimplemented from teca_dataset.

◆ from_stream() [1/2]

int teca_cf_time_axis_data::from_stream ( std::istream &  )
overridevirtual

read from stream in a human readable representation

Reimplemented from teca_dataset.

◆ from_stream() [2/2]

int teca_cf_time_axis_data::from_stream ( teca_binary_stream )
overridevirtual

deserialize the dataset from the given stream for I/O or communication

Reimplemented from teca_dataset.

◆ get()

elem_t& teca_cf_time_axis_data::get ( unsigned long  file_id)

access the file's element

◆ get_class_name()

std::string teca_cf_time_axis_data::get_class_name ( ) const
inlineoverridevirtual

return a unique string identifier

Implements teca_dataset.

◆ get_metadata() [1/4]

virtual const teca_metadata& teca_dataset::get_metadata
virtualnoexcept

get the dataset metadata

Reimplemented from teca_dataset.

◆ get_metadata() [2/4]

virtual teca_metadata& teca_dataset::get_metadata
virtualnoexcept

get the dataset metadata

Reimplemented from teca_dataset.

◆ get_metadata() [3/4]

static const teca_metadata& teca_cf_time_axis_data::get_metadata ( const elem_t &  elem)
inlinestatic

given an element extract metadata

◆ get_metadata() [4/4]

static teca_metadata& teca_cf_time_axis_data::get_metadata ( elem_t &  elem)
inlinestatic

given an element extract metadata

◆ get_type_code()

int teca_cf_time_axis_data::get_type_code ( ) const
overridevirtual

return an integer identifier uniquely naming the dataset type

Implements teca_dataset.

◆ get_variant_array() [1/2]

static const_p_teca_variant_array teca_cf_time_axis_data::get_variant_array ( const elem_t &  elem)
inlinestatic

given an element extract the time axis

◆ get_variant_array() [2/2]

static p_teca_variant_array teca_cf_time_axis_data::get_variant_array ( elem_t &  elem)
inlinestatic

given an element extract the time axis

◆ new_copy()

virtual p_teca_dataset teca_cf_time_axis_data::new_copy ( allocator  alloc = allocator::malloc) const
inlineoverridevirtual

Implements teca_dataset.

◆ new_instance()

virtual p_teca_dataset teca_cf_time_axis_data::new_instance ( ) const
inlineoverridevirtual

virtual constructor. return a new dataset of the same type.

Implements teca_dataset.

◆ new_shallow_copy()

virtual p_teca_dataset teca_cf_time_axis_data::new_shallow_copy ( )
inlineoverridevirtual

Virtual shallow copy constructor. return a shallow copy of this dataset in a new instance. References to source data structures are taken, but metadata is always deep copied.

Implements teca_dataset.

◆ operator bool()

teca_cf_time_axis_data::operator bool ( ) const
inlineexplicitnoexcept

covert to boolean.

Returns
true if the dataset is not empty, otherwise false.

◆ shallow_copy()

void teca_cf_time_axis_data::shallow_copy ( const p_teca_dataset &  other)
overridevirtual

Shallow copy data and metadata. The shallow copy takes references to the source data structures. Metadata is always deep copied.

Parameters
[in]otherThe dataset to copy.

Reimplemented from teca_dataset.

◆ swap()

void teca_cf_time_axis_data::swap ( const p_teca_dataset &  other)
overridevirtual

swap internals of the two objects

Reimplemented from teca_dataset.

◆ to_stream() [1/2]

int teca_cf_time_axis_data::to_stream ( std::ostream &  ) const
overridevirtual

stream to/from human readable representation

Reimplemented from teca_dataset.

◆ to_stream() [2/2]

int teca_cf_time_axis_data::to_stream ( teca_binary_stream ) const
overridevirtual

serialize the dataset to/from the given stream for I/O or communication

Reimplemented from teca_dataset.

◆ transfer()

void teca_cf_time_axis_data::transfer ( unsigned long  file_id,
elem_t &&  data 
)

transfer the element associated with file to the dataset. after transfer the passed element is invalid in the calling context


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