bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
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-2023 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 410 E University Ave,
20// Suite 200, 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
41enum H5GCFProduct
42{ General_Product,GPM_L1, GPMS_L3,GPMM_L3,GPM_L3_New,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
56static const char ROOT_NAME[] ="/";
57
58// GPM
59static const char GPM_ATTR1_NAME[] ="FileHeader";
60// GPM level 3
61static const char GPM_GRID_GROUP_NAME1[]="Grid";
62static const char GPM_GRID_GROUP_NAME2[]="GRID";
63static const char GPM_GRID_MULTI_GROUP_NAME[]="Grids";
64static const char GPM_ATTR2_NAME[] ="GridHeader";
65// GPM level 1
66static const char GPM_SWATH_ATTR2_NAME[] ="SwathHeader";
67
68
69// MEaSUREs SeaWiFS level 2 and 3
70static const char SeaWiFS_ATTR1_NAME[] ="instrument_short_name";
71static const char SeaWiFS_ATTR2_NAME[] ="long_name";
72static const char SeaWiFS_ATTR3_NAME[] ="short_name";
73static 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.
77static const std::string SeaWiFS_ATTR2_FPVALUE ="SeaWiFS";
78static const std::string SeaWiFS_ATTR2_L2PVALUE ="Level 2";
79static const std::string SeaWiFS_ATTR2_L3PVALUE ="Level 3";
80static const std::string SeaWiFS_ATTR3_L2FPVALUE ="SWDB_L2";
81static const std::string SeaWiFS_ATTR3_L3FPVALUE ="SWDB_L3";
82
83// Aquarius level 3
84static const char Aquarius_ATTR1_NAME[] ="Sensor";
85static const char Aquarius_ATTR2_NAME[] ="Title";
86static const char Aquarius_ATTR1_NAME2[] ="instrument";
87static const char Aquarius_ATTR2_NAME2[] ="title";
88
89static const std::string Aquarius_ATTR1_VALUE ="Aquarius";
90static const std::string Aquarius_ATTR2_PVALUE ="Level-3";
91
92// OBPG level 3
93static const char Obpgl3_ATTR1_NAME[] ="processing_level";
94static const std::string Obpgl3_ATTR1_VALUE ="L3 Mapped";
95static const char Obpgl3_ATTR2_NAME[] ="cdm_data_type";
96static const std::string Obpgl3_ATTR2_VALUE ="grid";
97
98
99// Old SMAP Level 2 Simulation(OSMAPL2S) and ACOS L2S(OCO2 L1B)
100static const char SMAC2S_META_GROUP_NAME[] ="Metadata";
101static const char OSMAPL2S_ATTR_NAME[] ="ProjectID";
102static const std::string OSMAPL2S_ATTR_VALUE ="SMAP";
103
104static const char ACOS_L2S_OCO2_L1B_DSET_NAME[] ="ProjectId";
105static const std::string ACOS_L2S_ATTR_VALUE ="ACOS";
106static const std::string OCO2_L1B_ATTR_VALUE ="OCO2";
107static const std::string OCO2_L1B_ATTR_VALUE2 ="OCO-2";
108
109
110// MEaSURES Ozone level 2 and level 3
111static const char Ozone_ATTR1_NAME[] ="ProductType";
112static const std::string Ozone_ATTR1_VALUE1 ="L3 Monthly Zonal Means";
113static const std::string Ozone_ATTR1_VALUE2 ="L2 Daily Trajectory";
114
115static const char Ozone_ATTR2_NAME[] ="ParameterName";
116static const std::string Ozone_ATTR2_VALUE ="Nadir Profile and Total Column Ozone";
117
118// Function to check the product type
119H5GCFProduct check_product(hid_t fileid);
120
121// Function to check if the product is GPM level 1
122bool check_gpm_l1(hid_t root_id);
123
124// Function to check if the product is GPM level 3
125bool check_gpmm_l3(hid_t root_id);
126
127bool check_gpms_l3(hid_t root_id);
128
129// Function to check if the product is MeaSure seaWiFS
130// The returned integer reference of level will tell the level
131// of the SeaWiFS product.
132bool check_measure_seawifs(hid_t root_id,int& level);
133
134// Function to check if the product is Aquarius
135// The returned integer reference of level will tell the level
136// of the Aquarius product.
137bool check_aquarius(hid_t root_id,int & level);
138
139// Check if this product is an OBPG HDF5 file
140bool check_obpg(hid_t root_id,int & level);
141
142// Function to check if the product is ACOS Level 2 or OSMAPL2S.
143// which_product tells if the product is OSMAPL2S or ACOSL2S(OCO2L1B).
144// For example, if which_product is OSMAPL2S, it will just check
145// if the attribute name and value are OSMAPL2S attribute and value.
146// Then return true or false. Similar case is applied to ACOSL2S(OCO2L1B).
147bool check_osmapl2s_acosl2s_oco2l1b(hid_t root_id, int which_product);
148
149// Function to check if the product is MEaSURES Ozone zonal average or level 2.
150bool check_measure_ozone(hid_t root_id);
151
152// Function to check if the product is NETCDF4_GENERAL.
153bool check_netcdf4_general(hid_t root_id);
154
155// Obtain the attribute value of the HDF5 general attribute.
156void obtain_gm_attr_value(hid_t group_id, const char* attr_name, std::string & attr_value);
157
158
159#endif