27#include <libdap/InternalErr.h>
33HE5Parser::HE5Parser() =
default;
35HE5Parser::~HE5Parser() =
default;
42 cerr<<
"Parse error:" <<
err_msg << endl;
44 cout <<
"ZA Size=" << za_list.size() << endl;
45 for (
const auto &z:za_list) {
46 cout <<
"ZA Name=" << z.name << endl;
47 cout <<
"ZA Dim Size=" << z.dim_list.size() << endl;
48 for (
const auto &d:z.dim_list) {
49 cout <<
"ZA Dim Name=" << d.name;
50 cout <<
" Size=" << d.size << endl;
53 cout <<
"ZA Var Size=" << z.data_var_list.size()
55 for (
const auto &v:z.data_var_list) {
56 cout <<
"ZA Var Name=" << v.name << endl;
57 cout <<
"ZA Var Dim Size=" << v.dim_list.size() << endl;
58 for (
const auto &d:v.dim_list)
59 cout <<
"ZA Var Dim Name=" << d.name << endl;
63 cout <<
"Swath Size=" << swath_list.size() << endl;
64 for (
const auto &s:swath_list) {
65 cout <<
"Swath Name=" << s.name << endl;
66 cout <<
"Swath Dim Size=" << s.dim_list.size() << endl;
67 for (
const auto &d:s.dim_list) {
68 cout <<
"Swath Dim Name=" << d.name;
69 cout <<
" Size=" << d.size << endl;
72 cout <<
"Swath Geo Var Size=" << s.geo_var_list.size()
74 for (
const auto &v:s.geo_var_list) {
75 cout <<
"Swath Geo Var Name=" << v.name << endl;
76 cout <<
"Swath Geo Var Dim Size=" << v.dim_list.size() << endl;
77 for (
const auto &d:v.dim_list) {
78 cout <<
"Swath Geo Var Dim Name=" << d.name;
79 cout <<
" Size=" << d.size << endl;
83 cout <<
"Swath Data Var Size=" << s.data_var_list.size()
85 for (
const auto &v:s.data_var_list) {
86 cout <<
"Swath Data Var Name=" << v.name << endl;
87 cout <<
"Swath Data Var Number Dim =" << v.dim_list.size() << endl;
88 for (
const auto &d:v.dim_list) {
89 cout <<
"Swath Data Var Dim Name=" << d.name << endl;
90 cout <<
"Swath Data Var Dim Size= "<< d.size<<endl;
94 for (
const auto &d:v.max_dim_list) {
95 cout <<
"Swath Data Var Max Dim Name=" << d.name << endl;
96 cout <<
"Swath Data Var Dim Size= "<< d.size<<endl;
102 cout <<
"Grid Size=" << grid_list.size() << endl;
103 for (
const auto &g:grid_list) {
104 cout <<
"Grid Name=" << g.name << endl;
106 cout <<
"Grid point_lower=" << g.point_lower << endl;
107 cout <<
"Grid point_upper=" << g.point_upper << endl;
108 cout <<
"Grid point_left=" << g.point_left << endl;
109 cout <<
"Grid point_right=" << g.point_right << endl;
110 cout <<
"Grid Sphere code =" <<g.sphere <<endl;
112 cout <<
"Grid Dim Size=" << g.dim_list.size() << endl;
113 for (
const auto &d:g.dim_list) {
114 cout <<
"Grid Dim Name=" << d.name;
115 cout <<
" Size=" << d.size << endl;
118 cout <<
"Grid Var Size=" << g.data_var_list.size()
120 for(
const auto &v:g.data_var_list) {
121 cout <<
"Grid Var Name=" << v.name << endl;
122 cout <<
"Grid Var Dim Size=" << v.dim_list.size() << endl;
123 for (
const auto &d:v.dim_list)
124 cout <<
"Grid Var Dim Name=" << d.name << endl;
126 for(k=0; k < v.max_dim_list.size(); k++) {
127 HE5Dim d = v.max_dim_list.at(k);
128 cout <<
"Grid Var Max Dim Name=" << d.name << endl;
132 cout <<
"Grid pixelregistration=" <<
135 cout <<
"Grid origin=" <<
138 cout <<
"Grid projection=" <<
142 cout <<
"Grid zone= "<< g.zone<<endl;
143 cout <<
"Grid sphere= "<<g.sphere<<endl;
145 cout<<
"Grid projection parameters are "<<endl;
146 for(
const auto &gp:g.param)
152void HE5Parser::add_projparams(
const string & st_str) {
154 string projparms =
"ProjParams=(";
155 char parms_end_marker =
')';
156 size_t parms_spos = st_str.find(projparms);
158 while(parms_spos!=string::npos) {
159 size_t parms_epos = st_str.find(parms_end_marker,parms_spos);
160 if(parms_epos == string::npos)
161 throw libdap::InternalErr(__FILE__,__LINE__,
"HDF-EOS5 Grid ProjParms syntax error: ProjParams doesn't end with ')'. ");
162 string projparms_raw_values = st_str.substr(parms_spos+projparms.size(),parms_epos-parms_spos-projparms.size());
163 vector<string> projparms_values;
166 for(
unsigned int i = 0; i<projparms_values.size();i++) {
167 grid_list[grid_index].param[i] = strtod(projparms_values[i].c_str(),
nullptr);
170for(vector<string>::iterator istr=projparms_values.begin();istr!=projparms_values.end();++istr)
171cerr<<
"projparms value is "<<*istr<<endl;
173 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.
void print() const
Print the information about the members of the Vector list.
std::string err_msg
Have any parse error message.
static void Split(const char *s, int len, char sep, std::vector< std::string > &names)