1 #ifndef teca_array_attributes_h
2 #define teca_array_attributes_h
4 #include "teca_config.h"
5 #include "teca_metadata.h"
34 centering(0), size(0), mesh_dim_active{},
35 units(), long_name(), description(), have_fill_value(0),
39 template <
typename fv_t =
float>
41 unsigned long n,
const std::array<int,4> &mda,
const std::string &un,
42 const std::string &ln,
const std::string &descr,
const int &have_fv=0,
43 const fv_t &fv=fv_t(1e20f)) :
44 type_code(tc), centering(cen), size(n), mesh_dim_active(mda), units(un),
45 long_name(ln), description(descr), have_fill_value(have_fv), fill_value(fv)
53 type_code(0), centering(0), size(0), mesh_dim_active{{}},
54 units(), long_name(), description(), have_fill_value(0),
104 cell_centering = 0x0100,
105 x_face_centering = 0x0201,
106 y_face_centering = 0x0202,
107 z_face_centering = 0x0203,
108 x_edge_centering = 0x0401,
109 y_edge_centering = 0x0402,
110 z_edge_centering = 0x0403,
111 point_centering = 0x0800,
112 no_centering = 0x1000,
119 static constexpr std::array<int,4>
none_active() {
return {0,0,0,0}; }
122 static constexpr std::array<int,4>
xyzt_active() {
return {1,1,1,1}; }
125 static constexpr std::array<int,4>
xyt_active() {
return {1,1,0,1}; }
128 static constexpr std::array<int,4>
xyz_active() {
return {1,1,1,0}; }
131 static constexpr std::array<int,4>
xy_active() {
return {1,1,0,0}; }
134 std::variant<char,
unsigned char, short,
unsigned short,
135 int,
unsigned int, long,
unsigned long,
long long,
136 unsigned long long, float,
double>;
138 unsigned int type_code;
139 unsigned int centering;
141 std::array<int,4> mesh_dim_active;
143 std::string long_name;
144 std::string description;
146 fill_value_t fill_value;
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.
A convenience container for conventional array attributes necessary and/or useful when producing NetC...
Definition: teca_array_attributes.h:32
teca_array_attributes(const teca_metadata &md)
Convert a from metadata object.
Definition: teca_array_attributes.h:52
int from(const teca_metadata &md)
Intializes values from the metadata object.
int to(teca_metadata &md) const
Adds current values to the metadata object.
void to_stream(std::ostream &os) const
Send to the stream in human readable form.
teca_array_attributes & operator=(const teca_metadata &md)
Convert from metadata object.
static constexpr std::array< int, 4 > xyz_active()
flags for non-time varying 3D arrays
Definition: teca_array_attributes.h:128
static constexpr std::array< int, 4 > xyt_active()
flags for time varying 2D arrays
Definition: teca_array_attributes.h:125
static constexpr std::array< int, 4 > xyzt_active()
flags for time varying 3D arrays
Definition: teca_array_attributes.h:122
int merge_to(teca_metadata &md) const
Adds the current values to the metadata object, only if they don't exist.
static constexpr std::array< int, 4 > none_active()
flags for non-mesh based arrays
Definition: teca_array_attributes.h:119
static constexpr std::array< int, 4 > xy_active()
flags for non-time varying 2D arrays
Definition: teca_array_attributes.h:131
static const char * centering_to_string(int cen)
convert the centering code to a string