TECA
The Toolkit for Extreme Climate Analysis
teca_array_attributes Struct Reference

A convenience container for conventional array attributes necessary and/or useful when producing NetCDF CF format files using the teca_cf_writer. More...

#include <teca_array_attributes.h>

Collaboration diagram for teca_array_attributes:

Public Types

enum  {
  invalid_value = 0, cell_centering = 0x0100, x_face_centering = 0x0201, y_face_centering = 0x0202,
  z_face_centering = 0x0203, x_edge_centering = 0x0401, y_edge_centering = 0x0402, z_edge_centering = 0x0403,
  point_centering = 0x0800, no_centering = 0x1000
}
 
using fill_value_t = std::variant< char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, long long, unsigned long long, float, double >
 

Public Member Functions

template<typename fv_t = float>
 teca_array_attributes (unsigned int tc, unsigned int cen, unsigned long n, const std::string &un, const std::string &ln, const std::string &descr, const int &have_fv=0, const fv_t &fv=fv_t(1e20f))
 
 teca_array_attributes (const teca_array_attributes &)=default
 
teca_array_attributesoperator= (const teca_array_attributes &)=default
 
 teca_array_attributes (const teca_metadata &md)
 Convert a from metadata object. More...
 
teca_array_attributesoperator= (const teca_metadata &md)
 Convert from metadata object. More...
 
 operator teca_metadata () const
 Converts to a metadata object. More...
 
int to (teca_metadata &md) const
 Adds current values to the metadata object. More...
 
int merge_to (teca_metadata &md) const
 Adds the current values to the metadata object, only if they don't exist. More...
 
int from (const teca_metadata &md)
 Intializes values from the metadata object. More...
 
void to_stream (std::ostream &os) const
 Send to the stream in human readable form. More...
 

Static Public Member Functions

static const char * centering_to_string (int cen)
 convert the centering code to a string More...
 

Public Attributes

unsigned int type_code
 
unsigned int centering
 
unsigned long size
 
std::string units
 
std::string long_name
 
std::string description
 
int have_fill_value
 
fill_value_t fill_value
 

Detailed Description

A convenience container for conventional array attributes necessary and/or useful when producing NetCDF CF format files using the teca_cf_writer.

Member Description
type_code storage type as defined by teca_variant_array::type_code()
centering one of: no_centering, point_centering, cell_centering,
edge_centering, or face_centering
size number of elements in the array
units string describing the units that the variable is in.
long name a more descriptive name
description text describing the data
have_fill_value set non-zero to indicate that a fill_value has been
provided.
fill_value value used to identify missing or invalid data

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

The possible mesh centrings.

For coordinate system with orthogonal axes x,y,z relative to cell centering:

If A is one of x,y or z then A_face_centering data is located on the low A face i.e. shifted in the -A direction and arrays will be longer by 1 value in the A direction.

If A is one of x,y or z then A_edge_centering data is located on the low side edge parallel to A corrdinate axis. i.e. shifted in the -B and -C directions and arrays will be longer by 1 value in the B and C directions.

point_centering data is located on the low corner. i.e. shifted in the -A,-B, and -C directions and arrays will be longer by 1 value in the A, B and C directions.

Arrays that are not associated with geometric locations should be identified as no_centering.

The default centering is cell centering.

Constructor & Destructor Documentation

◆ teca_array_attributes()

teca_array_attributes::teca_array_attributes ( const teca_metadata md)
inline

Convert a from metadata object.

Member Function Documentation

◆ centering_to_string()

static const char* teca_array_attributes::centering_to_string ( int  cen)
static

convert the centering code to a string

◆ from()

int teca_array_attributes::from ( const teca_metadata md)

Intializes values from the metadata object.

◆ merge_to()

int teca_array_attributes::merge_to ( teca_metadata md) const

Adds the current values to the metadata object, only if they don't exist.

◆ operator teca_metadata()

teca_array_attributes::operator teca_metadata ( ) const

Converts to a metadata object.

◆ operator=()

teca_array_attributes& teca_array_attributes::operator= ( const teca_metadata md)

Convert from metadata object.

◆ to()

int teca_array_attributes::to ( teca_metadata md) const

Adds current values to the metadata object.

◆ to_stream()

void teca_array_attributes::to_stream ( std::ostream &  os) const

Send to the stream in human readable form.


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