bes  Updated for version 3.20.13
h5commoncfdap.h
Go to the documentation of this file.
1 // This file is part of hdf5_handler: an HDF5 file handler for the OPeNDAP
2 // data server.
3 
4 // Copyright (c) 2011-2016 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 
32 
33 #ifndef _H5COMMONCFDAP_H
34 #define _H5COMMONCFDAP_H
35 
36 #include <string>
37 
38 #include <libdap/DMR.h>
39 #include <libdap/DDS.h>
40 #include <libdap/DAS.h>
41 #include <libdap/D4Attributes.h>
42 #include <libdap/D4Maps.h>
43 #include "hdf5.h"
44 
45 #include "HDF5CF.h"
46 
47 
48 void gen_dap_onevar_dds(libdap::DDS &dds, const HDF5CF::Var*, const hid_t, const std::string &);
49 void gen_dap_oneobj_das(libdap::AttrTable*, const HDF5CF::Attribute*, const HDF5CF::Var*);
50 void gen_dap_onevar_dmr(libdap::D4Group*, const HDF5CF::Var*, const hid_t, const std::string &);
51 void map_cfh5_var_attrs_to_dap4(const HDF5CF::Var*var,libdap::BaseType*new_var);
52 void map_cfh5_grp_attr_to_dap4(libdap::D4Group*, const HDF5CF::Attribute*);
53 void map_cfh5_attr_container_to_dap4(libdap::D4Attribute *, const HDF5CF::Attribute*);
54 
55 
56 void add_cf_grid_mapping_attr(libdap::DAS &das, const std::vector<HDF5CF::Var*>& vars, const std::string& cf_projection,
57  const std::string & dim0name, hsize_t dim0size, const std::string &dim1name, hsize_t dim1size);
58 #if 0
59 void add_cf_grid_cv_attrs(DAS & das, const vector<HDF5CF::Var*>& vars, EOS5GridPCType cv_proj_code,
60  float cv_point_lower, float cv_point_upper, float cv_point_left, float cv_point_right,
61  const vector<HDF5CF::Dimension*>& dims,const vector<double>& params,const unsigned short);
62 #endif
63 void add_cf_grid_cv_attrs(libdap::DAS & das, const std::vector<HDF5CF::Var*>& vars, EOS5GridPCType cv_proj_code,
64  const std::vector<HDF5CF::Dimension*>& dims,const std::vector<double>& params,const unsigned short);
65 
66 void add_cf_projection_attrs(libdap::DAS &,EOS5GridPCType ,const std::vector<double> &,const std::string&);
67 void add_cf_grid_cvs(libdap::DDS & dds, EOS5GridPCType cv_proj_code, float cv_point_lower, float cv_point_upper,
68  float cv_point_left, float cv_point_right, const std::vector<HDF5CF::Dimension*>& dims);
69 
70 void add_cf_grid_mapinfo_var(libdap::DDS &dds,const EOS5GridPCType,const unsigned short);
71 bool need_special_attribute_handling(const HDF5CF::Attribute*, const HDF5CF::Var*);
72 void gen_dap_special_oneobj_das(libdap::AttrTable*, const HDF5CF::Attribute*, const HDF5CF::Var*);
73 bool is_fvalue_valid(H5DataType, const HDF5CF::Attribute*);
74 void gen_dap_str_attr(libdap::AttrTable*, const HDF5CF::Attribute *);
75 void add_ll_valid_range(libdap::AttrTable*, bool is_lat);
76 void map_cfh5_var_attrs_to_dap4_int64(const HDF5CF::Var*var,libdap::BaseType*new_var);
77 bool need_attr_values_for_dap4(const HDF5CF::Var*var);
78 void check_update_int64_attr(const std::string &, const HDF5CF::Attribute *);
79 void handle_coor_attr_for_int64_var(const HDF5CF::Attribute *, const std::string &,std::string&,bool);
80 libdap::D4Attribute *gen_dap4_attr(const HDF5CF::Attribute *);
81 std::string get_cf_string(std::string & s);
82 std::string get_cf_string_helper(std::string & s);
83 
84 void add_gm_spcvs(libdap::D4Group *d4_root, EOS5GridPCType cv_proj_code, float cv_point_lower, float cv_point_upper,
85  float cv_point_left, float cv_point_right, const std::vector<HDF5CF::Dimension*>& dims);
86 void add_gm_spcvs_attrs(libdap::BaseType *d4_var,const bool is_dim0);
87 
88 void add_cf_grid_cv_dap4_attrs(libdap::D4Group *d4_root, const std::string& cf_projection, const std::vector<HDF5CF::Dimension*>&dims, const std::vector<std::string> &);
89 
90 void add_gm_oneproj_var_dap4_attrs(libdap::BaseType *d4_var,EOS5GridPCType cv_proj_code,const std::vector<double> &eos5_proj_params);
91 
92 void add_var_dap4_attr(libdap::BaseType *d4_var,const std::string& attr_name, D4AttributeType attr_type, const std::string& attr_value);
93 
94 void add_grp_dap4_attr(libdap::D4Group *d4_grp,const std::string& attr_name, D4AttributeType attr_type, const std::string& attr_value);
95 
96 void add_dap4_coverage(libdap::D4Group* d4_grp, const std::vector<std::string>& map_array, bool is_coard);
97 
98 
99 #endif
This class specifies the core engineering of mapping HDF5 to DAP by following CF.
This class represents one attribute.
Definition: HDF5CF.h:189
This class represents one HDF5 dataset(CF variable)
Definition: HDF5CF.h:256
void gen_dap_str_attr(AttrTable *at, const HDF5CF::Attribute *attr)
Transfer string attributes to a DAP2 AttrTable.