|
| virtual void | add_constraint (Dim_iter i, D4Dimension *dim) |
| virtual void | add_constraint (Dim_iter i, int start, int stride, int stop) |
| | Adds a constraint to an Array dimension.
|
| virtual void | add_constraint_ll (Dim_iter i, int64_t start, int64_t stride, int64_t stop) |
| void | add_var (BaseType *v, Part p=nil) override |
| | Add the BaseType pointer to this constructor type instance.
|
| void | add_var_nocopy (BaseType *v, Part p=nil) override |
| void | append_dim (D4Dimension *dim) |
| void | append_dim (int size, const string &name="") |
| | Add a dimension of a given size.
|
| void | append_dim_ll (int64_t size, const string &name="") |
| | Array (const Array &rhs) |
| | The Array copy constructor.
|
| | Array (const string &n, BaseType *v, bool is_dap4=false) |
| | Array constructor.
|
| | Array (const string &n, const string &d, BaseType *v, bool is_dap4=false) |
| | Array constructor.
|
| bool | check_semantics (string &msg, bool all=false) override |
| | Check semantic features of the Array.
|
| void | clear_all_dims () |
| virtual void | clear_constraint () |
| | Clears the projection; add each projected dimension explicitly using add_constraint.
|
| Dim_iter | dim_begin () |
| Dim_iter | dim_end () |
| virtual D4Dimension * | dimension_D4dim (Dim_iter i) |
| virtual string | dimension_name (Dim_iter i) |
| | Returns the name of the specified dimension.
|
| virtual int | dimension_size (Dim_iter i, bool constrained=false) |
| | Returns the size of the dimension.
|
| virtual int64_t | dimension_size_ll (Dim_iter i, bool constrained=false) |
| virtual int | dimension_start (Dim_iter i, bool constrained=false) |
| | Return the start index of a dimension.
|
| virtual int64_t | dimension_start_ll (Dim_iter i, bool constrained=false) |
| virtual int | dimension_stop (Dim_iter i, bool constrained=false) |
| | Return the stop index of the constraint.
|
| virtual int64_t | dimension_stop_ll (Dim_iter i, bool constrained=false) |
| virtual int | dimension_stride (Dim_iter i, bool constrained=false) |
| | Returns the stride value of the constraint.
|
| virtual int64_t | dimension_stride_ll (Dim_iter i, bool constrained=false) |
| virtual unsigned int | dimensions (bool constrained=false) |
| | Return the total number of dimensions in the array.
|
| void | dump (ostream &strm) const override |
| | dumps information about this object
|
| bool | get_dio_flag () const |
| var_storage_info & | get_var_storage_info () |
| bool | is_dap2_grid () |
| bool | is_dap4_projected (std::vector< std::string > &projected_dap4_inventory) override |
| virtual D4Maps * | maps () |
| Array & | operator= (const Array &rhs) |
| void | prepend_dim (D4Dimension *dim) |
| void | prepend_dim (int size, const string &name="") |
| virtual void | print_as_map_xml (FILE *out, string space=" ", bool constrained=false) |
| virtual void | print_as_map_xml (ostream &out, string space=" ", bool constrained=false) |
| virtual void | print_as_map_xml_writer (XMLWriter &xml, bool constrained) |
| void | print_dap4 (XMLWriter &xml, bool constrained=false) override |
| | Print the DAP4 representation of an array.
|
|
void | print_decl (FILE *out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false) override |
|
void | print_decl (ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false) override |
| void | print_val (FILE *out, string space="", bool print_decl_p=true) override |
| void | print_val (ostream &out, string space="", bool print_decl_p=true) override |
| void | print_xml (FILE *out, string space=" ", bool constrained=false) override |
| | Prints a DDS entry for the Array.
|
| void | print_xml (ostream &out, string space=" ", bool constrained=false) override |
| virtual void | print_xml_core (FILE *out, string space, bool constrained, string tag) |
| virtual void | print_xml_core (ostream &out, string space, bool constrained, string tag) |
| void | print_xml_writer (XMLWriter &xml, bool constrained=false) override |
| virtual void | print_xml_writer_core (XMLWriter &out, bool constrained, string tag) |
| BaseType * | ptr_duplicate () override |
| void | rename_dim (const string &oldName="", const string &newName="") |
| | Renames dimension.
|
| virtual void | reset_constraint () |
| | Reset constraint to select entire array.
|
| void | set_dio_flag (bool dio_flag_value=true) |
| void | set_var_storage_info (const var_storage_info &my_vs_info) |
| | Set the variable storage information for direct IO optimization.
|
| std::vector< BaseType * > * | transform_to_dap2 (AttrTable *parent_attr_table) override |
| | Transforms this instance of a D4Array into the corresponding DAP2 object.
|
| void | transform_to_dap4 (D4Group *root, Constructor *container) override |
| virtual void | update_length (int size=0) |
| virtual void | update_length_ll (unsigned long long size=0) |
| virtual | ~Array () |
| | The Array destructor.
|
A multidimensional array of identical data types.
This class is used to hold arrays of data. The elements of the array can be simple or compound data types. There is no limit on the number of dimensions an array can have, or on the size of each dimension.
If desired, the user can give each dimension of an array a name. You can, for example, have a 360x180 array of temperatures, covering the whole globe with one-degree squares. In this case, you could name the first dimension Longitude and the second dimension Latitude. This can help prevent a great deal of confusion.
The Array is used as part of the Grid class, where the dimension names are crucial to its structure. The dimension names correspond to Map vectors, holding the actual values for that column of the array.
In DAP4, the Array may be a Coverage or a simple Array. In the former case the Array will have both named dimensions and maps, where the maps (instances of D4Map) are what make the Array a Coverage. Coverages are a generalization of DAP2 Grids.
Each array dimension carries with it its own projection information. The projection information takes the form of three integers: the start, stop, and stride values. This is clearest with an example. Consider a one-dimensional array 10 elements long. If the start value of the dimension constraint is 3, then the constrained array appears to be seven elements long. If the stop value is changed to 7, then the array appears to be five elements long. If the stride is changed to two, the array will appear to be 3 elements long. Array constraints are written as: [start:stride:stop].
A = [1 2 3 4 5 6 7 8 9 10]
A[3::] = [4 5 6 7 8 9 10]
A[3::7] = [4 5 6 7 8]
A[3:2:7] = [4 6 8]
A[0:3:9] = [1 4 7 10]
- Note
- Arrays use zero-based indexing.
-
This class is used for both DAP2 and DAP4.
-
An interesting 'feature' of the DAP4 Array is that its Maps are added after construction. None of the Array constructors build the Maps, but the copy ctor is supposed to copy it correctly. The original design has pointers for the parent and the source of the Map's value, but the actual 'parent' array is the object being constructed, so it does not exist! I have thus replaced the pointers with paths. Use the dataset's root group find_var() method to get the objects. The root group can be found using the new BaseType::get_ancestor() method. jhrg 9/16/22
- See also
- Grid
-
Vector
-
dimension
Definition at line 121 of file Array.h.
| void libdap::Array::print_xml |
( |
FILE * | out, |
|
|
string | space = " ", |
|
|
bool | constrained = false ) |
|
override |
Prints a DDS entry for the Array.
Prints a declaration for the Array. This is what appears in a DDS. If the Array is constrained, the declaration will reflect the size of the Array once the constraint is applied.
- Parameters
-
| out | Write the output to this FILE *. |
| space | A string containing spaces to precede the declaration. |
| print_semi | A boolean indicating whether to print a semi-colon after the declaration. (TRUE means ``print a semi-colon.'') |
| constraint_info | A boolean value. See BaseType::print_decl(). |
| constrained | This argument should be TRUE if the Array is constrained, and FALSE otherwise. */ void Array::print_decl(FILE *out, string space, bool print_semi, bool constraint_info, bool constrained) { ostringstream oss; print_decl(oss, space, print_semi, constraint_info, constrained); fwrite(oss.str().data(), sizeof(char), oss.str().length(), out); } |
/** Prints a declaration for the Array. This is what appears in a DDS. If the Array is constrained, the declaration will reflect the size of the Array once the constraint is applied.
Prints a DDS entry for the Array.
- Parameters
-
| out | Write the output to this ostream. |
| space | A string containing spaces to precede the declaration. |
| print_semi | A boolean indicating whether to print a semi-colon after the declaration. (TRUE means ``print a semi-colon.'') |
| constraint_info | A boolean value. See BaseType::print_decl(). |
| constrained | This argument should be TRUE if the Array is constrained, and FALSE otherwise. */ void Array::print_decl(ostream &out, string space, bool print_semi, bool constraint_info, bool constrained) { if (constrained && !send_p()) return; |
print it, but w/o semicolon var()->print_decl(out, space, false, constraint_info, constrained);
for (Dim_citer i = _shape.begin(); i != _shape.end(); i++) { out << "["; if ((*i).name != "") { out << id2www((*i).name) << " = "; } if (constrained) { out << (*i).c_size << "]"; } else { out << (*i).size << "]"; } }
if (print_semi) { out << ";\n"; } }
/**
- Deprecated
Definition at line 1094 of file Array.cc.