27 #include <InternalErr.h>
33 HE5Parser::HE5Parser()
40 HE5Parser::~HE5Parser()
50 cerr<<
"Parse error:" << err_msg << endl;
52 cout <<
"ZA Size=" << za_list.size() << endl;
53 for(i=0; i < za_list.size(); i++) {
54 HE5Za z = za_list.at(i);
55 cout <<
"ZA Name=" << z.name << endl;
56 cout <<
"ZA Dim Size=" << z.dim_list.size() << endl;
58 for(j=0; j < z.dim_list.size(); j++) {
59 HE5Dim d = z.dim_list.at(j);
60 cout <<
"ZA Dim Name=" << d.name;
61 cout <<
" Size=" << d.size << endl;
64 cout <<
"ZA Var Size=" << z.data_var_list.size()
66 for(j=0; j < z.data_var_list.size(); j++) {
67 HE5Var v = z.data_var_list.at(j);
68 cout <<
"ZA Var Name=" << v.name << endl;
69 cout <<
"ZA Var Dim Size=" << v.dim_list.size() << endl;
71 for(k=0; k < v.dim_list.size(); k++) {
72 HE5Dim d = v.dim_list.at(k);
73 cout <<
"ZA Var Dim Name=" << d.name << endl;
78 cout <<
"Swath Size=" << swath_list.size() << endl;
79 for(i=0; i < swath_list.size(); i++) {
81 cout <<
"Swath Name=" << s.name << endl;
82 cout <<
"Swath Dim Size=" << s.dim_list.size() << endl;
84 for(j=0; j < s.dim_list.size(); j++) {
85 HE5Dim d = s.dim_list.at(j);
86 cout <<
"Swath Dim Name=" << d.name;
87 cout <<
" Size=" << d.size << endl;
90 cout <<
"Swath Geo Var Size=" << s.geo_var_list.size()
92 for(j=0; j < s.geo_var_list.size(); j++) {
93 HE5Var v = s.geo_var_list.at(j);
94 cout <<
"Swath Geo Var Name=" << v.name << endl;
95 cout <<
"Swath Geo Var Dim Size=" << v.dim_list.size() << endl;
97 for(k=0; k < v.dim_list.size(); k++) {
98 HE5Dim d = v.dim_list.at(k);
99 cout <<
"Swath Geo Var Dim Name=" << d.name;
100 cout <<
" Size=" << d.size << endl;
104 cout <<
"Swath Data Var Size=" << s.data_var_list.size()
106 for(j=0; j < s.data_var_list.size(); j++) {
107 HE5Var v = s.data_var_list.at(j);
108 cout <<
"Swath Data Var Name=" << v.name << endl;
109 cout <<
"Swath Data Var Number Dim =" << v.dim_list.size() << endl;
111 for(k=0; k < v.dim_list.size(); k++) {
112 HE5Dim d = v.dim_list.at(k);
113 cout <<
"Swath Data Var Dim Name=" << d.name << endl;
114 cout <<
"Swath Data Var Dim Size= "<< d.size<<endl;
118 for(k=0; k < v.max_dim_list.size(); k++) {
119 HE5Dim d = v.max_dim_list.at(k);
120 cout <<
"Swath Data Var Max Dim Name=" << d.name << endl;
121 cout <<
"Swath Data Var Dim Size= "<< d.size<<endl;
127 cout <<
"Grid Size=" << grid_list.size() << endl;
128 for(i=0; i < grid_list.size(); i++) {
130 cout <<
"Grid Name=" << g.name << endl;
132 cout <<
"Grid point_lower=" << g.
point_lower << endl;
133 cout <<
"Grid point_upper=" << g.
point_upper << endl;
134 cout <<
"Grid point_left=" << g.
point_left << endl;
135 cout <<
"Grid point_right=" << g.
point_right << endl;
136 cout <<
"Grid Sphere code =" <<g.sphere <<endl;
138 cout <<
"Grid Dim Size=" << g.dim_list.size() << endl;
140 for(j=0; j < g.dim_list.size(); j++) {
141 HE5Dim d = g.dim_list.at(j);
142 cout <<
"Grid Dim Name=" << d.name;
143 cout <<
" Size=" << d.size << endl;
146 cout <<
"Grid Var Size=" << g.data_var_list.size()
148 for(j=0; j < g.data_var_list.size(); j++) {
149 HE5Var v = g.data_var_list.at(j);
150 cout <<
"Grid Var Name=" << v.name << endl;
151 cout <<
"Grid Var Dim Size=" << v.dim_list.size() << endl;
153 for(k=0; k < v.dim_list.size(); k++) {
154 HE5Dim d = v.dim_list.at(k);
155 cout <<
"Grid Var Dim Name=" << d.name << endl;
158 for(k=0; k < v.max_dim_list.size(); k++) {
159 HE5Dim d = v.max_dim_list.at(k);
160 cout <<
"Grid Var Max Dim Name=" << d.name << endl;
164 cout <<
"Grid pixelregistration=" <<
167 cout <<
"Grid origin=" <<
170 cout <<
"Grid projection=" <<
174 cout <<
"Grid zone= "<< g.zone<<endl;
175 cout <<
"Grid sphere= "<<g.sphere<<endl;
177 cout<<
"Grid projection parameters are "<<endl;
179 cout<<g.param[j]<<endl;
184 void HE5Parser::add_projparams(
const string & st_str) {
186 string projparms =
"ProjParams=(";
187 char parms_end_marker =
')';
188 size_t parms_spos = st_str.find(projparms);
190 while(parms_spos!=string::npos) {
191 size_t parms_epos = st_str.find(parms_end_marker,parms_spos);
192 if(parms_epos == string::npos)
193 throw libdap::InternalErr(__FILE__,__LINE__,
"HDF-EOS5 Grid ProjParms syntax error: ProjParams doesn't end with ')'. ");
194 string projparms_raw_values = st_str.substr(parms_spos+projparms.size(),parms_epos-parms_spos-projparms.size());
195 vector<string> projparms_values;
198 for(
unsigned int i = 0; i<projparms_values.size();i++) {
199 grid_list[grid_index].param[i] = strtod(projparms_values[i].c_str(),NULL);
202 for(vector<string>::iterator istr=projparms_values.begin();istr!=projparms_values.end();++istr)
203 cerr<<
"projparms value is "<<*istr<<endl;
205 parms_spos = st_str.find(projparms,parms_epos);