OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
h5cfdap.cc
Go to the documentation of this file.
1 // This file is part of hdf5_handler a HDF5 file handler for the OPeNDAP
2 // data server.
3 
4 // Copyright (c) 2007-2013 The HDF Group, Inc. and OPeNDAP, Inc.
5 //
6 // This is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 2.1 of the License, or (at your
9 // option) any later version.
10 //
11 // This software is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
21 // You can contact The HDF Group, Inc. at 1800 South Oak Street,
22 // Suite 203, Champaign, IL 61820
23 
33 
34 #include <InternalErr.h>
35 #include <debug.h>
36 #include <mime_util.h>
37 #include "config_hdf5.h"
38 #include "h5cfdap.h"
39 #include <BESDebug.h>
40 
41 void read_cfdds(DDS&,const string&,hid_t);
42 void read_cfdas(DAS&, const string&,hid_t);
43 
44 void read_cfdds(DDS & dds, const string &filename,hid_t myfile_id) {
45 
46  BESDEBUG("h5","Coming to CF DDS read function read_cfdds "<<endl);
47  // Set the DDS name be the file name
48  dds.set_dataset_name(name_path(filename));
49 
50  hid_t fileid = myfile_id;
51  H5CFModule moduletype;
52 
53 #if 0
54  fileid = H5Fopen(filename.c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
55  if (fileid < 0) {
56  string msg =
57  "h5_cf_dds handler: Cannot open the HDF5 file ";
58  msg += filename;
59  throw InternalErr(__FILE__, __LINE__, msg);
60  }
61 #endif
62 
63  moduletype = check_module(fileid);
64  if (moduletype == HDF_EOS5) {
65  // cerr<<"coming to HDF-EOS5 "<<endl;
66  map_eos5_cfdds(dds,fileid, filename);
67  }
68 
69  else if(moduletype == HDF5_JPSS) {
70  // handle HDF5 JPSS product, will handle this later.
71  //read_cfjpss(fileid,filename);
72  ;
73  }
74 
75  else { // handle HDF5 general product
76  // cerr<<"coming to general HDF5"<<endl;
77  map_gmh5_cfdds(dds,fileid, filename);
78 
79  }
80 
81 }
82 
83 void read_cfdas(DAS & das, const string &filename,hid_t myfile_id) {
84 
85  BESDEBUG("h5","Coming to CF DAS read function read_cfdas "<<endl);
86  hid_t fileid = myfile_id;
87  H5CFModule moduletype;
88 
89 #if 0
90  fileid = H5Fopen(filename.c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
91  if (fileid < 0) {
92  string msg =
93  "h5_cf_das handler: Cannot open the HDF5 file ";
94  msg += filename;
95  throw InternalErr(__FILE__, __LINE__, msg);
96  }
97 #endif
98 
99  moduletype = check_module(fileid);
100  if (moduletype == HDF_EOS5) {
101  //cerr<<"coming to HDF-EOS5 "<<endl;
102  map_eos5_cfdas(das,fileid, filename);
103  }
104 
105  else if(moduletype == HDF5_JPSS) {
106  // handle HDF5 JPSS product, will handle this later.
107  //read_cfjpss(fileid,filename);
108  ;
109  }
110 
111  else { // handle HDF5 general product
112  // cerr<<"coming to general HDF5"<<endl;
113  map_gmh5_cfdas(das,fileid, filename);
114  // cerr<<"end of general HDF5 DAS"<<endl;
115 
116  }
117 
118 }
void map_gmh5_cfdds(DDS &dds, hid_t file_id, const string &filename)
Definition: h5gmcfdap.cc:62
The main wrapper of headers of the HDF5 OPeNDAP handler for the CF option.
void read_cfdds(DDS &, const string &, hid_t)
Definition: h5cfdap.cc:44
void read_cfdas(DAS &, const string &, hid_t)
Definition: h5cfdap.cc:83
H5CFModule check_module(hid_t fileid)
Definition: HDF5CFModule.cc:38
void map_eos5_cfdas(DAS &das, hid_t file_id, const string &filename)
Definition: heos5cfdap.cc:232
void map_gmh5_cfdas(DAS &das, hid_t file_id, const string &filename)
Definition: h5gmcfdap.cc:144
void map_eos5_cfdds(DDS &dds, hid_t file_id, const string &filename)
Definition: heos5cfdap.cc:77
H5CFModule
Definition: HDF5CFModule.h:42
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64