bes  Updated for version 3.20.13
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)
169  {
170  }
171 
172 private:
173  hsize_t size;
174  std::string name ="";
175  std::string newname = "";
176  bool unlimited_dim = false;
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() = default;
193 
194  ~Attribute() = default;
195 
196  const std::string & getName() const
197  {
198  return this->name;
199  }
200 
201  const std::string & getNewName() const
202  {
203  return this->newname;
204  }
205 
206  H5DataType getType() const
207  {
208  return this->dtype;
209  }
210 
211  hsize_t getCount() const
212  {
213  return this->count;
214  }
215 
216  size_t getBufSize() const
217  {
218  return (this->value).size();
219  }
220 
221  const std::vector<char>&getValue() const
222  {
223  return this->value;
224  }
225 
226  const std::vector<size_t>&getStrSize() const
227  {
228  return this->strsize;
229  }
230 
231  bool getCsetType() const {
232  return this->is_cset_ascii;
233  }
234 
235 private:
236  std::string name;
237  std::string newname;
238  H5DataType dtype = H5UNSUPTYPE;
239  hsize_t count = 0;
240  std::vector<size_t> strsize;
241  size_t fstrsize = 0;
242  std::vector<char> value;
243  bool is_cset_ascii = true;
244 
245  friend class File;
246  friend class GMFile;
247  friend class EOS5File;
248  friend class Var;
249  friend class CVar;
250  friend class GMCVar;
251  friend class GMSPVar;
252  friend class EOS5CVar;
253 };
254 
256 class Var {
257 public:
258  Var() = default;
259  explicit Var(Var*var);
260  virtual ~Var();
261 
262 
264  const std::string & getName() const
265  {
266  return this->name;
267  }
268 
270  const std::string & getNewName() const
271  {
272  return this->newname;
273  }
274 
276  const std::string & getFullPath() const
277  {
278  return this->fullpath;
279  }
280 
281  size_t getTotalElems() const
282  {
283  return this->total_elems;
284 
285  }
286 
287  bool getZeroStorageSize() const
288  {
289  return this->zero_storage_size;
290  }
291 
292  bool getCoorAttrAddPath() const
293  {
294  return this->coord_attr_add_path;
295  }
296 
298  int getRank() const
299  {
300  return this->rank;
301  }
302 
304  H5DataType getType() const
305  {
306  return this->dtype;
307  }
308 
309  const std::vector<Attribute *>&getAttributes() const
310  {
311  return this->attrs;
312  }
313 
315  const std::vector<Dimension *>&getDimensions() const
316  {
317  return this->dims;
318  }
319 
321  float getCompRatio() const
322  {
323  return this->comp_ratio;
324  }
325 
326 private:
327 
328  std::string newname;
329  std::string name;
330  std::string fullpath;
331  H5DataType dtype = H5UNSUPTYPE;
332  int rank = -1;
333  float comp_ratio = 1.0;
334  size_t total_elems = 0;
335  bool zero_storage_size = false;
336  bool unsupported_attr_dtype = false;
337  bool unsupported_attr_dspace = false;
338  bool unsupported_dspace = false;
339  bool dimnameflag = false;
340  bool coord_attr_add_path = true;
341 
342  std::vector<Attribute *> attrs;
343  std::vector<Dimension *> dims;
344 
345  friend class CVar;
346  friend class GMCVar;
347  friend class GMSPVar;
348  friend class EOS5CVar;
349  friend class File;
350  friend class GMFile;
351  friend class EOS5File;
352 };
353 
355 class CVar: public Var {
356 public:
357 
358  CVar() = default;
359  ~CVar() override = default;
360 
362  CVType getCVType() const
363  {
364  return this->cvartype;
365  }
366 
367  bool isLatLon() const;
368 
369 private:
370  // Each coordinate variable has and only has one dimension
371  // This assumption is based on the exact match between
372  // variables and dimensions
373  std::string cfdimname;
374  CVType cvartype = CV_UNSUPPORTED;
375 
376  friend class File;
377  friend class GMFile;
378  friend class EOS5File;
379 };
380 
382 class GMSPVar: public Var {
383 public:
384  GMSPVar() = default;
385  explicit GMSPVar(Var *var);
386  ~GMSPVar() override = default;
387 
388  H5DataType getOriginalType() const
389  {
390  return this->otype;
391  }
392 
393  int getStartBit() const
394  {
395  return this->sdbit;
396  }
397 
398  int getBitNum() const
399  {
400  return this->numofdbits;
401  }
402 
403 private:
404  H5DataType otype = H5UNSUPTYPE;
405  int sdbit = -1;
406  int numofdbits = -1;
407 
408  friend class File;
409  friend class GMFile;
410 };
411 
413 class GMCVar: public CVar {
414 public:
415  GMCVar() = default;
416  explicit GMCVar(Var*var);
417  ~GMCVar() override = default;
418 
420  H5GCFProduct getPtType() const
421  {
422  return this->product_type;
423  }
424 
425 private:
426  H5GCFProduct product_type = General_Product;
427  friend class GMFile;
428 };
429 
431 class EOS5CVar: public CVar {
432 public:
433  EOS5CVar()
434  {
435  std::fill_n(param, 13, 0);
436  }
437  ;
438  explicit EOS5CVar(Var *);
439 
440  ~EOS5CVar() override = default;
441 
442  EOS5Type getEos5Type() const
443  {
444  return this->eos_type;
445  }
446  float getPointLower() const
447  {
448  return this->point_lower;
449  }
450  float getPointUpper() const
451  {
452  return this->point_upper;
453  }
454 
455  float getPointLeft() const
456  {
457  return this->point_left;
458  }
459  float getPointRight() const
460  {
461  return this->point_right;
462  }
463 
464  EOS5GridPRType getPixelReg() const
465  {
466  return this->eos5_pixelreg;
467  }
468  EOS5GridOriginType getOrigin() const
469  {
470  return this->eos5_origin;
471  }
472 
473  EOS5GridPCType getProjCode() const
474  {
475  return this->eos5_projcode;
476  }
477 
478  int getXDimSize() const
479  {
480  return this->xdimsize;
481  }
482 
483  int getYDimSize() const
484  {
485  return this->ydimsize;
486  }
487 
488  std::vector<double> getParams() const
489  {
490  std::vector<double> ret_params;
491  for (int i = 0; i < 13; i++)
492  ret_params.push_back(param[i]);
493  return ret_params;
494  }
495 
496  int getZone() const
497  {
498  return this->zone;
499  }
500 
501  int getSphere() const
502  {
503  return this->sphere;
504  }
505 
506 private:
507  EOS5Type eos_type = OTHERVARS;
508  bool is_2dlatlon = false;
509  float point_lower = 0.0;
510  float point_upper = 0.0;
511  float point_left = 0.0;
512  float point_right = 0.0;
513  int xdimsize = 0;
514  int ydimsize = 0;
515  EOS5GridPRType eos5_pixelreg = HE5_HDFE_CENTER; // May change later
516  EOS5GridOriginType eos5_origin = HE5_HDFE_GD_UL; // May change later
517  EOS5GridPCType eos5_projcode = HE5_GCTP_GEO; // May change later
518  int zone = -1;
519  int sphere = 0;
520  double param[13];
521  friend class EOS5File;
522 };
523 
525 class Group {
526 public:
527  Group() = default;
528  ~Group();
529 
530 
532  const std::string & getPath() const
533  {
534  return this->path;
535  }
536 
538  const std::string & getNewName() const
539  {
540  return this->newname;
541  }
542 
543  const std::vector<Attribute *>&getAttributes() const
544  {
545  return this->attrs;
546  }
547 
548 private:
549 
550  std::string newname;
551  std::string path;
552 
553  std::vector<Attribute *> attrs;
554  bool unsupported_attr_dtype = false;
555  bool unsupported_attr_dspace = false;
556 
557  friend class File;
558  friend class GMFile;
559  friend class EOS5File;
560 };
561 
563 class File {
564 public:
565 
573  virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool);
574 
576  virtual void Retrieve_H5_Supported_Attr_Values();
577 
579  virtual void Retrieve_H5_Var_Attr_Values(Var *var);
580 
583 
585  virtual void Handle_Unsupported_Dtype(bool);
586 
588  virtual void Handle_Unsupported_Dspace(bool);
589 
591  virtual void Handle_Unsupported_Others(bool) ;
592 
594  virtual void Flatten_Obj_Name(bool) ;
595 
597  virtual void Add_Supplement_Attrs(bool) ;
598 
600  virtual bool Have_Grid_Mapping_Attrs();
601 
603  virtual void Handle_Grid_Mapping_Vars();
604 
606  virtual void Handle_Coor_Attr() = 0;
607 
609  virtual void Handle_CVar() = 0;
610 
612  virtual void Handle_SpVar() = 0;
613 
615  virtual void Handle_SpVar_Attr() = 0;
616 
618  virtual void Handle_SpVar_DMR() = 0;
619 
621  virtual void Adjust_Obj_Name() = 0;
622 
624  virtual void Adjust_Dim_Name() = 0;
625 
628  virtual void Handle_DimNameClashing() = 0;
629 
631  hid_t getFileID() const
632  {
633  return this->fileid;
634  }
635 
637  const std::string & getPath() const
638  {
639  return this->path;
640  }
641 
643  const std::vector<Var *>&getVars() const
644  {
645  return this->vars;
646  }
647 
649  const std::vector<Attribute *>&getAttributes() const
650  {
651  return this->root_attrs;
652  }
653 
655  const std::vector<Group *>&getGroups() const
656  {
657  return this->groups;
658  }
659 
661  bool HaveUnlimitedDim() const
662  {
663  return have_udim;
664  }
665 
666  void setDap4(bool is_dap4)
667  {
668  _is_dap4 = is_dap4;
669  }
670  bool getDap4() const
671  {
672  return _is_dap4;
673  }
674 
675  bool getIsCOARD() const
676  {
677  return iscoard;
678  }
679 
680 
681 
683  virtual bool Get_IgnoredInfo_Flag() = 0;
684 
686  virtual const std::string & Get_Ignored_Msg() = 0;
687 
688  virtual ~File();
689 
690 protected:
691 
692  void Retrieve_H5_Obj(hid_t grp_id, const char*gname, bool include_attr);
693  void Retrieve_H5_Attr_Info(Attribute *, hid_t obj_id, const int j, bool& unsup_attr_dtype, bool & unsup_attr_dspace);
694 
695  void Retrieve_H5_Attr_Value(Attribute *attr, const std::string &);
696 
697  void Retrieve_H5_VarType(Var*, hid_t dset_id, const std::string& varname, bool &unsup_var_dtype);
698  void Retrieve_H5_VarDim(Var*, hid_t dset_id, const std::string &varname, bool & unsup_var_dspace);
699 
700  float Retrieve_H5_VarCompRatio(const Var*, const hid_t) const;
701 
702  void Handle_Group_Unsupported_Dtype() ;
703  void Handle_Var_Unsupported_Dtype() ;
704  void Handle_VarAttr_Unsupported_Dtype() ;
705 
706  void Handle_GroupAttr_Unsupported_Dspace() ;
707  void Handle_VarAttr_Unsupported_Dspace() ;
708 
709  void Gen_Group_Unsupported_Dtype_Info() ;
710  void Gen_Var_Unsupported_Dtype_Info() ;
711  virtual void Gen_VarAttr_Unsupported_Dtype_Info() ;
712 
713  void Handle_GeneralObj_NameClashing(bool, std::set<std::string> &objnameset) ;
714  void Handle_Var_NameClashing(std::set<std::string> &objnameset) ;
715  void Handle_Group_NameClashing(std::set<std::string> &objnameset) ;
716  void Handle_Obj_AttrNameClashing() ;
717  template<typename T> void Handle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec) ;
718 
719  void Add_One_FakeDim_Name(Dimension *dim) ;
720  void Adjust_Duplicate_FakeDim_Name(Dimension * dim) ;
721  void Adjust_Duplicate_FakeDim_Name2(Dimension * dim,int dup_dim_size_index) ;
722  void Insert_One_NameSizeMap_Element(std::string name, hsize_t size, bool unlimited) ;
723  void Insert_One_NameSizeMap_Element2(std::map<std::string, hsize_t> &, std::map<std::string, bool>&, std::string name, hsize_t size,
724  bool unlimited) ;
725 
726  virtual std::string get_CF_string(std::string);
727  void Replace_Var_Info(Var* src, Var *target);
728  void Replace_Var_Attrs(Var *src, Var*target);
729 
730  void Add_Str_Attr(Attribute* attr, const std::string &attrname, const std::string& strvalue) ;
731  std::string Retrieve_Str_Attr_Value(Attribute *attr, const std::string& var_path);
732  bool Is_Str_Attr(Attribute* attr, const std::string & varfullpath, const std::string &attrname, const std::string& strvalue);
733  void Add_One_Float_Attr(Attribute* attr, const std::string &attrname, float float_value) ;
734  void Replace_Var_Str_Attr(Var* var, const std::string &attr_name, const std::string& strvalue);
735  void Change_Attr_One_Str_to_Others(Attribute *attr, const Var *var) ;
736 
737  // Check if having variable latitude by variable names (containing ???latitude/Latitude/lat)
738  bool Is_geolatlon(const std::string &var_name, bool is_lat);
739  bool has_latlon_cf_units(Attribute*attr, const std::string &varfullpath, bool is_lat);
740 
741  // Check if a variable with a var name is under a specific group with groupname
742  // note: the variable's size at each dimension is also returned. The user must allocate the
743  // memory for the dimension sizes(an array(vector is perferred).
744  bool is_var_under_group(const std::string &varname, const std::string &grpname, const int var_rank, std::vector<size_t> &var_size);
745 
746  // Remove netCDF internal attributes. Right now, only CLASS=DIMENSION_SCALE and NAME=Var_name and NAME=pure netCDF dimesnion are handled.
747  void remove_netCDF_internal_attributes(bool include_attr);
748 
749  virtual void Gen_Unsupported_Dtype_Info(bool) = 0;
750  virtual void Gen_Unsupported_Dspace_Info() ;
751  void Gen_DimScale_VarAttr_Unsupported_Dtype_Info() ;
752  void add_ignored_info_page_header();
753  void add_ignored_info_obj_header();
754 #if 0
755  // void add_ignored_info_obj_dtype_header();
756  //void add_ignored_info_obj_dspace_header();
757 #endif
758  void add_ignored_info_links_header();
759  void add_ignored_info_links(const std::string& link_name);
760  void add_ignored_info_namedtypes(const std::string&, const std::string&);
761  void add_ignored_info_attrs(bool is_grp, const std::string & obj_path, const std::string &attr_name);
762  void add_ignored_info_objs(bool is_dim_related, const std::string & obj_path);
763  void add_no_ignored_info();
764  bool ignored_dimscale_ref_list(Var *var);
765  bool Check_DropLongStr(const Var *var, const Attribute *attr) ;
766  void add_ignored_var_longstr_info(const Var*var, const Attribute *attr) ;
767  void add_ignored_grp_longstr_info(const std::string& grp_path, const std::string& attr_name);
768  void add_ignored_droplongstr_hdr();
769  bool Check_VarDropLongStr(const std::string &varpath, const std::vector<Dimension *>&, H5DataType) const;
770 
771  void release_standalone_var_vector(std::vector<Var*>&vars);
772 
773  // Handle grid_mapping attributes
774  std::string Check_Grid_Mapping_VarName(const std::string& attr_value,const std::string& var_full_path);
775  std::string Check_Grid_Mapping_FullPath(const std::string& attr_value);
776 
777 protected:
778  File(const char *h5_path, hid_t file_id) :
779  path(std::string(h5_path)), fileid(file_id)
780  {
781  }
782 
783  // TODO: Will see if having time to make the following memembers private. See ESDIS-560
784  std::string path;
785  hid_t fileid;
786  hid_t rootid = -1;
787 
789  std::vector<Var *> vars;
790 
792  std::vector<Attribute *> root_attrs;
793 
795  std::vector<Group*> groups;
796 
797  bool unsupported_var_dtype = false;
798  bool unsupported_attr_dtype = false;
799 
800  bool unsupported_var_dspace = false;
801  bool unsupported_attr_dspace = false;
802  bool unsupported_var_attr_dspace = false;
803 
804  std::set<std::string> dimnamelist;
805  //"set<string>unlimited_dimnamelist "
806  std::map<std::string, hsize_t> dimname_to_dimsize;
807 
808  // Unlimited dim. info
809  std::map<std::string, bool> dimname_to_unlimited;
810 
812  std::map<hsize_t, std::string> dimsize_to_fakedimname;
813  int addeddimindex = 0;
814  std::vector<std::pair<hsize_t, std::string>>dup_dimsize_dimname;
815 
816  bool check_ignored = false;
817  bool have_ignored = false;
818  bool have_udim = false;
819  bool _is_dap4 = false;
820  bool iscoard = false;
821  std::string ignored_msg;
822 
823 };
824 
826 class GMFile: public File {
827 public:
828  GMFile(const char*path, hid_t file_id, H5GCFProduct product, GMPattern gproduct_pattern);
829  ~GMFile() override;
830 
831  H5GCFProduct getProductType() const
832  {
833  return product_type;
834  }
835 
836  const std::vector<GMCVar *>&getCVars() const
837  {
838  return this->cvars;
839  }
840 
841  const std::vector<GMSPVar *>&getSPVars() const
842  {
843  return this->spvars;
844  }
845 
847  void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr) override;
848 
850  void Retrieve_H5_Supported_Attr_Values() override;
851 
853 
855  void Adjust_H5_Attr_Value(Attribute *attr) ;
856 
858  void Handle_Unsupported_Dtype(bool) override;
859 
861  void Handle_Unsupported_Dspace(bool) override;
862 
864  void Handle_Unsupported_Others(bool) override;
865 
868 
870  void Add_Dim_Name() ;
871 
873  void Handle_CVar() override;
874 
876  void Handle_SpVar() override;
877 
879  void Handle_SpVar_Attr() override;
880 
883  void Handle_SpVar_DMR() override { };
884 
886  void Adjust_Obj_Name() override;
887 
889  void Flatten_Obj_Name(bool include_attr) override;
890 
892  void Handle_Obj_NameClashing(bool) ;
893 
895  void Adjust_Dim_Name() override;
896 
897  void Handle_DimNameClashing() override;
898 
900  void Add_Supplement_Attrs(bool) override;
901 
903  bool Have_Grid_Mapping_Attrs()override;
904 
906  void Handle_Grid_Mapping_Vars()override;
907 
908  //
909  bool Is_Hybrid_EOS5();
910  void Handle_Hybrid_EOS5();
911 
913  void Handle_Coor_Attr()override;
914 
917 
920 
922  void Update_Product_Type() ;
923 
925  void Add_Path_Coord_Attr();
926 
928  bool Get_IgnoredInfo_Flag() override
929  {
930  return check_ignored;
931  }
932 
934  const std::string& Get_Ignored_Msg() override
935  {
936  return ignored_msg;
937  }
938 
939 protected:
940  bool Check_And_Update_New_GPM_L3();
941  void Remove_OMPSNPP_InputPointers();
942  void Add_Dim_Name_GPM() ;
943  void Add_Dim_Name_Mea_SeaWiFS() ;
944  void Handle_UseDimscale_Var_Dim_Names_Mea_SeaWiFS_Ozone(Var*) ;
945  void Add_UseDimscale_Var_Dim_Names_Mea_SeaWiFS_Ozone(Var *, const Attribute*) ;
946 
947  void Add_Dim_Name_Mea_Ozonel3z() ;
948  bool check_cv(const std::string & varname) const;
949 
950  void Add_Dim_Name_Aqu_L3() ;
951  void Add_Dim_Name_OBPG_L3() ;
952  void Add_Dim_Name_OSMAPL2S() ;
953  void Add_Dim_Name_ACOS_L2S_OCO2_L1B() ;
954 
955  void Add_Dim_Name_General_Product() ;
956  void Check_General_Product_Pattern() ;
957  bool Check_Dimscale_General_Product_Pattern() ;
958  bool Check_LatLon2D_General_Product_Pattern() ;
959  bool Check_LatLon2D_General_Product_Pattern_Name_Size(const std::string& latname, const std::string& lonname)
960  ;
961  bool Check_LatLon1D_General_Product_Pattern() ;
962  bool Check_LatLon1D_General_Product_Pattern_Name_Size(const std::string& latname, const std::string& lonname)
963  ;
964 
965  bool Check_LatLon_With_Coordinate_Attr_General_Product_Pattern() ;
966  void Build_lat1D_latlon_candidate(const Var*, const std::vector<Var*>&);
967  void Build_latg1D_latlon_candidate(Var*, const std::vector<Var*>&);
968  void Build_unique_latlon_candidate();
969  void Add_Dim_Name_LatLon1D_Or_CoordAttr_General_Product() ;
970  void Add_Dim_Name_LatLon2D_General_Product() ;
971  void Add_Dim_Name_Dimscale_General_Product() ;
972  void Handle_UseDimscale_Var_Dim_Names_General_Product(Var*) ;
973  void Add_UseDimscale_Var_Dim_Names_General_Product(Var*, Attribute*) ;
974 
975  // Check if we have 2-D lat/lon CVs, and if yes, add those to the CV list.
976  void Update_M2DLatLon_Dimscale_CVs() ;
977  bool Check_1DGeolocation_Dimscale() ;
978  void Obtain_1DLatLon_CVs(std::vector<GMCVar*> &cvar_1dlat, std::vector<GMCVar*> &cvar_1dlon);
979  void Obtain_2DLatLon_Vars(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
980  std::map<std::string, int>&latlon2d_path_to_index);
981  void Obtain_2DLLVars_With_Dims_not_1DLLCVars(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
982  std::vector<GMCVar*> &cvar_1dlat, std::vector<GMCVar*> &cvar_1dlon, std::map<std::string, int>&latlon2d_path_to_index);
983  void Obtain_2DLLCVar_Candidate(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
984  std::map<std::string, int>&latlon2d_path_to_index) ;
985  void Obtain_unique_2dCV(std::vector<Var*>&, std::map<std::string, int>&);
986  void Remove_2DLLCVar_Final_Candidate_from_Vars(std::vector<int>&) ;
987 
988  void Handle_CVar_GPM_L1() ;
989  void Handle_CVar_GPM_L3() ;
990  void Handle_CVar_Mea_SeaWiFS() ;
991  void Handle_CVar_Aqu_L3() ;
992  void Handle_CVar_OBPG_L3() ;
993  void Handle_CVar_OSMAPL2S() ;
994  void Handle_CVar_Mea_Ozone() ;
995  void Handle_SpVar_ACOS_OCO2() ;
996  void Handle_CVar_Dimscale_General_Product() ;
997  void Handle_CVar_LatLon2D_General_Product() ;
998  void Handle_CVar_LatLon1D_General_Product() ;
999  void Handle_CVar_LatLon_General_Product() ;
1000 
1001  void Adjust_Mea_Ozone_Obj_Name() ;
1002  void Adjust_GPM_L3_Obj_Name() ;
1003 
1004  void Handle_GMCVar_NameClashing(std::set<std::string> &) ;
1005  void Handle_GMCVar_AttrNameClashing() ;
1006  void Handle_GMSPVar_NameClashing(std::set<std::string> &) ;
1007  void Handle_GMSPVar_AttrNameClashing() ;
1008  template<typename T> void GMHandle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec)
1009  ;
1010 
1011  std::string get_CF_string(std::string s) override;
1012 
1013  // The following routines are for generating coordinates attributes for netCDF-4 like 2D-latlon cases.
1014  bool Check_Var_2D_CVars(Var*) ;
1015  bool Flatten_VarPath_In_Coordinates_Attr(Var*) ;
1016 #if 0
1017  //bool Flatten_VarPath_In_Coordinates_Attr_EOS5(Var*) ;
1018 #endif
1019  void Handle_LatLon_With_CoordinateAttr_Coor_Attr() ;
1020  bool Coord_Match_LatLon_NameSize(const std::string & coord_values) ;
1021  bool Coord_Match_LatLon_NameSize_Same_Group(const std::string & coord_values, const std::string &var_path) ;
1022  void Add_VarPath_In_Coordinates_Attr(Var*, const std::string &);
1023 
1024  // The following three routines handle the GPM CF-related attributes
1025  void Handle_GPM_l1_Coor_Attr() ;
1026  void Correct_GPM_L1_LatLon_units(Var *var, const std::string unit_value) ;
1027  void Add_GPM_Attrs() ;
1028 
1029  void Add_Aqu_Attrs() ;
1030  void Add_SeaWiFS_Attrs() ;
1031  void Create_Missing_CV(GMCVar*, const std::string &) ;
1032 
1033  bool Is_netCDF_Dimension(Var *var) ;
1034 
1035  void Gen_Unsupported_Dtype_Info(bool) override;
1036  void Gen_VarAttr_Unsupported_Dtype_Info() override;
1037  void Gen_GM_VarAttr_Unsupported_Dtype_Info();
1038  void Gen_Unsupported_Dspace_Info() override;
1039  void Handle_GM_Unsupported_Dtype(bool) ;
1040  void Handle_GM_Unsupported_Dspace(bool) ;
1041 
1042  bool Remove_EOS5_Strings(std::string &);
1043  bool Remove_EOS5_Strings_NonEOS_Fields (std::string &);
1044  void release_standalone_GMCVar_vector(std::vector<GMCVar*> &tempgc_vars);
1045 
1046 private:
1047  H5GCFProduct product_type;
1048  GMPattern gproduct_pattern;
1049  std::vector<GMCVar *> cvars;
1050  std::vector<GMSPVar *> spvars;
1051  std::string gp_latname;
1052  std::string gp_lonname;
1053  std::set<std::string> grp_cv_paths;
1054  std::vector<struct Name_Size_2Pairs> latloncv_candidate_pairs;
1055  //"map<string,string>dimcvars_2dlatlon"
1056 #if 0
1057  bool ll2d_no_cv;
1058 #endif
1059  bool have_nc4_non_coord = false;
1060 
1061 };
1062 
1064 class EOS5CFGrid {
1065 public:
1066  EOS5CFGrid()
1067  {
1068  std::fill_n(param, 13, 0);
1069  }
1070 
1071  ~EOS5CFGrid() = default;
1072 
1073 protected:
1074  void Update_Dimnamelist();
1075 
1076 private:
1077  float point_lower = 0.0;
1078  float point_upper = 0.0;
1079  float point_left = 0.0;
1080  float point_right = 0.0;
1081  EOS5GridPRType eos5_pixelreg = HE5_HDFE_CENTER; // may change later
1082  EOS5GridOriginType eos5_origin = HE5_HDFE_GD_UL; // may change later
1083  EOS5GridPCType eos5_projcode = HE5_GCTP_GEO; // may change later
1084 
1085  double param[13];
1086  int zone = -1;
1087  int sphere = 0;
1088 
1089  std::vector<std::string> dimnames;
1090  std::set<std::string> vardimnames;
1091  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1092 
1093  // Unlimited dim. info
1094  std::map<std::string, bool> dimnames_to_unlimited;
1095 
1096  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1097  int addeddimindex = 0;
1098 
1099  std::map<std::string, std::string> dnames_to_1dvnames;
1100  std::string name;
1101  int xdimsize = 0;
1102  int ydimsize = 0;
1103  bool has_nolatlon = true;
1104  bool has_1dlatlon = false;
1105  bool has_2dlatlon = false;
1106  bool has_g2dlatlon = false;
1107 
1108  friend class EOS5File;
1109 };
1110 
1113 public:
1114  EOS5CFSwath() = default;
1115  ~EOS5CFSwath() = default;
1116 
1117 private:
1118 
1119  std::vector<std::string> dimnames;
1120  std::set<std::string> vardimnames;
1121  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1122 
1123  // Unlimited dim. info
1124  std::map<std::string, bool> dimnames_to_unlimited;
1125 
1126  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1127  int addeddimindex = 0;
1128 
1129  std::map<std::string, std::string> dnames_to_geo1dvnames;
1130  std::string name;
1131  bool has_nolatlon = true;
1132  bool has_1dlatlon = false;
1133  bool has_2dlatlon = false;
1134  bool has_g2dlatlon = false;
1135 
1136  friend class EOS5File;
1137 };
1138 
1140 class EOS5CFZa {
1141 public:
1142  EOS5CFZa() = default;
1143 
1144  ~EOS5CFZa() = default;
1145 
1146 private:
1147 
1148  std::vector<std::string> dimnames;
1149  std::set<std::string> vardimnames;
1150  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1151  // Unlimited dim. info
1152  std::map<std::string, bool> dimnames_to_unlimited;
1153 
1154  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1155  int addeddimindex = 0;
1156 
1157  std::map<std::string, std::string> dnames_to_1dvnames;
1158  std::string name;
1159 
1160  friend class EOS5File;
1161 };
1162 
1164 class EOS5File: public File {
1165 public:
1166  EOS5File(const char*he5_path, hid_t file_id) :
1167  File(he5_path, file_id)
1168  {
1169  }
1170 
1171  ~EOS5File() override;
1172 public:
1173 
1175  const std::vector<EOS5CVar *>&getCVars() const
1176  {
1177  return this->cvars;
1178  }
1179 
1181  void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr) override;
1182 
1184  void Retrieve_H5_Supported_Attr_Values() override;
1185 
1188 
1190  void Handle_Unsupported_Dtype(bool) override ;
1191 
1193  void Handle_Unsupported_Dspace(bool) override;
1194 
1196  void Handle_Unsupported_Others(bool) override;
1197 
1199  void Adjust_EOS5Dim_Info(HE5Parser*strmeta_info) ;
1200 
1202  void Add_EOS5File_Info(HE5Parser*, bool) ;
1203 
1206 
1208  void Adjust_Obj_Name() override;
1209 
1211  void Add_Dim_Name(HE5Parser *) ;
1212 
1214  void Check_Aura_Product_Status() ;
1215 
1217  void Handle_CVar() override;
1218 
1220  void Handle_SpVar() override;
1221 
1223  void Handle_SpVar_Attr() override;
1224 
1226  void Handle_SpVar_DMR() override;
1227 
1230 
1232  void Flatten_Obj_Name(bool include_attr) override ;
1233 
1235  void Set_COARDS_Status() ;
1236 
1238  void Adjust_Attr_Info() ;
1239 
1241  void Handle_Obj_NameClashing(bool) ;
1242 
1244  void Add_Supplement_Attrs(bool) override;
1245 
1247  void Handle_Coor_Attr() override;
1248 
1250  void Adjust_Dim_Name() override;
1251 
1252  void Handle_DimNameClashing() override;
1253 
1255  bool Have_Grid_Mapping_Attrs() override;
1256 
1258  void Handle_Grid_Mapping_Vars() override;
1259 
1260 
1261  bool Have_EOS5_Grids() {
1262  return !(this->eos5cfgrids.empty());
1263  }
1264  bool Get_IgnoredInfo_Flag() override
1265  {
1266  return check_ignored;
1267  }
1268 
1269  const std::string& Get_Ignored_Msg() override
1270  {
1271  return ignored_msg;
1272  }
1273 
1274 protected:
1275  void Adjust_H5_Attr_Value(Attribute *attr) ;
1276 
1277  void Adjust_EOS5Dim_List(std::vector<HE5Dim>&) ;
1278  void Condense_EOS5Dim_List(std::vector<HE5Dim>&) ;
1279  void Remove_NegativeSizeDims(std::vector<HE5Dim>&) ;
1280  void Adjust_EOS5DimSize_List(std::vector<HE5Dim>&,const std::vector<HE5Var>&, const EOS5Type,const std::string & eos5objname);
1281  void Adjust_EOS5VarDim_Info(std::vector<HE5Dim>&, std::vector<HE5Dim>&, const std::string &, EOS5Type) ;
1282 
1283  void EOS5Handle_nonlatlon_dimcvars(std::vector<HE5Var> & eos5varlist, EOS5Type, std::string groupname,
1284  std::map<std::string, std::string>& dnamesgeo1dvnames) ;
1285  template<class T> void EOS5SwathGrid_Set_LatLon_Flags(T* eos5gridswath, std::vector<HE5Var>& eos5varlist)
1286  ;
1287 
1288  void Obtain_Var_NewName(Var*) ;
1289  EOS5Type Get_Var_EOS5_Type(Var*) ;
1290 
1291  bool Obtain_Var_Dims(Var*, HE5Parser*) ;
1292  template<class T> bool Set_Var_Dims(T*, Var*, std::vector<HE5Var>&, const std::string&, int, EOS5Type) ;
1293  template<class T> void Create_Unique_DimName(T*, std::set<std::string>&, Dimension *, int, EOS5Type) ;
1294 
1295  template<class T> bool Check_All_DimNames(T*, std::string &, hsize_t);
1296  std::string Obtain_Var_EOS5Type_GroupName(const Var*, EOS5Type) const;
1297  int Check_EOS5Swath_FieldType(const Var*) const;
1298  void Get_Unique_Name(std::set<std::string>&, std::string&) ;
1299 
1300  template<class T> std::string Create_Unique_FakeDimName(T*, EOS5Type) ;
1301  template<class T> void Set_NonParse_Var_Dims(T*, Var*, const std::map<hsize_t, std::string>&, int, EOS5Type) ;
1302 
1303  void Handle_Grid_CVar(bool) ;
1304  void Handle_Augmented_Grid_CVar() ;
1305  template<class T> void Handle_Single_Augment_CVar(T*, EOS5Type) ;
1306 
1307  void Handle_Multi_Nonaugment_Grid_CVar() ;
1308  void Handle_Single_Nonaugment_Grid_CVar(EOS5CFGrid*) ;
1309  bool Handle_Single_Nonaugment_Grid_CVar_OwnLatLon(const EOS5CFGrid *, std::set<std::string>&) ;
1310  bool Handle_Single_Nonaugment_Grid_CVar_EOS5LatLon(const EOS5CFGrid *, std::set<std::string>&) ;
1311  void Handle_NonLatLon_Grid_CVar(EOS5CFGrid *, std::set<std::string>&) ;
1312  void Remove_MultiDim_LatLon_EOS5CFGrid() ;
1313  void Adjust_EOS5GridDimNames(EOS5CFGrid *) ;
1314 
1315  void Handle_Swath_CVar(bool) ;
1316  void Handle_Single_1DLatLon_Swath_CVar(EOS5CFSwath *cfswath, bool is_augmented) ;
1317  void Handle_Single_2DLatLon_Swath_CVar(EOS5CFSwath *cfswath, bool is_augmented) ;
1318  void Handle_NonLatLon_Swath_CVar(EOS5CFSwath *cfswath, std::set<std::string>& tempvardimnamelist) ;
1319  void Handle_Special_NonLatLon_Swath_CVar(EOS5CFSwath *cfswath, std::set<std::string>&tempvardimnamelist) ;
1320 
1321  void Handle_Za_CVar(bool) ;
1322 
1323  bool Check_Augmentation_Status() ;
1324  // Don't remove the following commented if 0 line!
1325 #if 0
1326  //bool Check_Augmented_Var_Attrs(Var *var) throw(Exception);
1327 #endif
1328  template<class T> bool Check_Augmented_Var_Candidate(T*, Var*, EOS5Type) ;
1329 
1330  template<class T> void Adjust_Per_Var_Dim_NewName_Before_Flattening(T*, bool, int, int, int) ;
1331  void Adjust_SharedLatLon_Grid_Var_Dim_Name() ;
1332 
1333  void Adjust_Aura_Attr_Name() ;
1334  void Adjust_Aura_Attr_Value() ;
1335  void Handle_EOS5CVar_Unit_Attr() ;
1336  void Add_EOS5_Grid_CF_Attr() ;
1337  void Handle_Aura_Special_Attr() ;
1338 
1339  std::string get_CF_string(std::string s) override;
1340  void Replace_Var_Info_EOS(EOS5CVar *src, EOS5CVar *target);
1341  void Replace_Var_Attrs_EOS(EOS5CVar *src, EOS5CVar *target);
1342  void Handle_EOS5CVar_NameClashing(std::set<std::string> &) ;
1343  void Handle_EOS5CVar_AttrNameClashing() ;
1344  template<typename T> void EOS5Handle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec)
1345  ;
1346  template<typename T> void Create_Missing_CV(T*, EOS5CVar*, const std::string &, EOS5Type, int) ;
1347  void Create_Added_Var_NewName_FullPath(EOS5Type, const std::string&, const std::string&, std::string &, std::string &) ;
1348 
1349  void Handle_EOS5_Unsupported_Dtype(bool) ;
1350  void Handle_EOS5_Unsupported_Dspace(bool) ;
1351 
1352  void Gen_Unsupported_Dtype_Info(bool) override;
1353  void Gen_VarAttr_Unsupported_Dtype_Info() override;
1354  void Gen_EOS5_VarAttr_Unsupported_Dtype_Info() ;
1355 
1356  void Gen_Unsupported_Dspace_Info() override;
1357 
1358 private:
1359  std::vector<EOS5CVar *> cvars;
1360  std::vector<EOS5CFGrid *> eos5cfgrids;
1361  std::vector<EOS5CFSwath *> eos5cfswaths;
1362  std::vector<EOS5CFZa *> eos5cfzas;
1363  std::map<std::string, std::string> eos5_to_cf_attr_map;
1364  bool grids_multi_latloncvs = false;
1365  bool isaura = false;
1366  EOS5AuraName aura_name = NOTAURA;
1367  int orig_num_grids = 0;
1368  std::multimap<std::string, std::string> dimname_to_dupdimnamelist;
1369 };
1370 
1371 }
1372 #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:355
CVType getCVType() const
Get the coordinate variable type of this variable.
Definition: HDF5CF.h:362
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:1064
This class simulates an HDF-EOS5 Swath.
Definition: HDF5CF.h:1112
This class simulates an HDF-EOS5 Zonal average object.
Definition: HDF5CF.h:1140
This class is a derived class of CVar. It represents a coordinate variable for HDF-EOS5 files.
Definition: HDF5CF.h:431
This class is a derived class of File. It includes methods applied to HDF-EOS5 files only.
Definition: HDF5CF.h:1164
bool Get_IgnoredInfo_Flag() override
Obtain the flag to see if ignored objects should be generated.
Definition: HDF5CF.h:1264
void Adjust_Obj_Name() override
This method is a no-op operation. Leave here since the method in the base class is pure virtual.
Definition: HDFEOS5CF.cc:4197
void Add_EOS5File_Info(HE5Parser *, bool)
Add HDF-EOS5 dimension and coordinate variable related info. to EOS5Grid,EOS5Swath etc.
Definition: HDFEOS5CF.cc:838
void Handle_Grid_Mapping_Vars() override
Handle Grid Mapping Vars.
Definition: HDFEOS5CF.cc:4205
void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr) override
Retrieve DDS information from the HDF5 file; a real implementation for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:161
void Add_Supplement_Attrs(bool) override
Add the supplemental attributes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3670
void Set_COARDS_Status()
Set COARDS flag.
Definition: HDFEOS5CF.cc:3384
void Adjust_Var_Dim_NewName_Before_Flattening()
Adjust variable dimension names before the flattening for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3033
void Handle_CVar() override
Handle coordinate variable for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1770
void Adjust_Attr_Info()
Adjust the attribute info for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3407
void Handle_SpVar_Attr() override
Handle special variables for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:4099
void Handle_Obj_NameClashing(bool)
Handle the object name clashing for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3233
void Handle_Unsupported_Dtype(bool) override
Handle unsupported HDF5 datatypes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:207
bool Have_Grid_Mapping_Attrs() override
Check if having Grid Mapping Attrs.
Definition: HDFEOS5CF.cc:4202
void Handle_DimNameClashing() override
Definition: HDFEOS5CF.cc:3319
const std::vector< EOS5CVar * > & getCVars() const
Obtain coordinate variables for HDF-EOS5 products.
Definition: HDF5CF.h:1175
void Handle_Unsupported_Others(bool) override
Handle other unmapped objects/attributes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:360
void Retrieve_H5_CVar_Supported_Attr_Values() override
Retrieve coordinate variable attributes.
Definition: HDFEOS5CF.cc:168
void Handle_SpVar() override
Handle special variables for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3977
void Adjust_Var_NewName_After_Parsing()
Adjust variable names for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1224
void Retrieve_H5_Supported_Attr_Values() override
Retrieve attribute values for the supported HDF5 datatypes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:184
void Add_Dim_Name(HE5Parser *)
Add the dimension name for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1316
void Adjust_Dim_Name() override
Adjust the dimension name for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3640
void Handle_SpVar_DMR() override
Handle special variables and attributes for HDF-EOS5 files(for DMR)
Definition: HDFEOS5CF.cc:4139
void Handle_Unsupported_Dspace(bool) override
Handle unsupported HDF5 dataspaces for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:301
const std::string & Get_Ignored_Msg() override
Obtain the message that contains the ignored object info.
Definition: HDF5CF.h:1269
void Flatten_Obj_Name(bool include_attr) override
Flatten the object name for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3211
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:1718
void Adjust_EOS5Dim_Info(HE5Parser *strmeta_info)
Adjust HDF-EOS5 dimension information.
Definition: HDFEOS5CF.cc:537
void Handle_Coor_Attr() override
Handle the coordinates attribute for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3763
Exception(const std::string &msg)
Constructor.
Definition: HDF5CF.h:73
This class retrieves all information from an HDF5 file.
Definition: HDF5CF.h:563
bool HaveUnlimitedDim() const
Has unlimited dimensions.
Definition: HDF5CF.h:661
std::vector< Group * > groups
Non-root group vectors.
Definition: HDF5CF.h:795
virtual void Retrieve_H5_Var_Attr_Values(Var *var)
Retrieve attribute values for a variable.
Definition: HDF5CF.cc:746
virtual void Handle_Unsupported_Dspace(bool)
Handle unsupported HDF5 dataspaces for datasets.
Definition: HDF5CF.cc:1273
const std::string & getPath() const
Obtain the path of the file.
Definition: HDF5CF.h:637
std::map< hsize_t, std::string > dimsize_to_fakedimname
Handle added dimension names.
Definition: HDF5CF.h:812
virtual void Handle_Grid_Mapping_Vars()
Handle Grid Mapping Vars.
Definition: HDF5CF.cc:2208
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:631
virtual void Handle_Unsupported_Others(bool)
Handle other unmapped objects/attributes.
Definition: HDF5CF.cc:1320
virtual void Retrieve_H5_Supported_Attr_Values()
Retrieve attribute values for the supported HDF5 datatypes.
Definition: HDF5CF.cc:727
std::vector< Var * > vars
Var vectors.
Definition: HDF5CF.h:789
const std::vector< Attribute * > & getAttributes() const
Public interface to obtain information of all attributes under the root group.
Definition: HDF5CF.h:649
const std::vector< Var * > & getVars() const
Public interface to obtain information of all variables.
Definition: HDF5CF.h:643
virtual void Add_Supplement_Attrs(bool)
Add supplemental attributes such as fullpath and original name.
Definition: HDF5CF.cc:2027
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:168
std::vector< Attribute * > root_attrs
Root attribute vectors.
Definition: HDF5CF.h:792
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:916
const std::vector< Group * > & getGroups() const
Public interface to obtain all the group info.
Definition: HDF5CF.h:655
virtual void Flatten_Obj_Name(bool)
Flatten the object name.
Definition: HDF5CF.cc:1370
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:2188
This class is a derived class of CVar. It represents a coordinate variable for general HDF5 files.
Definition: HDF5CF.h:413
H5GCFProduct getPtType() const
Get the data type of this variable.
Definition: HDF5CF.h:420
This class is a derived class of File. It includes methods applied to general HDF5 files only.
Definition: HDF5CF.h:826
void Add_Supplement_Attrs(bool) override
Add supplemental attributes such as fullpath and original name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:5173
void Add_Path_Coord_Attr()
Update the coordinate attribute to include path and also flatten.
Definition: HDF5GMCF.cc:6873
void Handle_Obj_NameClashing(bool)
Handle object name clashing for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4954
void Remove_Unused_FakeDimVars()
Unsupported datatype array may generate FakeDim. Remove them.
Definition: HDF5GMCF.cc:6810
void Update_Product_Type()
Update "product type" attributes for general HDF5 products.
Definition: HDF5GMCF.cc:239
bool Have_Grid_Mapping_Attrs() override
Check if having Grid Mapping Attrs.
Definition: HDF5GMCF.cc:6802
void Handle_SpVar_Attr() override
Handle special variable attributes for general NASA HDF5 products.
Definition: HDF5GMCF.cc:6515
void Handle_DimNameClashing() override
Definition: HDF5GMCF.cc:5055
void Handle_Grid_Mapping_Vars() override
Handle Grid Mapping Vars.
Definition: HDF5GMCF.cc:6806
void Adjust_H5_Attr_Value(Attribute *attr)
Adjust attribute values for general HDF5 products.
Definition: HDF5GMCF.cc:373
void Retrieve_H5_CVar_Supported_Attr_Values() override
Retrieve coordinate variable attributes.
Definition: HDF5GMCF.cc:329
void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr) override
Retrieve DDS information from the HDF5 file; real implementation for general HDF5 products.
Definition: HDF5GMCF.cc:220
void Handle_SpVar() override
Handle special variables for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4738
void Remove_Unneeded_Objects()
Remove unneeded objects.
Definition: HDF5GMCF.cc:262
void Handle_CVar() override
Handle coordinate variables for general NASA HDF5 products.
Definition: HDF5GMCF.cc:2886
void Add_Dim_Name()
Add dimension name.
Definition: HDF5GMCF.cc:805
void Retrieve_H5_Supported_Attr_Values() override
Retrieve attribute values for the supported HDF5 datatypes for general HDF5 products.
Definition: HDF5GMCF.cc:343
void Handle_Coor_Attr() override
Handle "coordinates" attributes for general HDF5 products.
Definition: HDF5GMCF.cc:5894
void Rename_NC4_NonCoordVars()
Remove the _nc4_non_coord from the variable new names.
Definition: HDF5GMCF.cc:6855
void Handle_Unsupported_Dspace(bool) override
Handle unsupported HDF5 dataspaces for general HDF5 products.
Definition: HDF5GMCF.cc:578
void Handle_Unsupported_Others(bool) override
Handle other unmapped objects/attributes for general HDF5 products.
Definition: HDF5GMCF.cc:668
void Handle_Unsupported_Dtype(bool) override
Handle unsupported HDF5 datatypes for general HDF5 products.
Definition: HDF5GMCF.cc:391
void Flatten_Obj_Name(bool include_attr) override
Flatten the object name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4905
const std::string & Get_Ignored_Msg() override
Get the message that contains the ignored obj. info.
Definition: HDF5CF.h:934
void Adjust_Dim_Name() override
Adjust dimension name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:5114
void Adjust_Obj_Name() override
Adjust object names based on different general NASA HDF5 products.
Definition: HDF5GMCF.cc:4824
void Handle_SpVar_DMR() override
Definition: HDF5CF.h:883
bool Get_IgnoredInfo_Flag() override
Obtain ignored info. flag.
Definition: HDF5CF.h:928
This class is a derived class of Var. It represents a special general HDF5 product(currently ACOS and...
Definition: HDF5CF.h:382
This class represents an HDF5 group. The group will be flattened according to the CF conventions.
Definition: HDF5CF.h:525
const std::string & getPath() const
Get the original path of this group.
Definition: HDF5CF.h:532
const std::string & getNewName() const
Get the new name of this group(flattened,name clashed checked)
Definition: HDF5CF.h:538
This class represents one HDF5 dataset(CF variable)
Definition: HDF5CF.h:256
float getCompRatio() const
Get the compression ratio of this dataset.
Definition: HDF5CF.h:321
int getRank() const
Get the dimension rank of this variable.
Definition: HDF5CF.h:298
const std::string & getFullPath() const
Get the full path of this variable.
Definition: HDF5CF.h:276
const std::string & getName() const
Get the original name of this variable.
Definition: HDF5CF.h:264
H5DataType getType() const
Get the data type of this variable(Not HDF5 datatype id)
Definition: HDF5CF.h:304
const std::vector< Dimension * > & getDimensions() const
Get the list of the dimensions.
Definition: HDF5CF.h:315
const std::string & getNewName() const
Get the new name of this variable.
Definition: HDF5CF.h:270