27#include <libdap/InternalErr.h>
37HE5Parser::~HE5Parser()
47 cerr<<
"Parse error:" <<
err_msg << endl;
49 cout <<
"ZA Size=" << za_list.size() << endl;
50 for(i=0; i < za_list.size(); i++) {
51 HE5Za z = za_list.at(i);
52 cout <<
"ZA Name=" << z.name << endl;
53 cout <<
"ZA Dim Size=" << z.dim_list.size() << endl;
55 for(j=0; j < z.dim_list.size(); j++) {
56 HE5Dim d = z.dim_list.at(j);
57 cout <<
"ZA Dim Name=" << d.name;
58 cout <<
" Size=" << d.size << endl;
61 cout <<
"ZA Var Size=" << z.data_var_list.size()
63 for(j=0; j < z.data_var_list.size(); j++) {
64 HE5Var v = z.data_var_list.at(j);
65 cout <<
"ZA Var Name=" << v.name << endl;
66 cout <<
"ZA Var Dim Size=" << v.dim_list.size() << endl;
67 for(
unsigned int k=0; k < v.dim_list.size(); k++) {
68 HE5Dim d = v.dim_list.at(k);
69 cout <<
"ZA Var Dim Name=" << d.name << endl;
74 cout <<
"Swath Size=" << swath_list.size() << endl;
75 for(i=0; i < swath_list.size(); i++) {
77 cout <<
"Swath Name=" << s.name << endl;
78 cout <<
"Swath Dim Size=" << s.dim_list.size() << endl;
80 for(j=0; j < s.dim_list.size(); j++) {
81 HE5Dim d = s.dim_list.at(j);
82 cout <<
"Swath Dim Name=" << d.name;
83 cout <<
" Size=" << d.size << endl;
86 cout <<
"Swath Geo Var Size=" << s.geo_var_list.size()
88 for(j=0; j < s.geo_var_list.size(); j++) {
89 HE5Var v = s.geo_var_list.at(j);
90 cout <<
"Swath Geo Var Name=" << v.name << endl;
91 cout <<
"Swath Geo Var Dim Size=" << v.dim_list.size() << endl;
92 for(
unsigned int k=0; k < v.dim_list.size(); k++) {
93 HE5Dim d = v.dim_list.at(k);
94 cout <<
"Swath Geo Var Dim Name=" << d.name;
95 cout <<
" Size=" << d.size << endl;
99 cout <<
"Swath Data Var Size=" << s.data_var_list.size()
101 for(j=0; j < s.data_var_list.size(); j++) {
102 HE5Var v = s.data_var_list.at(j);
103 cout <<
"Swath Data Var Name=" << v.name << endl;
104 cout <<
"Swath Data Var Number Dim =" << v.dim_list.size() << endl;
105 for(
unsigned int k=0; k < v.dim_list.size(); k++) {
106 HE5Dim d = v.dim_list.at(k);
107 cout <<
"Swath Data Var Dim Name=" << d.name << endl;
108 cout <<
"Swath Data Var Dim Size= "<< d.size<<endl;
112 for(k=0; k < v.max_dim_list.size(); k++) {
113 HE5Dim d = v.max_dim_list.at(k);
114 cout <<
"Swath Data Var Max Dim Name=" << d.name << endl;
115 cout <<
"Swath Data Var Dim Size= "<< d.size<<endl;
121 cout <<
"Grid Size=" << grid_list.size() << endl;
122 for(i=0; i < grid_list.size(); i++) {
124 cout <<
"Grid Name=" << g.name << endl;
126 cout <<
"Grid point_lower=" << g.
point_lower << endl;
127 cout <<
"Grid point_upper=" << g.
point_upper << endl;
128 cout <<
"Grid point_left=" << g.
point_left << endl;
129 cout <<
"Grid point_right=" << g.
point_right << endl;
130 cout <<
"Grid Sphere code =" <<g.sphere <<endl;
132 cout <<
"Grid Dim Size=" << g.dim_list.size() << endl;
134 for(j=0; j < g.dim_list.size(); j++) {
135 HE5Dim d = g.dim_list.at(j);
136 cout <<
"Grid Dim Name=" << d.name;
137 cout <<
" Size=" << d.size << endl;
140 cout <<
"Grid Var Size=" << g.data_var_list.size()
142 for(j=0; j < g.data_var_list.size(); j++) {
143 HE5Var v = g.data_var_list.at(j);
144 cout <<
"Grid Var Name=" << v.name << endl;
145 cout <<
"Grid Var Dim Size=" << v.dim_list.size() << endl;
146 for(
unsigned int k=0; k < v.dim_list.size(); k++) {
147 HE5Dim d = v.dim_list.at(k);
148 cout <<
"Grid Var Dim Name=" << d.name << endl;
151 for(k=0; k < v.max_dim_list.size(); k++) {
152 HE5Dim d = v.max_dim_list.at(k);
153 cout <<
"Grid Var Max Dim Name=" << d.name << endl;
157 cout <<
"Grid pixelregistration=" <<
160 cout <<
"Grid origin=" <<
163 cout <<
"Grid projection=" <<
167 cout <<
"Grid zone= "<< g.zone<<endl;
168 cout <<
"Grid sphere= "<<g.sphere<<endl;
170 cout<<
"Grid projection parameters are "<<endl;
172 cout<<g.param[j]<<endl;
177void HE5Parser::add_projparams(
const string & st_str) {
179 string projparms =
"ProjParams=(";
180 char parms_end_marker =
')';
181 size_t parms_spos = st_str.find(projparms);
183 while(parms_spos!=string::npos) {
184 size_t parms_epos = st_str.find(parms_end_marker,parms_spos);
185 if(parms_epos == string::npos)
186 throw libdap::InternalErr(__FILE__,__LINE__,
"HDF-EOS5 Grid ProjParms syntax error: ProjParams doesn't end with ')'. ");
187 string projparms_raw_values = st_str.substr(parms_spos+projparms.size(),parms_epos-parms_spos-projparms.size());
188 vector<string> projparms_values;
191 for(
unsigned int i = 0; i<projparms_values.size();i++) {
192 grid_list[grid_index].param[i] = strtod(projparms_values[i].c_str(),
nullptr);
195for(vector<string>::iterator istr=projparms_values.begin();istr!=projparms_values.end();++istr)
196cerr<<
"projparms value is "<<*istr<<endl;
198 parms_spos = st_str.find(projparms,parms_epos);
This file includes several helper functions for translating HDF5 to CF-compliant.
A class for parsing NASA HDF-EOS5 StructMetadata.
std::string err_msg
Have any parse error message.
void print()
Print the information about the members of the Vector list.
static void Split(const char *s, int len, char sep, std::vector< std::string > &names)
double point_right
The rightmost coordinate value of a Grid.
double point_upper
The top coordinate value of a Grid.
double point_left
The leftmost coordinate value of a Grid.
double point_lower
The bottom coordinate value of a Grid.