OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
HDF5CFArray.cc
Go to the documentation of this file.
1 // This file is part of the hdf5_handler implementing for the CF-compliant
2 // Copyright (c) 2011-2013 The HDF Group, Inc. and OPeNDAP, Inc.
3 //
4 // This is free software; you can redistribute it and/or modify it under the
5 // terms of the GNU Lesser General Public License as published by the Free
6 // Software Foundation; either version 2.1 of the License, or (at your
7 // option) any later version.
8 //
9 // This software is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 // License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 //
18 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
19 // You can contact The HDF Group, Inc. at 1800 South Oak Street,
20 // Suite 203, Champaign, IL 61820
21 
30 
31 #include "config_hdf5.h"
32 #include <iostream>
33 #include <sstream>
34 #include <cassert>
35 #include <debug.h>
36 #include "InternalErr.h"
37 #include <BESDebug.h>
38 
39 #include "Str.h"
40 #include "HDF5CFArray.h"
41 //#include "h5cfdaputil.h"
42 
43 
44 
46 {
47  return new HDF5CFArray(*this);
48 }
49 
50 // Read in an HDF5 Array
52 {
53 
54  BESDEBUG("h5","Coming to HDF5CFArray read "<<endl);
55  string check_pass_fileid_key_str="H5.EnablePassFileID";
56  bool check_pass_fileid_key = false;
57  check_pass_fileid_key = HDF5CFDAPUtil::check_beskeys(check_pass_fileid_key_str);
58 
59  vector<int>offset;
60  vector<int>count;
61  vector<int>step;
62  vector<hsize_t> hoffset;
63  vector<hsize_t>hcount;
64  vector<hsize_t>hstep;
65  int nelms = 1;
66 
67 
68  if (rank < 0)
69  throw InternalErr (__FILE__, __LINE__,
70  "The number of dimension of the variable is negative.");
71  else if (rank == 0)
72  nelms = 1;
73  else {
74 
75  offset.resize(rank);
76  count.resize(rank);
77  step.resize(rank);
78  hoffset.resize(rank);
79  hcount.resize(rank);
80  hstep.resize(rank);
81  nelms = format_constraint (&offset[0], &step[0], &count[0]);
82  for (int i = 0; i <rank; i++) {
83  hoffset[i] = (hsize_t) offset[i];
84  hcount[i] = (hsize_t) count[i];
85  hstep[i] = (hsize_t) step[i];
86  }
87  }
88 
89  //hid_t fileid = -1;
90  hid_t dsetid = -1;
91  hid_t dspace = -1;
92  hid_t mspace = -1;
93  hid_t dtypeid = -1;
94  hid_t memtype = -1;
95 
96 
97 //#if 0
98  if(false == check_pass_fileid_key) {
99  if ((fileid = H5Fopen(filename.c_str(),H5F_ACC_RDONLY,H5P_DEFAULT))<0) {
100  ostringstream eherr;
101  eherr << "HDF5 File " << filename
102  << " cannot be opened. "<<endl;
103  throw InternalErr (__FILE__, __LINE__, eherr.str ());
104  }
105  }
106 //#endif
107 
108  if ((dsetid = H5Dopen(fileid,varname.c_str(),H5P_DEFAULT))<0) {
109 
110  //H5Fclose(fileid);
111  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
112  ostringstream eherr;
113  eherr << "HDF5 dataset " << varname
114  << " cannot be opened. "<<endl;
115  throw InternalErr (__FILE__, __LINE__, eherr.str ());
116  }
117 
118  if ((dspace = H5Dget_space(dsetid))<0) {
119 
120  H5Dclose(dsetid);
121  //H5Fclose(fileid);
122  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
123  ostringstream eherr;
124  eherr << "Space id of the HDF5 dataset " << varname
125  << " cannot be obtained. "<<endl;
126  throw InternalErr (__FILE__, __LINE__, eherr.str ());
127  }
128 
129  if (rank > 0) {
130  if (H5Sselect_hyperslab(dspace, H5S_SELECT_SET,
131  &hoffset[0], &hstep[0],
132  &hcount[0], NULL) < 0) {
133 
134  H5Sclose(dspace);
135  H5Dclose(dsetid);
136  //H5Fclose(fileid);
137  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
138  ostringstream eherr;
139  eherr << "The selection of hyperslab of the HDF5 dataset " << varname
140  << " fails. "<<endl;
141  throw InternalErr (__FILE__, __LINE__, eherr.str ());
142  }
143 
144  mspace = H5Screate_simple(rank, &hcount[0],NULL);
145  if (mspace < 0) {
146  H5Sclose(dspace);
147  H5Dclose(dsetid);
148  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
149  //H5Fclose(fileid);
150  ostringstream eherr;
151  eherr << "The creation of the memory space of the HDF5 dataset " << varname
152  << " fails. "<<endl;
153  throw InternalErr (__FILE__, __LINE__, eherr.str ());
154  }
155  }
156 
157 
158  if ((dtypeid = H5Dget_type(dsetid)) < 0) {
159 
160  if (rank >0)
161  H5Sclose(mspace);
162  H5Sclose(dspace);
163  H5Dclose(dsetid);
164  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
165  //H5Fclose(fileid);
166  ostringstream eherr;
167  eherr << "Obtaining the datatype of the HDF5 dataset " << varname
168  << " fails. "<<endl;
169  throw InternalErr (__FILE__, __LINE__, eherr.str ());
170 
171  }
172 
173  if ((memtype = H5Tget_native_type(dtypeid, H5T_DIR_ASCEND))<0) {
174 
175  if (rank >0)
176  H5Sclose(mspace);
177  H5Tclose(dtypeid);
178  H5Sclose(dspace);
179  H5Dclose(dsetid);
180  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
181  //H5Fclose(fileid);
182  ostringstream eherr;
183  eherr << "Obtaining the memory type of the HDF5 dataset " << varname
184  << " fails. "<<endl;
185  throw InternalErr (__FILE__, __LINE__, eherr.str ());
186 
187  }
188 
189  // Now reading the data, note dtype is not dtypeid.
190  // dtype is an enum defined by the handler.
191 
192  hid_t read_ret = -1;
193 
194  switch (dtype) {
195 
196  case H5UCHAR:
197 
198  {
199  vector<unsigned char> val;
200  val.resize(nelms);
201 
202 
203  if (0 == rank)
204  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
205  else
206  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
207 
208  if (read_ret < 0) {
209  if (rank > 0)
210  H5Sclose(mspace);
211  H5Tclose(memtype);
212  H5Tclose(dtypeid);
213  H5Sclose(dspace);
214  H5Dclose(dsetid);
215  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
216  //H5Fclose(fileid);
217  ostringstream eherr;
218  eherr << "Cannot read the HDF5 dataset " << varname
219  << " with the type of H5T_NATIVE_UCHAR "<<endl;
220  throw InternalErr (__FILE__, __LINE__, eherr.str ());
221 
222  }
223  set_value ((dods_byte *) &val[0], nelms);
224  } // case H5UCHAR
225  break;
226 
227 
228  case H5CHAR:
229  {
230 
231  vector<char> val;
232  val.resize(nelms);
233 
234  if (0 == rank)
235  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
236  else
237  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
238 
239  if (read_ret < 0) {
240 
241  if (rank > 0)
242  H5Sclose(mspace);
243  H5Tclose(memtype);
244  H5Tclose(dtypeid);
245  H5Sclose(dspace);
246  H5Dclose(dsetid);
247  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
248  //H5Fclose(fileid);
249  ostringstream eherr;
250  eherr << "Cannot read the HDF5 dataset " << varname
251  << " with the type of H5T_NATIVE_CHAR "<<endl;
252  throw InternalErr (__FILE__, __LINE__, eherr.str ());
253 
254  }
255 
256  vector<short>newval;
257  newval.resize(nelms);
258 
259  for (int counter = 0; counter < nelms; counter++)
260  newval[counter] = (short) (val[counter]);
261 
262  set_value ((dods_int16 *) &newval[0], nelms);
263  } // case H5CHAR
264  break;
265 
266 
267  case H5INT16:
268  {
269  vector<short>val;
270  val.resize(nelms);
271 
272  if (0 == rank)
273  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
274  else
275  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
276 
277  if (read_ret < 0) {
278 
279  if (rank > 0)
280  H5Sclose(mspace);
281  H5Tclose(memtype);
282  H5Tclose(dtypeid);
283  H5Sclose(dspace);
284  H5Dclose(dsetid);
285  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
286  //H5Fclose(fileid);
287  ostringstream eherr;
288  eherr << "Cannot read the HDF5 dataset " << varname
289  << " with the type of H5T_NATIVE_SHORT "<<endl;
290  throw InternalErr (__FILE__, __LINE__, eherr.str ());
291 
292  }
293  set_value ((dods_int16 *) &val[0], nelms);
294  }// H5INT16
295  break;
296 
297 
298  case H5UINT16:
299  {
300  vector<unsigned short> val;
301  val.resize(nelms);
302  if (0 == rank)
303  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
304  else
305  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
306 
307  if (read_ret < 0) {
308 
309  if (rank > 0) H5Sclose(mspace);
310  H5Tclose(memtype);
311  H5Tclose(dtypeid);
312  H5Sclose(dspace);
313  H5Dclose(dsetid);
314  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
315  //H5Fclose(fileid);
316  ostringstream eherr;
317  eherr << "Cannot read the HDF5 dataset " << varname
318  << " with the type of H5T_NATIVE_USHORT "<<endl;
319  throw InternalErr (__FILE__, __LINE__, eherr.str ());
320 
321  }
322  set_value ((dods_uint16 *) &val[0], nelms);
323  } // H5UINT16
324  break;
325 
326 
327  case H5INT32:
328  {
329  vector<int>val;
330  val.resize(nelms);
331  if (0 == rank)
332  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
333  else
334  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
335 
336  if (read_ret < 0) {
337  if (rank > 0)
338  H5Sclose(mspace);
339  H5Tclose(memtype);
340  H5Tclose(dtypeid);
341  H5Sclose(dspace);
342  H5Dclose(dsetid);
343  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
344  //H5Fclose(fileid);
345  ostringstream eherr;
346  eherr << "Cannot read the HDF5 dataset " << varname
347  << " with the type of H5T_NATIVE_INT "<<endl;
348  throw InternalErr (__FILE__, __LINE__, eherr.str ());
349 
350  }
351  set_value ((dods_int32 *) &val[0], nelms);
352  } // case H5INT32
353  break;
354 
355  case H5UINT32:
356  {
357  vector<unsigned int>val;
358  val.resize(nelms);
359  if (0 == rank)
360  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
361  else
362  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
363 
364  if (read_ret < 0) {
365 
366  if (rank > 0)
367  H5Sclose(mspace);
368  H5Tclose(memtype);
369  H5Tclose(dtypeid);
370  H5Sclose(dspace);
371  H5Dclose(dsetid);
372  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
373  //H5Fclose(fileid);
374  ostringstream eherr;
375  eherr << "Cannot read the HDF5 dataset " << varname
376  << " with the type of H5T_NATIVE_UINT "<<endl;
377  throw InternalErr (__FILE__, __LINE__, eherr.str ());
378 
379  }
380  set_value ((dods_uint32 *) &val[0], nelms);
381  }
382  break;
383 
384  case H5FLOAT32:
385  {
386 
387  vector<float>val;
388  val.resize(nelms);
389 
390  if (0 == rank)
391  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
392  else
393  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
394 
395  if (read_ret < 0) {
396  if (rank > 0)
397  H5Sclose(mspace);
398  H5Tclose(memtype);
399  H5Tclose(dtypeid);
400  H5Sclose(dspace);
401  H5Dclose(dsetid);
402  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
403  //H5Fclose(fileid);
404  ostringstream eherr;
405  eherr << "Cannot read the HDF5 dataset " << varname
406  << " with the type of H5T_NATIVE_FLOAT "<<endl;
407  throw InternalErr (__FILE__, __LINE__, eherr.str ());
408 
409  }
410  set_value ((dods_float32 *) &val[0], nelms);
411  }
412  break;
413 
414 
415  case H5FLOAT64:
416  {
417 
418  vector<double>val;
419  val.resize(nelms);
420  if (0 == rank)
421  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,&val[0]);
422  else
423  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,&val[0]);
424 
425  if (read_ret < 0) {
426  if (rank > 0)
427  H5Sclose(mspace);
428  H5Tclose(memtype);
429  H5Tclose(dtypeid);
430  H5Sclose(dspace);
431  H5Dclose(dsetid);
432  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
433  //H5Fclose(fileid);
434  ostringstream eherr;
435  eherr << "Cannot read the HDF5 dataset " << varname
436  << " with the type of H5T_NATIVE_DOUBLE "<<endl;
437  throw InternalErr (__FILE__, __LINE__, eherr.str ());
438 
439  }
440  set_value ((dods_float64 *) &val[0], nelms);
441  } // case H5FLOAT64
442  break;
443 
444 
445  case H5FSTRING:
446  {
447  size_t ty_size = H5Tget_size(dtypeid);
448  if (ty_size == 0) {
449  if (rank >0)
450  H5Sclose(mspace);
451  H5Tclose(memtype);
452  H5Tclose(dtypeid);
453  H5Sclose(dspace);
454  H5Dclose(dsetid);
455  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
456  //H5Fclose(fileid);
457  ostringstream eherr;
458  eherr << "Cannot obtain the size of the fixed size HDF5 string of the dataset "
459  << varname <<endl;
460  throw InternalErr (__FILE__, __LINE__, eherr.str ());
461  }
462 
463  vector <char> strval;
464  strval.resize(nelms*ty_size);
465  if (0 == rank)
466  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,(void*)&strval[0]);
467  else
468  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,(void*)&strval[0]);
469 
470  if (read_ret < 0) {
471  if (rank > 0)
472  H5Sclose(mspace);
473  H5Tclose(memtype);
474  H5Tclose(dtypeid);
475  H5Sclose(dspace);
476  H5Dclose(dsetid);
477  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
478  //H5Fclose(fileid);
479  ostringstream eherr;
480  eherr << "Cannot read the HDF5 dataset " << varname
481  << " with the type of the fixed size HDF5 string "<<endl;
482  throw InternalErr (__FILE__, __LINE__, eherr.str ());
483  }
484 
485  string total_string(strval.begin(),strval.end());
486  strval.clear();//save some memory;
487  vector <string> finstrval;
488  finstrval.resize(nelms);
489  for (int i = 0; i<nelms; i++)
490  finstrval[i] = total_string.substr(i*ty_size,ty_size);
491 
492  // Check if we should drop the long string
493  string check_droplongstr_key ="H5.EnableDropLongString";
494  bool is_droplongstr = false;
495  is_droplongstr =
496  HDF5CFDAPUtil::check_beskeys(check_droplongstr_key);
497 
498  // If the string size is longer than the current netCDF JAVA
499  // string and the "EnableDropLongString" key is turned on,
500  // No string is generated.
501  if (true == is_droplongstr &&
502  total_string.size() > NC_JAVA_STR_SIZE_LIMIT) {
503  for (int i = 0; i<nelms; i++)
504  finstrval[i] = "";
505  }
506  set_value(finstrval,nelms);
507  total_string.clear();
508  }
509  break;
510 
511 
512  case H5VSTRING:
513  {
514  size_t ty_size = H5Tget_size(memtype);
515  if (ty_size == 0) {
516  if (rank >0)
517  H5Sclose(mspace);
518  H5Tclose(memtype);
519  H5Tclose(dtypeid);
520  H5Sclose(dspace);
521  H5Dclose(dsetid);
522  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
523  //H5Fclose(fileid);
524  ostringstream eherr;
525  eherr << "Cannot obtain the size of the fixed size HDF5 string of the dataset "
526  << varname <<endl;
527  throw InternalErr (__FILE__, __LINE__, eherr.str ());
528  }
529  vector <char> strval;
530  strval.resize(nelms*ty_size);
531  if (0 == rank)
532  read_ret = H5Dread(dsetid,memtype,H5S_ALL,H5S_ALL,H5P_DEFAULT,(void*)&strval[0]);
533  else
534  read_ret = H5Dread(dsetid,memtype,mspace,dspace,H5P_DEFAULT,(void*)&strval[0]);
535 
536  if (read_ret < 0) {
537  if (rank > 0)
538  H5Sclose(mspace);
539  H5Tclose(memtype);
540  H5Tclose(dtypeid);
541  H5Sclose(dspace);
542  H5Dclose(dsetid);
543  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
544  //H5Fclose(fileid);
545  ostringstream eherr;
546  eherr << "Cannot read the HDF5 dataset " << varname
547  << " with the type of the HDF5 variable length string "<<endl;
548  throw InternalErr (__FILE__, __LINE__, eherr.str ());
549  }
550 
551  vector<string>finstrval;
552  finstrval.resize(nelms);
553  char*temp_bp = &strval[0];
554  char*onestring = NULL;
555  for (int i =0;i<nelms;i++) {
556  onestring = *(char**)temp_bp;
557  if(onestring!=NULL )
558  finstrval[i] =string(onestring);
559 
560  else // We will add a NULL if onestring is NULL.
561  finstrval[i]="";
562  temp_bp +=ty_size;
563  }
564 
565  if (false == strval.empty()) {
566  herr_t ret_vlen_claim;
567  if (0 == rank)
568  ret_vlen_claim = H5Dvlen_reclaim(memtype,dspace,H5P_DEFAULT,(void*)&strval[0]);
569  else
570  ret_vlen_claim = H5Dvlen_reclaim(memtype,mspace,H5P_DEFAULT,(void*)&strval[0]);
571  if (ret_vlen_claim < 0){
572  if (rank >0)
573  H5Sclose(mspace);
574  H5Tclose(memtype);
575  H5Tclose(dtypeid);
576  H5Sclose(dspace);
577  H5Dclose(dsetid);
578  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
579  //H5Fclose(fileid);
580  ostringstream eherr;
581  eherr << "Cannot reclaim the memory buffer of the HDF5 variable length string of the dataset "
582  << varname <<endl;
583  throw InternalErr (__FILE__, __LINE__, eherr.str ());
584 
585  }
586  }
587 
588  // Check if we should drop the long string
589  string check_droplongstr_key ="H5.EnableDropLongString";
590  bool is_droplongstr = false;
591  is_droplongstr =
592  HDF5CFDAPUtil::check_beskeys(check_droplongstr_key);
593 
594  // If the string size is longer than the current netCDF JAVA
595  // string and the "EnableDropLongString" key is turned on,
596  // No string is generated.
597  if (true == is_droplongstr) {
598  size_t total_str_size = 0;
599  for (int i =0;i<nelms;i++)
600  total_str_size += finstrval[i].size();
601  if (total_str_size > NC_JAVA_STR_SIZE_LIMIT) {
602  for (int i =0;i<nelms;i++)
603  finstrval[i] = "";
604  }
605  }
606  set_value(finstrval,nelms);
607 
608  }
609  break;
610 
611  default:
612  {
613  H5Tclose(memtype);
614  H5Tclose(dtypeid);
615  if (0 == rank)
616  H5Sclose(mspace);
617  H5Sclose(dspace);
618  H5Dclose(dsetid);
619  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
620  //H5Fclose(fileid);
621  ostringstream eherr;
622  eherr << "Cannot read the HDF5 dataset " << varname
623  << " with the unsupported HDF5 datatype"<<endl;
624  throw InternalErr (__FILE__, __LINE__, eherr.str ());
625  }
626  }
627 
628  H5Tclose(memtype);
629  H5Tclose(dtypeid);
630  if (rank == 0)
631  H5Sclose(mspace);
632  H5Sclose(dspace);
633  H5Dclose(dsetid);
634  HDF5CFUtil::close_fileid(fileid,check_pass_fileid_key);
635  //H5Fclose(fileid);
636 
637  return true;
638 }
639 
640 
641 // parse constraint expr. and make hdf5 coordinate point location.
642 // return number of elements to read.
643 int
644 HDF5CFArray::format_constraint (int *offset, int *step, int *count)
645 {
646  long nels = 1;
647  int id = 0;
648 
649  Dim_iter p = dim_begin ();
650 
651  while (p != dim_end ()) {
652 
653  int start = dimension_start (p, true);
654  int stride = dimension_stride (p, true);
655  int stop = dimension_stop (p, true);
656 
657 
658  // Check for illegical constraint
659  if (stride < 0 || start < 0 || stop < 0 || start > stop) {
660  ostringstream oss;
661 
662  oss << "Array/Grid hyperslab indices are bad: [" << start <<
663  ":" << stride << ":" << stop << "]";
664  throw Error (malformed_expr, oss.str ());
665  }
666 
667  // Check for an empty constraint and use the whole dimension if so.
668  if (start == 0 && stop == 0 && stride == 0) {
669  start = dimension_start (p, false);
670  stride = dimension_stride (p, false);
671  stop = dimension_stop (p, false);
672  }
673 
674  offset[id] = start;
675  step[id] = stride;
676  count[id] = ((stop - start) / stride) + 1; // count of elements
677  nels *= count[id]; // total number of values for variable
678 
679  BESDEBUG ("h5",
680  "=format_constraint():"
681  << "id=" << id << " offset=" << offset[id]
682  << " step=" << step[id]
683  << " count=" << count[id]
684  << endl);
685 
686  id++;
687  p++;
688  }
689 
690  return nels;
691 }
692 
static void close_fileid(hid_t, bool)
Definition: HDF5CFUtil.cc:395
#define NC_JAVA_STR_SIZE_LIMIT
Definition: h5cfdaputil.h:42
static bool check_beskeys(const string key)
Definition: h5cfdaputil.cc:39
int format_constraint(int *cor, int *step, int *edg)
Definition: HDF5CFArray.cc:644
#define NULL
Definition: wcsUtil.h:65
HDF5CFArray(int rank, const hid_t file_id, const string &filename, H5DataType dtype, const string &varfullpath, const string &n="", BaseType *v=0)
Definition: HDF5CFArray.h:46
This class includes the methods to read data array into DAP buffer from an HDF5 dataset for the CF op...
virtual BaseType * ptr_duplicate()
Definition: HDF5CFArray.cc:45
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
virtual bool read()
Definition: HDF5CFArray.cc:51