bes  Updated for version 3.20.10
HDF5CF.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 
37 
38 #ifndef _HDF5CF_H
39 #define _HDF5CF_H
40 
41 #include<sstream>
42 #include <iostream>
43 #include <vector>
44 #include <map>
45 #include <set>
46 #include <list>
47 #include <algorithm>
48 #include "HDF5CFUtil.h"
49 //#include "h5cfdaputil.h"
50 #include "HDF5GCFProduct.h"
51 #include "HE5Parser.h"
52 
53 // "enum CVType: CV_EXIST,CV_LAT_MISS,CV_LON_MISS,CV_NONLATLON_MISS,CV_FILLINDEX,CV_MODIFY,CV_SPECIAL,CV_UNSUPPORTED"
54 enum EOS5Type {
55  GRID, SWATH, ZA, OTHERVARS
56 };
57 enum GMPattern {
58  GENERAL_DIMSCALE, GENERAL_LATLON2D, GENERAL_LATLON1D, GENERAL_LATLON_COOR_ATTR, OTHERGMS
59 };
60 enum EOS5AuraName {
61  OMI, MLS, HIRDLS, TES, NOTAURA
62 };
63 static std::string FILE_ATTR_TABLE_NAME = "HDF5_GLOBAL";
64 
65 namespace HDF5CF {
66 class File;
67 class GMFile;
68 class EOS5File;
69 
70 class Exception: public std::exception {
71 public:
73  explicit Exception(const std::string & msg) :
74  message(msg)
75  {
76  }
77 
78  virtual ~ Exception() throw ()
79  {
80  }
81 
82  virtual const char *what() const throw ()
83  {
84  return this->message.c_str();
85  }
86 
87  virtual void setException(std::string except_message)
88  {
89  this->message = except_message;
90  }
91 
92 private:
93  std::string message;
94 };
95 template<typename T, typename U, typename V, typename W, typename X> static void _throw5(const char *fname, int line,
96  int numarg, const T & a1, const U & a2, const V & a3, const W & a4, const X & a5)
97 {
98  std::ostringstream ss;
99  ss << fname << ":" << line << ":";
100  for (int i = 0; i < numarg; ++i) {
101  ss << " ";
102  switch (i) {
103  case 0:
104  ss << a1;
105  break;
106  case 1:
107  ss << a2;
108  break;
109  case 2:
110  ss << a3;
111  break;
112  case 3:
113  ss << a4;
114  break;
115  case 4:
116  ss << a5;
117  break;
118  default:
119  break;
120  }
121  }
122  throw Exception(ss.str());
123 }
124 
126 // number of arguments.
128 #define throw1(a1) _throw5(__FILE__, __LINE__, 1, a1, 0, 0, 0, 0)
129 #define throw2(a1, a2) _throw5(__FILE__, __LINE__, 2, a1, a2, 0, 0, 0)
130 #define throw3(a1, a2, a3) _throw5(__FILE__, __LINE__, 3, a1, a2, a3, 0, 0)
131 #define throw4(a1, a2, a3, a4) _throw5(__FILE__, __LINE__, 4, a1, a2, a3, a4, 0)
132 #define throw5(a1, a2, a3, a4, a5) _throw5(__FILE__, __LINE__, 5, a1, a2, a3, a4, a5)
133 
134 struct delete_elem {
135  template<typename T> void operator ()(T * ptr)
136  {
137  delete ptr;
138  }
139 };
140 
142 // It holds only the size of that dimension.
143 // Note: currently the unlimited dimension(maxdims) case
144 // doesn't need to be considered.
145 class Dimension {
146 public:
147  hsize_t getSize() const
148  {
149  return this->size;
150  }
151  const std::string & getName() const
152  {
153  return this->name;
154  }
155  const std::string & getNewName() const
156  {
157  return this->newname;
158  }
159 
161  bool HaveUnlimitedDim() const
162  {
163  return unlimited_dim;
164  }
165 
166 protected:
167  explicit Dimension(hsize_t dimsize) :
168  size(dimsize), name(""), newname(""), unlimited_dim(false)
169  {
170  }
171 
172 private:
173  hsize_t size;
174  std::string name;
175  std::string newname;
176  bool unlimited_dim;
177 
178  friend class EOS5File;
179  friend class GMFile;
180  friend class File;
181  friend class Var;
182  friend class CVar;
183  friend class GMCVar;
184  friend class EOS5CVar;
185  friend class GMSPVar;
186 };
187 
189 class Attribute {
190 
191 public:
192  Attribute() :
193  dtype(H5UNSUPTYPE), count(0), fstrsize(0),is_cset_ascii(true)
194  {
195  }
196  ;
197  ~Attribute();
198 
199  const std::string & getName() const
200  {
201  return this->name;
202  }
203 
204  const std::string & getNewName() const
205  {
206  return this->newname;
207  }
208 
209  H5DataType getType() const
210  {
211  return this->dtype;
212  }
213 
214  hsize_t getCount() const
215  {
216  return this->count;
217  }
218 
219  size_t getBufSize() const
220  {
221  return (this->value).size();
222  }
223 
224  const std::vector<char>&getValue() const
225  {
226  return this->value;
227  }
228 
229  const std::vector<size_t>&getStrSize() const
230  {
231  return this->strsize;
232  }
233 
234  bool getCsetType() const {
235  return this->is_cset_ascii;
236  }
237 
238 private:
239  std::string name;
240  std::string newname;
241  H5DataType dtype;
242  hsize_t count;
243  std::vector<size_t> strsize;
244  size_t fstrsize;
245  std::vector<char> value;
246  bool is_cset_ascii;
247 
248  friend class File;
249  friend class GMFile;
250  friend class EOS5File;
251  friend class Var;
252  friend class CVar;
253  friend class GMCVar;
254  friend class GMSPVar;
255  friend class EOS5CVar;
256 };
257 
259 class Var {
260 public:
261  Var() :
262  dtype(H5UNSUPTYPE), rank(-1), comp_ratio(1), total_elems(0), zero_storage_size(false),unsupported_attr_dtype(false),
263  unsupported_attr_dspace(false), unsupported_dspace(false), dimnameflag(false),coord_attr_add_path(true)
264  {
265  }
266  explicit Var(Var*var);
267  virtual ~Var();
268 
269 
271  const std::string & getName() const
272  {
273  return this->name;
274  }
275 
277  const std::string & getNewName() const
278  {
279  return this->newname;
280  }
281 
283  const std::string & getFullPath() const
284  {
285  return this->fullpath;
286  }
287 
288  size_t getTotalElems() const
289  {
290  return this->total_elems;
291 
292  }
293 
294  const bool getZeroStorageSize() const
295  {
296  return this->zero_storage_size;
297  }
298 
299  const bool getCoorAttrAddPath() const
300  {
301  return this->coord_attr_add_path;
302  }
303 
305  int getRank() const
306  {
307  return this->rank;
308  }
309 
311  H5DataType getType() const
312  {
313  return this->dtype;
314  }
315 
316  const std::vector<Attribute *>&getAttributes() const
317  {
318  return this->attrs;
319  }
320 
322  const std::vector<Dimension *>&getDimensions() const
323  {
324  return this->dims;
325  }
326 
328  int getCompRatio() const
329  {
330  return this->comp_ratio;
331  }
332 
333 private:
334 
335  std::string newname;
336  std::string name;
337  std::string fullpath;
338  H5DataType dtype;
339  int rank;
340  int comp_ratio;
341  size_t total_elems;
342  bool zero_storage_size;
343  bool unsupported_attr_dtype;
344  bool unsupported_attr_dspace;
345  bool unsupported_dspace;
346  bool dimnameflag;
347  bool coord_attr_add_path;
348 
349  std::vector<Attribute *> attrs;
350  std::vector<Dimension *> dims;
351 
352  friend class CVar;
353  friend class GMCVar;
354  friend class GMSPVar;
355  friend class EOS5CVar;
356  friend class File;
357  friend class GMFile;
358  friend class EOS5File;
359 };
360 
362 class CVar: public Var {
363 public:
364  CVar() :
365  cvartype(CV_UNSUPPORTED)
366  {
367  }
368  virtual ~CVar()
369  {
370  }
372  CVType getCVType() const
373  {
374  return this->cvartype;
375  }
376 
377  bool isLatLon() const;
378 
379 private:
380  // Each coordinate variable has and only has one dimension
381  // This assumption is based on the exact match between
382  // variables and dimensions
383  std::string cfdimname;
384  CVType cvartype;
385 
386  friend class File;
387  friend class GMFile;
388  friend class EOS5File;
389 };
390 
392 class GMSPVar: public Var {
393 public:
394  GMSPVar() :
395  otype(H5UNSUPTYPE), sdbit(-1), numofdbits(-1)
396  {
397  }
398  explicit GMSPVar(Var *var);
399  virtual ~GMSPVar()
400  {
401  }
402  H5DataType getOriginalType() const
403  {
404  return this->otype;
405  }
406 
407  int getStartBit() const
408  {
409  return this->sdbit;
410  }
411 
412  int getBitNum() const
413  {
414  return this->numofdbits;
415  }
416 
417 private:
418  H5DataType otype;
419  int sdbit;
420  int numofdbits;
421 
422  friend class File;
423  friend class GMFile;
424 };
425 
427 class GMCVar: public CVar {
428 public:
429  GMCVar() :
430  product_type(General_Product)
431  {
432  }
433  explicit GMCVar(Var*var);
434  virtual ~GMCVar()
435  {
436  }
437 
439  H5GCFProduct getPtType() const
440  {
441  return this->product_type;
442  }
443 
444 private:
445  H5GCFProduct product_type;
446  friend class GMFile;
447 };
448 
450 class EOS5CVar: public CVar {
451 public:
452  EOS5CVar() :
453  eos_type(OTHERVARS), is_2dlatlon(false), point_lower(0.0), point_upper(0.0), point_left(0.0), point_right(0.0), xdimsize(
454  0), ydimsize(0), eos5_pixelreg(HE5_HDFE_CENTER), // may change later
455  eos5_origin(HE5_HDFE_GD_UL), // may change later
456  eos5_projcode(HE5_GCTP_GEO), //may change later
457  zone(-1), sphere(0)
458  {
459  std::fill_n(param, 13, 0);
460  }
461  ;
462  explicit EOS5CVar(Var *);
463 
464  virtual ~EOS5CVar()
465  {
466  }
467 
468  EOS5Type getEos5Type() const
469  {
470  return this->eos_type;
471  }
472  float getPointLower() const
473  {
474  return this->point_lower;
475  }
476  float getPointUpper() const
477  {
478  return this->point_upper;
479  }
480 
481  float getPointLeft() const
482  {
483  return this->point_left;
484  }
485  float getPointRight() const
486  {
487  return this->point_right;
488  }
489 
490  EOS5GridPRType getPixelReg() const
491  {
492  return this->eos5_pixelreg;
493  }
494  EOS5GridOriginType getOrigin() const
495  {
496  return this->eos5_origin;
497  }
498 
499  EOS5GridPCType getProjCode() const
500  {
501  return this->eos5_projcode;
502  }
503 
504  int getXDimSize() const
505  {
506  return this->xdimsize;
507  }
508 
509  int getYDimSize() const
510  {
511  return this->ydimsize;
512  }
513 
514  std::vector<double> getParams() const
515  {
516  std::vector<double> ret_params;
517  for (int i = 0; i < 13; i++)
518  ret_params.push_back(param[i]);
519  return ret_params;
520  }
521 
522  int getZone() const
523  {
524  return this->zone;
525  }
526 
527  int getSphere() const
528  {
529  return this->sphere;
530  }
531 
532 private:
533  EOS5Type eos_type;
534  bool is_2dlatlon;
535  float point_lower;
536  float point_upper;
537  float point_left;
538  float point_right;
539  int xdimsize;
540  int ydimsize;
541  EOS5GridPRType eos5_pixelreg;
542  EOS5GridOriginType eos5_origin;
543  EOS5GridPCType eos5_projcode;
544 
545  double param[13];
546  int zone;
547  int sphere;
548  friend class EOS5File;
549 };
550 
552 class Group {
553 public:
554  Group() :
555  unsupported_attr_dtype(false), unsupported_attr_dspace(false)
556  {
557  }
558  ~Group();
559 
560 
562  const std::string & getPath() const
563  {
564  return this->path;
565  }
566 
568  const std::string & getNewName() const
569  {
570  return this->newname;
571  }
572 
573  const std::vector<Attribute *>&getAttributes() const
574  {
575  return this->attrs;
576  }
577 
578 private:
579 
580  std::string newname;
581  std::string path;
582 
583  std::vector<Attribute *> attrs;
584  bool unsupported_attr_dtype;
585  bool unsupported_attr_dspace;
586 
587  friend class File;
588  friend class GMFile;
589  friend class EOS5File;
590 };
591 
593 class File {
594 public:
595 
603  virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool);
604 
606  virtual void Retrieve_H5_Supported_Attr_Values();
607 
609  virtual void Retrieve_H5_Var_Attr_Values(Var *var);
610 
613 
615  virtual void Handle_Unsupported_Dtype(bool);
616 
618  virtual void Handle_Unsupported_Dspace(bool);
619 
621  virtual void Handle_Unsupported_Others(bool) ;
622 
624  virtual void Flatten_Obj_Name(bool) ;
625 
627  virtual void Add_Supplement_Attrs(bool) ;
628 
630  virtual bool Have_Grid_Mapping_Attrs();
631 
633  virtual void Handle_Grid_Mapping_Vars();
634 
636  virtual void Handle_Coor_Attr() = 0;
637 
639  virtual void Handle_CVar() = 0;
640 
642  virtual void Handle_SpVar() = 0;
643 
645  virtual void Handle_SpVar_Attr() = 0;
646 
648  virtual void Handle_SpVar_DMR() = 0;
649 
651  virtual void Adjust_Obj_Name() = 0;
652 
654  virtual void Adjust_Dim_Name() = 0;
655 
658  virtual void Handle_DimNameClashing() = 0;
659 
661  hid_t getFileID() const
662  {
663  return this->fileid;
664  }
665 
667  const std::string & getPath() const
668  {
669  return this->path;
670  }
671 
673  const std::vector<Var *>&getVars() const
674  {
675  return this->vars;
676  }
677 
679  const std::vector<Attribute *>&getAttributes() const
680  {
681  return this->root_attrs;
682  }
683 
685  const std::vector<Group *>&getGroups() const
686  {
687  return this->groups;
688  }
689 
691  bool HaveUnlimitedDim() const
692  {
693  return have_udim;
694  }
695 
696  void setDap4(bool is_dap4)
697  {
698  _is_dap4 = is_dap4;
699  }
700  bool getDap4() const
701  {
702  return _is_dap4;
703  }
705  virtual bool Get_IgnoredInfo_Flag() = 0;
706 
708  virtual const std::string & Get_Ignored_Msg() = 0;
709 
710  virtual ~File();
711 
712 protected:
713 
714  void Retrieve_H5_Obj(hid_t grp_id, const char*gname, bool include_attr);
715  void Retrieve_H5_Attr_Info(Attribute *, hid_t obj_id, const int j, bool& unsup_attr_dtype, bool & unsup_attr_dspace);
716 
717  void Retrieve_H5_Attr_Value(Attribute *attr, std::string);
718 
719  void Retrieve_H5_VarType(Var*, hid_t dset_id, const std::string& varname, bool &unsup_var_dtype);
720  void Retrieve_H5_VarDim(Var*, hid_t dset_id, const std::string &varname, bool & unsup_var_dspace);
721 
722  float Retrieve_H5_VarCompRatio(Var*, hid_t);
723 
724  void Handle_Group_Unsupported_Dtype() ;
725  void Handle_Var_Unsupported_Dtype() ;
726  void Handle_VarAttr_Unsupported_Dtype() ;
727 
728  void Handle_GroupAttr_Unsupported_Dspace() ;
729  void Handle_VarAttr_Unsupported_Dspace() ;
730 
731  void Gen_Group_Unsupported_Dtype_Info() ;
732  void Gen_Var_Unsupported_Dtype_Info() ;
733  virtual void Gen_VarAttr_Unsupported_Dtype_Info() ;
734 
735  void Handle_GeneralObj_NameClashing(bool, std::set<std::string> &objnameset) ;
736  void Handle_Var_NameClashing(std::set<std::string> &objnameset) ;
737  void Handle_Group_NameClashing(std::set<std::string> &objnameset) ;
738  void Handle_Obj_AttrNameClashing() ;
739  template<typename T> void Handle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec) ;
740 
741  void Add_One_FakeDim_Name(Dimension *dim) ;
742  void Adjust_Duplicate_FakeDim_Name(Dimension * dim) ;
743  void Insert_One_NameSizeMap_Element(std::string name, hsize_t size, bool unlimited) ;
744  void Insert_One_NameSizeMap_Element2(std::map<std::string, hsize_t> &, std::map<std::string, bool>&, std::string name, hsize_t size,
745  bool unlimited) ;
746 
747  virtual std::string get_CF_string(std::string);
748  virtual void Replace_Var_Info(Var* src, Var *target);
749  virtual void Replace_Var_Attrs(Var *src, Var*target);
750 
751  void Add_Str_Attr(Attribute* attr, const std::string &attrname, const std::string& strvalue) ;
752  std::string Retrieve_Str_Attr_Value(Attribute *attr, const std::string var_path);
753  bool Is_Str_Attr(Attribute* attr, std::string varfullpath, const std::string &attrname, const std::string& strvalue);
754  void Add_One_Float_Attr(Attribute* attr, const std::string &attrname, float float_value) ;
755  void Replace_Var_Str_Attr(Var* var, const std::string &attr_name, const std::string& strvalue);
756  void Change_Attr_One_Str_to_Others(Attribute *attr, Var *var) ;
757 
758  // Check if having variable latitude by variable names (containing ???latitude/Latitude/lat)
759  bool Is_geolatlon(const std::string &var_name, bool is_lat);
760  bool has_latlon_cf_units(Attribute*attr, const std::string &varfullpath, bool is_lat);
761 
762  // Check if a variable with a var name is under a specific group with groupname
763  // note: the variable's size at each dimension is also returned. The user must allocate the
764  // memory for the dimension sizes(an array(vector is perferred).
765  bool is_var_under_group(const std::string &varname, const std::string &grpname, const int var_rank, std::vector<size_t> &var_size);
766 
767  // Remove netCDF internal attributes. Right now, only CLASS=DIMENSION_SCALE and NAME=Var_name and NAME=pure netCDF dimesnion are handled.
768  void remove_netCDF_internal_attributes(bool include_attr);
769 
770  virtual void Gen_Unsupported_Dtype_Info(bool) = 0;
771  virtual void Gen_Unsupported_Dspace_Info() ;
772  void Gen_DimScale_VarAttr_Unsupported_Dtype_Info() ;
773  void add_ignored_info_page_header();
774  void add_ignored_info_obj_header();
775  // void add_ignored_info_obj_dtype_header();
776  //void add_ignored_info_obj_dspace_header();
777  void add_ignored_info_links_header();
778  void add_ignored_info_links(const std::string& link_name);
779  void add_ignored_info_namedtypes(const std::string&, const std::string&);
780  void add_ignored_info_attrs(bool is_grp, const std::string & obj_path, const std::string &attr_name);
781  void add_ignored_info_objs(bool is_dim_related, const std::string & obj_path);
782  void add_no_ignored_info();
783  bool ignored_dimscale_ref_list(Var *var);
784  bool Check_DropLongStr(Var *var, Attribute *attr) ;
785  void add_ignored_var_longstr_info(Var*var, Attribute *attr) ;
786  void add_ignored_grp_longstr_info(const std::string& grp_path, const std::string& attr_name);
787  void add_ignored_droplongstr_hdr();
788  bool Check_VarDropLongStr(const std::string &varpath, const std::vector<Dimension *>&, H5DataType) const;
789 
790  void release_standalone_var_vector(std::vector<Var*>&vars);
791 
792  // Handle grid_mapping attributes
793  std::string Check_Grid_Mapping_VarName(const std::string& attr_value,const std::string& var_full_path);
794  std::string Check_Grid_Mapping_FullPath(const std::string& attr_value);
795 
796 protected:
797  File(const char *h5_path, hid_t file_id) :
798  path(std::string(h5_path)), fileid(file_id), rootid(-1), unsupported_var_dtype(false), unsupported_attr_dtype(false), unsupported_var_dspace(
799  false), unsupported_attr_dspace(false), unsupported_var_attr_dspace(false), addeddimindex(0), check_ignored(
800  false), have_ignored(false), have_udim(false),_is_dap4(false)
801  {
802  }
803 
804  // TODO: Will see if having time to make the following memembers private. See ESDIS-560
805  std::string path;
806  hid_t fileid;
807  hid_t rootid;
808 
810  std::vector<Var *> vars;
811 
813  std::vector<Attribute *> root_attrs;
814 
816  std::vector<Group*> groups;
817 
818  bool unsupported_var_dtype;
819  bool unsupported_attr_dtype;
820 
821  bool unsupported_var_dspace;
822  bool unsupported_attr_dspace;
823  bool unsupported_var_attr_dspace;
824 
825  std::set<std::string> dimnamelist;
826  //"set<string>unlimited_dimnamelist "
827  std::map<std::string, hsize_t> dimname_to_dimsize;
828 
829  // Unlimited dim. info
830  std::map<std::string, bool> dimname_to_unlimited;
831 
833  std::map<hsize_t, std::string> dimsize_to_fakedimname;
834  int addeddimindex;
835 
836  bool check_ignored;
837  bool have_ignored;
838  bool have_udim;
839  bool _is_dap4;
840  std::string ignored_msg;
841 
842 };
843 
845 class GMFile: public File {
846 public:
847  GMFile(const char*path, hid_t file_id, H5GCFProduct product, GMPattern gproduct_pattern);
848  virtual ~GMFile();
849 
850  H5GCFProduct getProductType() const
851  {
852  return product_type;
853  }
854 
855  const std::vector<GMCVar *>&getCVars() const
856  {
857  return this->cvars;
858  }
859 
860  const std::vector<GMSPVar *>&getSPVars() const
861  {
862  return this->spvars;
863  }
864 
866  virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr);
867 
869  virtual void Retrieve_H5_Supported_Attr_Values();
870 
872 
874  void Adjust_H5_Attr_Value(Attribute *attr) ;
875 
877  virtual void Handle_Unsupported_Dtype(bool) ;
878 
880  virtual void Handle_Unsupported_Dspace(bool) ;
881 
883  virtual void Handle_Unsupported_Others(bool) ;
884 
887 
889  void Add_Dim_Name() ;
890 
892  virtual void Handle_CVar() ;
893 
895  virtual void Handle_SpVar() ;
896 
898  virtual void Handle_SpVar_Attr() ;
899 
902  virtual void Handle_SpVar_DMR() { };
903 
905  virtual void Adjust_Obj_Name() ;
906 
908  virtual void Flatten_Obj_Name(bool include_attr) ;
909 
911  void Handle_Obj_NameClashing(bool) ;
912 
914  virtual void Adjust_Dim_Name() ;
915 
916  virtual void Handle_DimNameClashing() ;
917 
919  virtual void Add_Supplement_Attrs(bool) ;
920 
922  virtual bool Have_Grid_Mapping_Attrs();
923 
925  virtual void Handle_Grid_Mapping_Vars();
926 
927  //
928  bool Is_Hybrid_EOS5();
929  void Handle_Hybrid_EOS5();
930 
932  virtual void Handle_Coor_Attr();
933 
936 
939 
941  void Update_Product_Type() ;
942 
944  void Add_Path_Coord_Attr();
945 
947  virtual bool Get_IgnoredInfo_Flag()
948  {
949  return check_ignored;
950  }
951 
953  virtual const std::string& Get_Ignored_Msg()
954  {
955  return ignored_msg;
956  }
957 
958 protected:
959  bool Check_And_Update_New_GPM_L3();
960  void Remove_OMPSNPP_InputPointers();
961  void Add_Dim_Name_GPM() ;
962  void Add_Dim_Name_Mea_SeaWiFS() ;
963  void Handle_UseDimscale_Var_Dim_Names_Mea_SeaWiFS_Ozone(Var*) ;
964  void Add_UseDimscale_Var_Dim_Names_Mea_SeaWiFS_Ozone(Var *, Attribute*) ;
965 
966  void Add_Dim_Name_Mea_Ozonel3z() ;
967  bool check_cv(const std::string & varname) const;
968 
969  void Add_Dim_Name_Aqu_L3() ;
970  void Add_Dim_Name_OBPG_L3() ;
971  void Add_Dim_Name_OSMAPL2S() ;
972  void Add_Dim_Name_ACOS_L2S_OCO2_L1B() ;
973 
974  void Add_Dim_Name_General_Product() ;
975  void Check_General_Product_Pattern() ;
976  bool Check_Dimscale_General_Product_Pattern() ;
977  bool Check_LatLon2D_General_Product_Pattern() ;
978  bool Check_LatLon2D_General_Product_Pattern_Name_Size(const std::string& latname, const std::string& lonname)
979  ;
980  bool Check_LatLon1D_General_Product_Pattern() ;
981  bool Check_LatLon1D_General_Product_Pattern_Name_Size(const std::string& latname, const std::string& lonname)
982  ;
983 
984  bool Check_LatLon_With_Coordinate_Attr_General_Product_Pattern() ;
985  void Build_lat1D_latlon_candidate(Var*, const std::vector<Var*>&);
986  void Build_latg1D_latlon_candidate(Var*, const std::vector<Var*>&);
987  void Build_unique_latlon_candidate();
988  void Add_Dim_Name_LatLon1D_Or_CoordAttr_General_Product() ;
989  void Add_Dim_Name_LatLon2D_General_Product() ;
990  void Add_Dim_Name_Dimscale_General_Product() ;
991  void Handle_UseDimscale_Var_Dim_Names_General_Product(Var*) ;
992  void Add_UseDimscale_Var_Dim_Names_General_Product(Var*, Attribute*) ;
993 
994  // Check if we have 2-D lat/lon CVs, and if yes, add those to the CV list.
995  void Update_M2DLatLon_Dimscale_CVs() ;
996  bool Check_1DGeolocation_Dimscale() ;
997  void Obtain_1DLatLon_CVs(std::vector<GMCVar*> &cvar_1dlat, std::vector<GMCVar*> &cvar_1dlon);
998  void Obtain_2DLatLon_Vars(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
999  std::map<std::string, int>&latlon2d_path_to_index);
1000  void Obtain_2DLLVars_With_Dims_not_1DLLCVars(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
1001  std::vector<GMCVar*> &cvar_1dlat, std::vector<GMCVar*> &cvar_1dlon, std::map<std::string, int>&latlon2d_path_to_index);
1002  void Obtain_2DLLCVar_Candidate(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
1003  std::map<std::string, int>&latlon2d_path_to_index) ;
1004  void Obtain_unique_2dCV(std::vector<Var*>&, std::map<std::string, int>&);
1005  void Remove_2DLLCVar_Final_Candidate_from_Vars(std::vector<int>&) ;
1006 
1007  void Handle_CVar_GPM_L1() ;
1008  void Handle_CVar_GPM_L3() ;
1009  void Handle_CVar_Mea_SeaWiFS() ;
1010  void Handle_CVar_Aqu_L3() ;
1011  void Handle_CVar_OBPG_L3() ;
1012  void Handle_CVar_OSMAPL2S() ;
1013  void Handle_CVar_Mea_Ozone() ;
1014  void Handle_SpVar_ACOS_OCO2() ;
1015  void Handle_CVar_Dimscale_General_Product() ;
1016  void Handle_CVar_LatLon2D_General_Product() ;
1017  void Handle_CVar_LatLon1D_General_Product() ;
1018  void Handle_CVar_LatLon_General_Product() ;
1019 
1020  void Adjust_Mea_Ozone_Obj_Name() ;
1021  void Adjust_GPM_L3_Obj_Name() ;
1022 
1023  void Handle_GMCVar_NameClashing(std::set<std::string> &) ;
1024  void Handle_GMCVar_AttrNameClashing() ;
1025  void Handle_GMSPVar_NameClashing(std::set<std::string> &) ;
1026  void Handle_GMSPVar_AttrNameClashing() ;
1027  template<typename T> void GMHandle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec)
1028  ;
1029 
1030  virtual std::string get_CF_string(std::string s);
1031 
1032  // The following routines are for generating coordinates attributes for netCDF-4 like 2D-latlon cases.
1033  bool Check_Var_2D_CVars(Var*) ;
1034  bool Flatten_VarPath_In_Coordinates_Attr(Var*) ;
1035  //bool Flatten_VarPath_In_Coordinates_Attr_EOS5(Var*) ;
1036  void Handle_LatLon_With_CoordinateAttr_Coor_Attr() ;
1037  bool Coord_Match_LatLon_NameSize(const std::string & coord_values) ;
1038  bool Coord_Match_LatLon_NameSize_Same_Group(const std::string & coord_values, const std::string &var_path) ;
1039  void Add_VarPath_In_Coordinates_Attr(Var*, const std::string &);
1040 
1041  // The following three routines handle the GPM CF-related attributes
1042  void Handle_GPM_l1_Coor_Attr() ;
1043  void Correct_GPM_L1_LatLon_units(Var *var, const std::string unit_value) ;
1044  void Add_GPM_Attrs() ;
1045 
1046  void Add_Aqu_Attrs() ;
1047  void Add_SeaWiFS_Attrs() ;
1048  void Create_Missing_CV(GMCVar*, const std::string &) ;
1049 
1050  bool Is_netCDF_Dimension(Var *var) ;
1051 
1052  virtual void Gen_Unsupported_Dtype_Info(bool);
1053  virtual void Gen_VarAttr_Unsupported_Dtype_Info() ;
1054  void Gen_GM_VarAttr_Unsupported_Dtype_Info();
1055  virtual void Gen_Unsupported_Dspace_Info() ;
1056  void Handle_GM_Unsupported_Dtype(bool) ;
1057  void Handle_GM_Unsupported_Dspace(bool) ;
1058 
1059  bool Remove_EOS5_Strings(std::string &);
1060  bool Remove_EOS5_Strings_NonEOS_Fields (std::string &);
1061  void release_standalone_GMCVar_vector(std::vector<GMCVar*> &tempgc_vars);
1062 
1063 private:
1064  H5GCFProduct product_type;
1065  GMPattern gproduct_pattern;
1066  std::vector<GMCVar *> cvars;
1067  std::vector<GMSPVar *> spvars;
1068  std::string gp_latname;
1069  std::string gp_lonname;
1070  std::set<std::string> grp_cv_paths;
1071  std::vector<struct Name_Size_2Pairs> latloncv_candidate_pairs;
1072  //"map<string,string>dimcvars_2dlatlon"
1073  bool iscoard;
1074 #if 0
1075  bool ll2d_no_cv;
1076 #endif
1077  bool have_nc4_non_coord;
1078 
1079 };
1080 
1082 class EOS5CFGrid {
1083 public:
1084  EOS5CFGrid() :
1085  point_lower(0.0), point_upper(0.0), point_left(0.0), point_right(0.0),
1086  eos5_pixelreg(HE5_HDFE_CENTER), // may change later
1087  eos5_origin(HE5_HDFE_GD_UL), // may change later
1088  eos5_projcode(HE5_GCTP_GEO), //may change later
1089  zone(-1), sphere(0),
1090  addeddimindex(0),
1091  xdimsize(0), ydimsize(0),
1092  has_nolatlon(true), has_1dlatlon(false), has_2dlatlon(false), has_g2dlatlon(false)
1093  {
1094  std::fill_n(param, 13, 0);
1095  }
1096 
1097  ~EOS5CFGrid()
1098  {
1099  }
1100 
1101 protected:
1102  void Update_Dimnamelist();
1103 
1104 private:
1105  float point_lower;
1106  float point_upper;
1107  float point_left;
1108  float point_right;
1109  EOS5GridPRType eos5_pixelreg;
1110  EOS5GridOriginType eos5_origin;
1111  EOS5GridPCType eos5_projcode;
1112 
1113  double param[13];
1114  int zone;
1115  int sphere;
1116 
1117  std::vector<std::string> dimnames;
1118  std::set<std::string> vardimnames;
1119  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1120 
1121  // Unlimited dim. info
1122  std::map<std::string, bool> dimnames_to_unlimited;
1123 
1124  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1125  int addeddimindex;
1126 
1127  std::map<std::string, std::string> dnames_to_1dvnames;
1128  std::string name;
1129  int xdimsize;
1130  int ydimsize;
1131  bool has_nolatlon;
1132  bool has_1dlatlon;
1133  bool has_2dlatlon;
1134  bool has_g2dlatlon;
1135 
1136  friend class EOS5File;
1137 };
1138 
1141 public:
1142  EOS5CFSwath() :
1143  addeddimindex(0), has_nolatlon(true), has_1dlatlon(false), has_2dlatlon(false), has_g2dlatlon(false)
1144  {
1145  }
1146 
1147  ~EOS5CFSwath()
1148  {
1149  }
1150 
1151 private:
1152 
1153  std::vector<std::string> dimnames;
1154  std::set<std::string> vardimnames;
1155  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1156 
1157  // Unlimited dim. info
1158  std::map<std::string, bool> dimnames_to_unlimited;
1159 
1160  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1161  int addeddimindex;
1162 
1163  std::map<std::string, std::string> dnames_to_geo1dvnames;
1164  std::string name;
1165  bool has_nolatlon;
1166  bool has_1dlatlon;
1167  bool has_2dlatlon;
1168  bool has_g2dlatlon;
1169 
1170  friend class EOS5File;
1171 };
1172 
1174 class EOS5CFZa {
1175 public:
1176  EOS5CFZa() :
1177  addeddimindex(0)
1178  {
1179  }
1180 
1181  ~EOS5CFZa()
1182  {
1183  }
1184 
1185 private:
1186 
1187  std::vector<std::string> dimnames;
1188  std::set<std::string> vardimnames;
1189  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1190  // Unlimited dim. info
1191  std::map<std::string, bool> dimnames_to_unlimited;
1192 
1193  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1194  int addeddimindex;
1195 
1196  std::map<std::string, std::string> dnames_to_1dvnames;
1197  std::string name;
1198 
1199  friend class EOS5File;
1200 };
1201 
1203 class EOS5File: public File {
1204 public:
1205  EOS5File(const char*he5_path, hid_t file_id) :
1206  File(he5_path, file_id), iscoard(false), grids_multi_latloncvs(false), isaura(false), aura_name(NOTAURA),
1207  orig_num_grids(0)
1208  {
1209  }
1210 
1211  virtual ~EOS5File();
1212 public:
1213 
1215  const std::vector<EOS5CVar *>&getCVars() const
1216  {
1217  return this->cvars;
1218  }
1219 
1221  virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr);
1222 
1224  virtual void Retrieve_H5_Supported_Attr_Values() ;
1225 
1228 
1230  virtual void Handle_Unsupported_Dtype(bool) ;
1231 
1233  virtual void Handle_Unsupported_Dspace(bool);
1234 
1236  virtual void Handle_Unsupported_Others(bool) ;
1237 
1239  virtual void Adjust_EOS5Dim_Info(HE5Parser*strmeta_info) ;
1240 
1242  void Add_EOS5File_Info(HE5Parser*, bool) ;
1243 
1246 
1248  virtual void Adjust_Obj_Name() ;
1249 
1251  void Add_Dim_Name(HE5Parser *) ;
1252 
1254  void Check_Aura_Product_Status() ;
1255 
1257  virtual void Handle_CVar() ;
1258 
1260  virtual void Handle_SpVar() ;
1261 
1263  virtual void Handle_SpVar_Attr() ;
1264 
1266  virtual void Handle_SpVar_DMR() ;
1267 
1270 
1272  virtual void Flatten_Obj_Name(bool include_attr) ;
1273 
1275  void Set_COARDS_Status() ;
1276 
1278  void Adjust_Attr_Info() ;
1279 
1281  void Handle_Obj_NameClashing(bool) ;
1282 
1284  virtual void Add_Supplement_Attrs(bool) ;
1285 
1287  virtual void Handle_Coor_Attr();
1288 
1290  virtual void Adjust_Dim_Name() ;
1291 
1292  virtual void Handle_DimNameClashing() ;
1293 
1295  virtual bool Have_Grid_Mapping_Attrs();
1296 
1298  virtual void Handle_Grid_Mapping_Vars();
1299 
1300 
1301  bool Have_EOS5_Grids() {
1302  return (this->eos5cfgrids.size()!=0);
1303  }
1304  virtual bool Get_IgnoredInfo_Flag()
1305  {
1306  return check_ignored;
1307  }
1308 
1309  virtual const std::string& Get_Ignored_Msg()
1310  {
1311  return ignored_msg;
1312  }
1313 
1314 protected:
1315  void Adjust_H5_Attr_Value(Attribute *attr) ;
1316 
1317  void Adjust_EOS5Dim_List(std::vector<HE5Dim>&) ;
1318  void Condense_EOS5Dim_List(std::vector<HE5Dim>&) ;
1319  void Remove_NegativeSizeDims(std::vector<HE5Dim>&) ;
1320  void Adjust_EOS5DimSize_List(std::vector<HE5Dim>&,const std::vector<HE5Var>&, const EOS5Type,const std::string & eos5objname);
1321  void Adjust_EOS5VarDim_Info(std::vector<HE5Dim>&, std::vector<HE5Dim>&, const std::string &, EOS5Type) ;
1322 
1323  void EOS5Handle_nonlatlon_dimcvars(std::vector<HE5Var> & eos5varlist, EOS5Type, std::string groupname,
1324  std::map<std::string, std::string>& dnamesgeo1dvnames) ;
1325  template<class T> void EOS5SwathGrid_Set_LatLon_Flags(T* eos5gridswath, std::vector<HE5Var>& eos5varlist)
1326  ;
1327 
1328  void Obtain_Var_NewName(Var*) ;
1329  EOS5Type Get_Var_EOS5_Type(Var*) ;
1330 
1331  bool Obtain_Var_Dims(Var*, HE5Parser*) ;
1332  template<class T> bool Set_Var_Dims(T*, Var*, std::vector<HE5Var>&, const std::string&, int, EOS5Type) ;
1333  template<class T> void Create_Unique_DimName(T*, std::set<std::string>&, Dimension *, int, EOS5Type) ;
1334 
1335  template<class T> bool Check_All_DimNames(T*, std::string &, hsize_t);
1336  std::string Obtain_Var_EOS5Type_GroupName(Var*, EOS5Type) ;
1337  int Check_EOS5Swath_FieldType(Var*) ;
1338  void Get_Unique_Name(std::set<std::string>&, std::string&) ;
1339 
1340  template<class T> std::string Create_Unique_FakeDimName(T*, EOS5Type) ;
1341  template<class T> void Set_NonParse_Var_Dims(T*, Var*, std::map<hsize_t, std::string>&, int, EOS5Type) ;
1342 
1343  void Handle_Grid_CVar(bool) ;
1344  void Handle_Augmented_Grid_CVar() ;
1345  template<class T> void Handle_Single_Augment_CVar(T*, EOS5Type) ;
1346 
1347  void Handle_Multi_Nonaugment_Grid_CVar() ;
1348  void Handle_Single_Nonaugment_Grid_CVar(EOS5CFGrid*) ;
1349  bool Handle_Single_Nonaugment_Grid_CVar_OwnLatLon(EOS5CFGrid *, std::set<std::string>&) ;
1350  bool Handle_Single_Nonaugment_Grid_CVar_EOS5LatLon(EOS5CFGrid *, std::set<std::string>&) ;
1351  void Handle_NonLatLon_Grid_CVar(EOS5CFGrid *, std::set<std::string>&) ;
1352  void Remove_MultiDim_LatLon_EOS5CFGrid() ;
1353  void Adjust_EOS5GridDimNames(EOS5CFGrid *) ;
1354 
1355  void Handle_Swath_CVar(bool) ;
1356  void Handle_Single_1DLatLon_Swath_CVar(EOS5CFSwath *cfswath, bool is_augmented) ;
1357  void Handle_Single_2DLatLon_Swath_CVar(EOS5CFSwath *cfswath, bool is_augmented) ;
1358  void Handle_NonLatLon_Swath_CVar(EOS5CFSwath *cfswath, std::set<std::string>& tempvardimnamelist) ;
1359  void Handle_Special_NonLatLon_Swath_CVar(EOS5CFSwath *cfswath, std::set<std::string>&tempvardimnamelist) ;
1360 
1361  void Handle_Za_CVar(bool) ;
1362 
1363  bool Check_Augmentation_Status() ;
1364  // Don't remove the following commented if 0 line!
1365 #if 0
1366  //bool Check_Augmented_Var_Attrs(Var *var) throw(Exception);
1367 #endif
1368  template<class T> bool Check_Augmented_Var_Candidate(T*, Var*, EOS5Type) ;
1369 
1370  template<class T> void Adjust_Per_Var_Dim_NewName_Before_Flattening(T*, bool, int, int, int) ;
1371  void Adjust_SharedLatLon_Grid_Var_Dim_Name() ;
1372 
1373  void Adjust_Aura_Attr_Name() ;
1374  void Adjust_Aura_Attr_Value() ;
1375  void Handle_EOS5CVar_Unit_Attr() ;
1376  void Add_EOS5_Grid_CF_Attr() ;
1377  void Handle_Aura_Special_Attr() ;
1378 
1379  virtual std::string get_CF_string(std::string s);
1380  void Replace_Var_Info(EOS5CVar *src, EOS5CVar *target);
1381  void Replace_Var_Attrs(EOS5CVar *src, EOS5CVar *target);
1382  void Handle_EOS5CVar_NameClashing(std::set<std::string> &) ;
1383  void Handle_EOS5CVar_AttrNameClashing() ;
1384  template<typename T> void EOS5Handle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec)
1385  ;
1386  template<typename T> void Create_Missing_CV(T*, EOS5CVar*, const std::string &, EOS5Type, int) ;
1387  void Create_Added_Var_NewName_FullPath(EOS5Type, const std::string&, const std::string&, std::string &, std::string &) ;
1388 
1389  void Handle_EOS5_Unsupported_Dtype(bool) ;
1390  void Handle_EOS5_Unsupported_Dspace(bool) ;
1391 
1392  virtual void Gen_Unsupported_Dtype_Info(bool);
1393  virtual void Gen_VarAttr_Unsupported_Dtype_Info() ;
1394  void Gen_EOS5_VarAttr_Unsupported_Dtype_Info() ;
1395 
1396  virtual void Gen_Unsupported_Dspace_Info() ;
1397 
1398 private:
1399  std::vector<EOS5CVar *> cvars;
1400  std::vector<EOS5CFGrid *> eos5cfgrids;
1401  std::vector<EOS5CFSwath *> eos5cfswaths;
1402  std::vector<EOS5CFZa *> eos5cfzas;
1403  std::map<std::string, std::string> eos5_to_cf_attr_map;
1404  bool iscoard;
1405  bool grids_multi_latloncvs;
1406  bool isaura;
1407  EOS5AuraName aura_name;
1408  int orig_num_grids;
1409  std::multimap<std::string, std::string> dimname_to_dupdimnamelist;
1410 };
1411 
1412 }
1413 #endif
This file includes several helper functions for translating HDF5 to CF-compliant.
This file includes functions to identify different NASA HDF5 products. Current supported products inc...
A class for parsing NASA HDF-EOS5 StructMetadata.
This class represents one attribute.
Definition: HDF5CF.h:189
This class is a derived class of Var. It represents a coordinate variable.
Definition: HDF5CF.h:362
CVType getCVType() const
Get the coordinate variable type of this variable.
Definition: HDF5CF.h:372
This class repersents one dimension of an HDF5 dataset(variable).
Definition: HDF5CF.h:145
bool HaveUnlimitedDim() const
Has unlimited dimensions.
Definition: HDF5CF.h:161
This class simulates an HDF-EOS5 Grid. Currently only geographic projection is supported.
Definition: HDF5CF.h:1082
This class simulates an HDF-EOS5 Swath.
Definition: HDF5CF.h:1140
This class simulates an HDF-EOS5 Zonal average object.
Definition: HDF5CF.h:1174
This class is a derived class of CVar. It represents a coordinate variable for HDF-EOS5 files.
Definition: HDF5CF.h:450
This class is a derived class of File. It includes methods applied to HDF-EOS5 files only.
Definition: HDF5CF.h:1203
virtual const std::string & Get_Ignored_Msg()
Obtain the message that contains the ignored object info.
Definition: HDF5CF.h:1309
void Add_EOS5File_Info(HE5Parser *, bool)
Add HDF-EOS5 dimension and coordinate variable related info. to EOS5Grid,EOS5Swath etc.
Definition: HDFEOS5CF.cc:841
virtual void Handle_Grid_Mapping_Vars()
Handle Grid Mapping Vars.
Definition: HDFEOS5CF.cc:4198
void Set_COARDS_Status()
Set COARDS flag.
Definition: HDFEOS5CF.cc:3384
virtual void Handle_Unsupported_Dtype(bool)
Handle unsupported HDF5 datatypes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:207
void Adjust_Var_Dim_NewName_Before_Flattening()
Adjust variable dimension names before the flattening for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3034
void Adjust_Attr_Info()
Adjust the attribute info for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3407
virtual void Handle_SpVar_DMR()
Handle special variables and attributes for HDF-EOS5 files(for DMR)
Definition: HDFEOS5CF.cc:4134
void Handle_Obj_NameClashing(bool)
Handle the object name clashing for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3234
virtual void Retrieve_H5_CVar_Supported_Attr_Values()
Retrieve coordinate variable attributes.
Definition: HDFEOS5CF.cc:168
virtual bool Have_Grid_Mapping_Attrs()
Check if having Grid Mapping Attrs.
Definition: HDFEOS5CF.cc:4195
virtual void Adjust_Obj_Name()
This method is a no-op operation. Leave here since the method in the base class is pure virtual.
Definition: HDFEOS5CF.cc:4190
virtual void Handle_SpVar()
Handle special variables for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3975
virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr)
Retrieve DDS information from the HDF5 file; a real implementation for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:161
const std::vector< EOS5CVar * > & getCVars() const
Obtain coordinate variables for HDF-EOS5 products.
Definition: HDF5CF.h:1215
virtual void Handle_DimNameClashing()
Definition: HDFEOS5CF.cc:3319
virtual void Handle_CVar()
Handle coordinate variable for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1768
virtual void Handle_SpVar_Attr()
Handle special variables for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:4096
virtual void Retrieve_H5_Supported_Attr_Values()
Retrieve attribute values for the supported HDF5 datatypes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:184
virtual void Handle_Coor_Attr()
Handle the coordinates attribute for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3761
void Adjust_Var_NewName_After_Parsing()
Adjust variable names for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1228
virtual void Add_Supplement_Attrs(bool)
Add the supplemental attributes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3670
void Add_Dim_Name(HE5Parser *)
Add the dimension name for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1320
virtual void Handle_Unsupported_Others(bool)
Handle other unmapped objects/attributes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:360
virtual void Flatten_Obj_Name(bool include_attr)
Flatten the object name for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3212
virtual void Adjust_Dim_Name()
Adjust the dimension name for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3640
virtual void Handle_Unsupported_Dspace(bool)
Handle unsupported HDF5 dataspaces for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:301
void Check_Aura_Product_Status()
Check if the HDF-EOS5 file is an Aura file. Special CF operations need to be used.
Definition: HDFEOS5CF.cc:1716
virtual bool Get_IgnoredInfo_Flag()
Obtain the flag to see if ignored objects should be generated.
Definition: HDF5CF.h:1304
virtual void Adjust_EOS5Dim_Info(HE5Parser *strmeta_info)
Adjust HDF-EOS5 dimension information.
Definition: HDFEOS5CF.cc:539
Exception(const std::string &msg)
Constructor.
Definition: HDF5CF.h:73
This class retrieves all information from an HDF5 file.
Definition: HDF5CF.h:593
bool HaveUnlimitedDim() const
Has unlimited dimensions.
Definition: HDF5CF.h:691
std::vector< Group * > groups
Non-root group vectors.
Definition: HDF5CF.h:816
virtual void Retrieve_H5_Var_Attr_Values(Var *var)
Retrieve attribute values for a variable.
Definition: HDF5CF.cc:748
virtual void Handle_Unsupported_Dspace(bool)
Handle unsupported HDF5 dataspaces for datasets.
Definition: HDF5CF.cc:1275
const std::string & getPath() const
Obtain the path of the file.
Definition: HDF5CF.h:667
std::map< hsize_t, std::string > dimsize_to_fakedimname
Handle added dimension names.
Definition: HDF5CF.h:833
virtual void Handle_Grid_Mapping_Vars()
Handle Grid Mapping Vars.
Definition: HDF5CF.cc:2151
virtual const std::string & Get_Ignored_Msg()=0
Obtain the message that contains the ignored object info.
virtual bool Get_IgnoredInfo_Flag()=0
Obtain the flag to see if ignored objects should be generated.
hid_t getFileID() const
Obtain the HDF5 file ID.
Definition: HDF5CF.h:661
virtual void Handle_Unsupported_Others(bool)
Handle other unmapped objects/attributes.
Definition: HDF5CF.cc:1322
virtual void Retrieve_H5_Supported_Attr_Values()
Retrieve attribute values for the supported HDF5 datatypes.
Definition: HDF5CF.cc:729
std::vector< Var * > vars
Var vectors.
Definition: HDF5CF.h:810
const std::vector< Attribute * > & getAttributes() const
Public interface to obtain information of all attributes under the root group.
Definition: HDF5CF.h:679
const std::vector< Var * > & getVars() const
Public interface to obtain information of all variables.
Definition: HDF5CF.h:673
virtual void Add_Supplement_Attrs(bool)
Add supplemental attributes such as fullpath and original name.
Definition: HDF5CF.cc:1970
virtual void Handle_Coor_Attr()=0
Handle "coordinates" attributes.
virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool)
Definition: HDF5CF.cc:171
std::vector< Attribute * > root_attrs
Root attribute vectors.
Definition: HDF5CF.h:813
virtual void Handle_SpVar_Attr()=0
Handle special variable attributes.
virtual void Handle_CVar()=0
Handle coordinate variables.
virtual void Adjust_Dim_Name()=0
Adjust dimension names based on different products.
virtual void Adjust_Obj_Name()=0
Adjust object names based on different products.
virtual void Handle_SpVar_DMR()=0
Handle Special variable and attributes for DMR.
virtual void Handle_Unsupported_Dtype(bool)
Handle unsupported HDF5 datatypes.
Definition: HDF5CF.cc:918
const std::vector< Group * > & getGroups() const
Public interface to obtain all the group info.
Definition: HDF5CF.h:685
virtual void Flatten_Obj_Name(bool)
Flatten the object name.
Definition: HDF5CF.cc:1372
virtual void Handle_DimNameClashing()=0
virtual void Retrieve_H5_CVar_Supported_Attr_Values()=0
Retrieve coordinate variable attributes.
virtual void Handle_SpVar()=0
Handle special variables.
virtual bool Have_Grid_Mapping_Attrs()
Check if having Grid Mapping Attrs.
Definition: HDF5CF.cc:2131
This class is a derived class of CVar. It represents a coordinate variable for general HDF5 files.
Definition: HDF5CF.h:427
H5GCFProduct getPtType() const
Get the data type of this variable.
Definition: HDF5CF.h:439
This class is a derived class of File. It includes methods applied to general HDF5 files only.
Definition: HDF5CF.h:845
virtual void Handle_Unsupported_Dtype(bool)
Handle unsupported HDF5 datatypes for general HDF5 products.
Definition: HDF5GMCF.cc:400
virtual void Adjust_Obj_Name()
Adjust object names based on different general NASA HDF5 products.
Definition: HDF5GMCF.cc:4912
virtual void Retrieve_H5_CVar_Supported_Attr_Values()
Retrieve coordinate variable attributes.
Definition: HDF5GMCF.cc:333
void Add_Path_Coord_Attr()
Update the coordinate attribute to include path and also flatten.
Definition: HDF5GMCF.cc:7026
virtual bool Have_Grid_Mapping_Attrs()
Check if having Grid Mapping Attrs.
Definition: HDF5GMCF.cc:6950
virtual void Adjust_Dim_Name()
Adjust dimension name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:5225
void Handle_Obj_NameClashing(bool)
Handle object name clashing for general NASA HDF5 products.
Definition: HDF5GMCF.cc:5055
virtual void Handle_SpVar_DMR()
Definition: HDF5CF.h:902
void Remove_Unused_FakeDimVars()
Unsupported datatype array may generate FakeDim. Remove them.
Definition: HDF5GMCF.cc:6958
void Update_Product_Type()
Update "product type" attributes for general HDF5 products.
Definition: HDF5GMCF.cc:238
virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr)
Retrieve DDS information from the HDF5 file; real implementation for general HDF5 products.
Definition: HDF5GMCF.cc:219
virtual void Handle_SpVar()
Handle special variables for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4822
virtual bool Get_IgnoredInfo_Flag()
Obtain ignored info. flag.
Definition: HDF5CF.h:947
void Adjust_H5_Attr_Value(Attribute *attr)
Adjust attribute values for general HDF5 products.
Definition: HDF5GMCF.cc:382
virtual void Handle_Unsupported_Dspace(bool)
Handle unsupported HDF5 dataspaces for general HDF5 products.
Definition: HDF5GMCF.cc:597
virtual void Handle_SpVar_Attr()
Handle special variable attributes for general NASA HDF5 products.
Definition: HDF5GMCF.cc:6654
virtual void Handle_Unsupported_Others(bool)
Handle other unmapped objects/attributes for general HDF5 products.
Definition: HDF5GMCF.cc:694
virtual const std::string & Get_Ignored_Msg()
Get the message that contains the ignored obj. info.
Definition: HDF5CF.h:953
void Remove_Unneeded_Objects()
Remove unneeded objects.
Definition: HDF5GMCF.cc:261
void Add_Dim_Name()
Add dimension name.
Definition: HDF5GMCF.cc:833
virtual void Flatten_Obj_Name(bool include_attr)
Flatten the object name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4997
virtual void Handle_Grid_Mapping_Vars()
Handle Grid Mapping Vars.
Definition: HDF5GMCF.cc:6954
virtual void Handle_DimNameClashing()
Definition: HDF5GMCF.cc:5160
virtual void Handle_Coor_Attr()
Handle "coordinates" attributes for general HDF5 products.
Definition: HDF5GMCF.cc:6016
void Rename_NC4_NonCoordVars()
Remove the _nc4_non_coord from the variable new names.
Definition: HDF5GMCF.cc:7006
virtual void Retrieve_H5_Supported_Attr_Values()
Retrieve attribute values for the supported HDF5 datatypes for general HDF5 products.
Definition: HDF5GMCF.cc:348
virtual void Add_Supplement_Attrs(bool)
Add supplemental attributes such as fullpath and original name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:5287
virtual void Handle_CVar()
Handle coordinate variables for general NASA HDF5 products.
Definition: HDF5GMCF.cc:2939
This class is a derived class of Var. It represents a special general HDF5 product(currently ACOS and...
Definition: HDF5CF.h:392
This class represents an HDF5 group. The group will be flattened according to the CF conventions.
Definition: HDF5CF.h:552
const std::string & getPath() const
Get the original path of this group.
Definition: HDF5CF.h:562
const std::string & getNewName() const
Get the new name of this group(flattened,name clashed checked)
Definition: HDF5CF.h:568
This class represents one HDF5 dataset(CF variable)
Definition: HDF5CF.h:259
int getRank() const
Get the dimension rank of this variable.
Definition: HDF5CF.h:305
const std::string & getFullPath() const
Get the full path of this variable.
Definition: HDF5CF.h:283
const std::string & getName() const
Get the original name of this variable.
Definition: HDF5CF.h:271
H5DataType getType() const
Get the data type of this variable(Not HDF5 datatype id)
Definition: HDF5CF.h:311
const std::vector< Dimension * > & getDimensions() const
Get the list of the dimensions.
Definition: HDF5CF.h:322
int getCompRatio() const
Get the compression ratio of this dataset.
Definition: HDF5CF.h:328
const std::string & getNewName() const
Get the new name of this variable.
Definition: HDF5CF.h:277