47 #ifdef HAVE_SYS_PARAM_H
48 #include <sys/param.h>
82 throw Error(unknown_error,
"Could not read from dataset.");
94 string hdf_file = dataset();
95 string hdf_name = this->name();
98 vector<int> start,
edge, stride;
101 bool foundsds =
false;
103 if (tag == -1 || tag == DFTAG_NDG) {
104 if (
SDSExists(hdf_file.c_str(), hdf_name.c_str())) {
107 BESDEBUG(
"h4",
"sds seek with ref = " << ref << endl);
110 BESDEBUG(
"h4",
"sds seek with name = '" << hdf_name <<
"'" << endl);
111 sdsin.seek(hdf_name.c_str());
114 sdsin.setslab(start, edge, stride,
false);
121 bool foundgr =
false;
123 if (!foundsds && (tag == -1 || tag == DFTAG_VG)) {
124 if (
GRExists(hdf_file.c_str(), hdf_name.c_str())) {
129 grin.seek(hdf_name.c_str());
131 grin.setslab(start, edge, stride,
false);
144 if (foundgr || foundsds) {
157 vector<int>&edge_array, vector<int>&stride_array) {
158 int start = 0, stop = 0, stride = 0;
161 start_array = vector<int> (0);
162 edge_array = vector<int> (0);
163 stride_array = vector<int> (0);
165 for (Array::Dim_iter p = dim_begin(); p != dim_end(); ++p) {
166 start = dimension_start(p,
true);
167 stride = dimension_stride(p,
true);
168 stop = dimension_stop(p,
true);
169 if (start == 0 && stop == 0 && stride == 0)
173 edge = (int) ((stop - start) / stride) + 1;
174 if (start + edge > dimension_size(p))
177 start_array.push_back(start);
178 edge_array.push_back(edge);
179 stride_array.push_back(stride);
206 BESDEBUG(
"h4",
"Transferring attributes for " << name() << endl);
208 BaseType::transfer_attributes(at);
210 BESDEBUG(
"h4",
"...Now looking for the " << name() <<
" _dim_n containers." << endl);
213 string dim_name_base = name() +
"_dim_";
215 AttrTable::Attr_iter a_p = at->attr_begin();
216 while (a_p != at->attr_end()) {
217 string::size_type i = at->get_name(a_p).find(dim_name_base);
221 if (i == 0 && at->get_attr_type(a_p) == Attr_container) {
222 AttrTable *dim = at->get_attr_table(a_p);
224 BESDEBUG(
"h4",
"Found a dimension container for " << name() << endl);
228 BESDEBUG(
"h4",
"Caught an error transferring dimension attribute " << dim->get_name() <<
" for variable " << name() << endl);
239 dim->set_is_global_attribute(
false);
241 AttrTable *at =
new AttrTable(*dim);
243 string name = at->get_name().substr(at->get_name().find(
"dim"));
244 get_attr_table().append_container(at, name);
bool SDSExists(const char *filename, const char *sdsname)
virtual void transfer_dimension_attribute(AttrTable *dim)
virtual bool read_tagref(int32 tag, int32 ref, int &error)
virtual void seek_ref(int ref)
void LoadArrayFromGR(HDFArray *ar, const hdf_gri &gr)
bool GRExists(const char *filename, const char *grname)
bool GetSlabConstraint(vector< int > &start_array, vector< int > &edge_array, vector< int > &stride_array)
virtual void transfer_attributes(AttrTable *at_container)
Transfer attributes from a separately built DAS to the DDS.
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
HDFArray(const string &n, const string &d, BaseType *v)
void LoadArrayFromSDS(HDFArray *ar, const hdf_sds &sds)
virtual BaseType * ptr_duplicate()