bes  Updated for version 3.20.6
HDF5GCFProduct.h
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-2016 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 
31 
32 #ifndef _H5GCFProduct_H
33 #define _H5GCFProduct_H
34 
35 #include <string>
36 #include <iostream>
37 #include <vector>
38 #include "hdf5.h"
39 
40 
41 enum H5GCFProduct
42 { General_Product,GPM_L1, GPMS_L3,GPMM_L3,Mea_SeaWiFS_L2, Mea_SeaWiFS_L3,Mea_Ozone,Aqu_L3,OBPG_L3,ACOS_L2S_OR_OCO2_L1B,OSMAPL2S};
43 
44 // Currently we only need to support four NASA generic HDF5 products for
45 // the access of NASA data via CF-compliant vis. tools(IDV and Panoply)
46 // via OPeNDAP.
47 // MEaSUREs SeaWiFS level 2 and level 3
48 // MEaSUREs Ozone zonal average
49 // Aquarius level 3
50 // (OSMAPL2S) Old SMAP Level 2 Simulation
51 // Note: This is different than the released SMAP products,which complies to a more general case supported by the handler.
52 // ACOS_L2S and OCO L1B needs special handling of 64-bit integer mapping but there
53 // is no way to support the access of data via the CF-compliant tools.
54 
55 // For all products
56 static const char ROOT_NAME[] ="/";
57 
58 // GPM
59 static const char GPM_ATTR1_NAME[] ="FileHeader";
60 // GPM level 3
61 static const char GPM_GRID_GROUP_NAME1[]="Grid";
62 static const char GPM_GRID_GROUP_NAME2[]="GRID";
63 static const char GPM_GRID_MULTI_GROUP_NAME[]="Grids";
64 static const char GPM_ATTR2_NAME[] ="GridHeader";
65 // GPM level 1
66 static const char GPM_SWATH_ATTR2_NAME[] ="SwathHeader";
67 
68 
69 // MEaSUREs SeaWiFS level 2 and 3
70 static const char SeaWiFS_ATTR1_NAME[] ="instrument_short_name";
71 static const char SeaWiFS_ATTR2_NAME[] ="long_name";
72 static const char SeaWiFS_ATTR3_NAME[] ="short_name";
73 static const std::string SeaWiFS_ATTR1_VALUE ="SeaWiFS";
74 
75 // FPVALUE means Part of the attribute VALUE starting from the First value.
76 // PVALUE means Part VALUE.
77 static const std::string SeaWiFS_ATTR2_FPVALUE ="SeaWiFS";
78 static const std::string SeaWiFS_ATTR2_L2PVALUE ="Level 2";
79 static const std::string SeaWiFS_ATTR2_L3PVALUE ="Level 3";
80 static const std::string SeaWiFS_ATTR3_L2FPVALUE ="SWDB_L2";
81 static const std::string SeaWiFS_ATTR3_L3FPVALUE ="SWDB_L3";
82 
83 // Aquarius level 3
84 static const char Aquarius_ATTR1_NAME[] ="Sensor";
85 static const char Aquarius_ATTR2_NAME[] ="Title";
86 static const std::string Aquarius_ATTR1_VALUE ="Aquarius";
87 static const std::string Aquarius_ATTR2_PVALUE ="Level-3";
88 
89 // OBPG level 3
90 static const char Obpgl3_ATTR1_NAME[] ="processing_level";
91 static const std::string Obpgl3_ATTR1_VALUE ="L3 Mapped";
92 static const char Obpgl3_ATTR2_NAME[] ="cdm_data_type";
93 static const std::string Obpgl3_ATTR2_VALUE ="grid";
94 
95 
96 // Old SMAP Level 2 Simulation(OSMAPL2S) and ACOS L2S(OCO2 L1B)
97 static const char SMAC2S_META_GROUP_NAME[] ="Metadata";
98 static const char OSMAPL2S_ATTR_NAME[] ="ProjectID";
99 static const std::string OSMAPL2S_ATTR_VALUE ="SMAP";
100 
101 static const char ACOS_L2S_OCO2_L1B_DSET_NAME[] ="ProjectId";
102 static const std::string ACOS_L2S_ATTR_VALUE ="ACOS";
103 static const std::string OCO2_L1B_ATTR_VALUE ="OCO2";
104 static const std::string OCO2_L1B_ATTR_VALUE2 ="OCO-2";
105 
106 
107 // MEaSURES Ozone level 2 and level 3
108 static const char Ozone_ATTR1_NAME[] ="ProductType";
109 static const std::string Ozone_ATTR1_VALUE1 ="L3 Monthly Zonal Means";
110 static const std::string Ozone_ATTR1_VALUE2 ="L2 Daily Trajectory";
111 
112 static const char Ozone_ATTR2_NAME[] ="ParameterName";
113 static const std::string Ozone_ATTR2_VALUE ="Nadir Profile and Total Column Ozone";
114 
115 // Function to check the product type
116 H5GCFProduct check_product(hid_t fileid);
117 
118 // Function to check if the product is GPM level 1
119 bool check_gpm_l1(hid_t root_id);
120 
121 // Function to check if the product is GPM level 3
122 bool check_gpmm_l3(hid_t root_id);
123 
124 bool check_gpms_l3(hid_t root_id);
125 
126 // Function to check if the product is MeaSure seaWiFS
127 // The returned integer reference of level will tell the level
128 // of the SeaWiFS product.
129 bool check_measure_seawifs(hid_t root_id,int& level);
130 
131 // Function to check if the product is Aquarius
132 // The returned integer reference of level will tell the level
133 // of the Aquarius product.
134 bool check_aquarius(hid_t root_id,int & level);
135 
136 // Check if this product is an OBPG HDF5 file
137 bool check_obpg(hid_t root_id,int & level);
138 
139 // Function to check if the product is ACOS Level 2 or OSMAPL2S.
140 // which_product tells if the product is OSMAPL2S or ACOSL2S(OCO2L1B).
141 // For example, if which_product is OSMAPL2S, it will just check
142 // if the attribute name and value are OSMAPL2S attribute and value.
143 // Then return true or false. Similar case is applied to ACOSL2S(OCO2L1B).
144 bool check_osmapl2s_acosl2s_oco2l1b(hid_t root_id, int which_product);
145 
146 // Function to check if the product is MEaSURES Ozone zonal average or level 2.
147 bool check_measure_ozone(hid_t root_id);
148 
149 // Function to check if the product is NETCDF4_GENERAL.
150 bool check_netcdf4_general(hid_t root_id);
151 
152 // Obtain the attribute value of the HDF5 general attribute.
153 void obtain_gm_attr_value(hid_t group_id, const char* attr_name, std::string & attr_value);
154 
155 
156 #endif