bes  Updated for version 3.20.6
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), unsupported_attr_dtype(false),
263  unsupported_attr_dspace(false), unsupported_dspace(false), dimnameflag(false)
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 
295  int getRank() const
296  {
297  return this->rank;
298  }
299 
301  H5DataType getType() const
302  {
303  return this->dtype;
304  }
305 
306  const std::vector<Attribute *>&getAttributes() const
307  {
308  return this->attrs;
309  }
310 
312  const std::vector<Dimension *>&getDimensions() const
313  {
314  return this->dims;
315  }
316 
318  int getCompRatio() const
319  {
320  return this->comp_ratio;
321  }
322 
323 private:
324 
325  std::string newname;
326  std::string name;
327  std::string fullpath;
328  H5DataType dtype;
329  int rank;
330  int comp_ratio;
331  size_t total_elems;
332  bool unsupported_attr_dtype;
333  bool unsupported_attr_dspace;
334  bool unsupported_dspace;
335  bool dimnameflag;
336 
337  std::vector<Attribute *> attrs;
338  std::vector<Dimension *> dims;
339 
340  friend class CVar;
341  friend class GMCVar;
342  friend class GMSPVar;
343  friend class EOS5CVar;
344  friend class File;
345  friend class GMFile;
346  friend class EOS5File;
347 };
348 
350 class CVar: public Var {
351 public:
352  CVar() :
353  cvartype(CV_UNSUPPORTED)
354  {
355  }
356  ~CVar()
357  {
358  }
360  CVType getCVType() const
361  {
362  return this->cvartype;
363  }
364 
365  bool isLatLon() const;
366 
367 private:
368  // Each coordinate variable has and only has one dimension
369  // This assumption is based on the exact match between
370  // variables and dimensions
371  std::string cfdimname;
372  CVType cvartype;
373 
374  friend class File;
375  friend class GMFile;
376  friend class EOS5File;
377 };
378 
380 class GMSPVar: public Var {
381 public:
382  GMSPVar() :
383  otype(H5UNSUPTYPE), sdbit(-1), numofdbits(-1)
384  {
385  }
386  explicit GMSPVar(Var *var);
387  ~GMSPVar()
388  {
389  }
390  H5DataType getOriginalType() const
391  {
392  return this->otype;
393  }
394 
395  int getStartBit() const
396  {
397  return this->sdbit;
398  }
399 
400  int getBitNum() const
401  {
402  return this->numofdbits;
403  }
404 
405 private:
406  H5DataType otype;
407  int sdbit;
408  int numofdbits;
409 
410  friend class File;
411  friend class GMFile;
412 };
413 
415 class GMCVar: public CVar {
416 public:
417  GMCVar() :
418  product_type(General_Product)
419  {
420  }
421  explicit GMCVar(Var*var);
422  ~GMCVar()
423  {
424  }
425 
427  H5GCFProduct getPtType() const
428  {
429  return this->product_type;
430  }
431 
432 private:
433  H5GCFProduct product_type;
434  friend class GMFile;
435 };
436 
438 class EOS5CVar: public CVar {
439 public:
440  EOS5CVar() :
441  eos_type(OTHERVARS), is_2dlatlon(false), point_lower(0.0), point_upper(0.0), point_left(0.0), point_right(0.0), xdimsize(
442  0), ydimsize(0), eos5_pixelreg(HE5_HDFE_CENTER), // may change later
443  eos5_origin(HE5_HDFE_GD_UL), // may change later
444  eos5_projcode(HE5_GCTP_GEO), //may change later
445  zone(-1), sphere(0)
446  {
447  std::fill_n(param, 13, 0);
448  }
449  ;
450  explicit EOS5CVar(Var *);
451 
452  ~EOS5CVar()
453  {
454  }
455 
456  EOS5Type getEos5Type() const
457  {
458  return this->eos_type;
459  }
460  float getPointLower() const
461  {
462  return this->point_lower;
463  }
464  float getPointUpper() const
465  {
466  return this->point_upper;
467  }
468 
469  float getPointLeft() const
470  {
471  return this->point_left;
472  }
473  float getPointRight() const
474  {
475  return this->point_right;
476  }
477 
478  EOS5GridPRType getPixelReg() const
479  {
480  return this->eos5_pixelreg;
481  }
482  EOS5GridOriginType getOrigin() const
483  {
484  return this->eos5_origin;
485  }
486 
487  EOS5GridPCType getProjCode() const
488  {
489  return this->eos5_projcode;
490  }
491 
492  int getXDimSize() const
493  {
494  return this->xdimsize;
495  }
496 
497  int getYDimSize() const
498  {
499  return this->ydimsize;
500  }
501 
502  std::vector<double> getParams() const
503  {
504  std::vector<double> ret_params;
505  for (int i = 0; i < 13; i++)
506  ret_params.push_back(param[i]);
507  return ret_params;
508  }
509 
510  int getZone() const
511  {
512  return this->zone;
513  }
514 
515  int getSphere() const
516  {
517  return this->sphere;
518  }
519 
520 private:
521  EOS5Type eos_type;
522  bool is_2dlatlon;
523  float point_lower;
524  float point_upper;
525  float point_left;
526  float point_right;
527  int xdimsize;
528  int ydimsize;
529  EOS5GridPRType eos5_pixelreg;
530  EOS5GridOriginType eos5_origin;
531  EOS5GridPCType eos5_projcode;
532 
533  double param[13];
534  int zone;
535  int sphere;
536  friend class EOS5File;
537 };
538 
540 class Group {
541 public:
542  Group() :
543  unsupported_attr_dtype(false), unsupported_attr_dspace(false)
544  {
545  }
546  ~Group();
547 
548 
550  const std::string & getPath() const
551  {
552  return this->path;
553  }
554 
556  const std::string & getNewName() const
557  {
558  return this->newname;
559  }
560 
561  const std::vector<Attribute *>&getAttributes() const
562  {
563  return this->attrs;
564  }
565 
566 private:
567 
568  std::string newname;
569  std::string path;
570 
571  std::vector<Attribute *> attrs;
572  bool unsupported_attr_dtype;
573  bool unsupported_attr_dspace;
574 
575  friend class File;
576  friend class GMFile;
577  friend class EOS5File;
578 };
579 
581 class File {
582 public:
583 
591  virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool);
592 
594  virtual void Retrieve_H5_Supported_Attr_Values();
595 
597  virtual void Retrieve_H5_Var_Attr_Values(Var *var);
598 
600  virtual void Retrieve_H5_CVar_Supported_Attr_Values() = 0;
601 
603  virtual void Handle_Unsupported_Dtype(bool);
604 
606  virtual void Handle_Unsupported_Dspace(bool);
607 
609  virtual void Handle_Unsupported_Others(bool) ;
610 
612  virtual void Flatten_Obj_Name(bool) ;
613 
615  virtual void Add_Supplement_Attrs(bool) ;
616 
618  virtual bool Have_Grid_Mapping_Attrs();
619 
621  virtual void Handle_Grid_Mapping_Vars();
622 
624  virtual void Handle_Coor_Attr() = 0;
625 
627  virtual void Handle_CVar() = 0;
628 
630  virtual void Handle_SpVar() = 0;
631 
633  virtual void Handle_SpVar_Attr() = 0;
634 
636  virtual void Adjust_Obj_Name() = 0;
637 
639  virtual void Adjust_Dim_Name() = 0;
640 
643  virtual void Handle_DimNameClashing() = 0;
644 
646  hid_t getFileID() const
647  {
648  return this->fileid;
649  }
650 
652  const std::string & getPath() const
653  {
654  return this->path;
655  }
656 
658  const std::vector<Var *>&getVars() const
659  {
660  return this->vars;
661  }
662 
664  const std::vector<Attribute *>&getAttributes() const
665  {
666  return this->root_attrs;
667  }
668 
670  const std::vector<Group *>&getGroups() const
671  {
672  return this->groups;
673  }
674 
676  bool HaveUnlimitedDim() const
677  {
678  return have_udim;
679  }
680 
682  virtual bool Get_IgnoredInfo_Flag() = 0;
683 
685  virtual const std::string & Get_Ignored_Msg() = 0;
686 
687  virtual ~File();
688 
689 protected:
690 
691  void Retrieve_H5_Obj(hid_t grp_id, const char*gname, bool include_attr);
692  void Retrieve_H5_Attr_Info(Attribute *, hid_t obj_id, const int j, bool& unsup_attr_dtype, bool & unsup_attr_dspace);
693 
694  void Retrieve_H5_Attr_Value(Attribute *attr, std::string);
695 
696  void Retrieve_H5_VarType(Var*, hid_t dset_id, const std::string& varname, bool &unsup_var_dtype);
697  void Retrieve_H5_VarDim(Var*, hid_t dset_id, const std::string &varname, bool & unsup_var_dspace);
698 
699  float Retrieve_H5_VarCompRatio(Var*, hid_t);
700 
701  void Handle_Group_Unsupported_Dtype() ;
702  void Handle_Var_Unsupported_Dtype() ;
703  void Handle_VarAttr_Unsupported_Dtype() ;
704 
705  void Handle_GroupAttr_Unsupported_Dspace() ;
706  void Handle_VarAttr_Unsupported_Dspace() ;
707 
708  void Gen_Group_Unsupported_Dtype_Info() ;
709  void Gen_Var_Unsupported_Dtype_Info() ;
710  virtual void Gen_VarAttr_Unsupported_Dtype_Info() ;
711 
712  void Handle_GeneralObj_NameClashing(bool, std::set<std::string> &objnameset) ;
713  void Handle_Var_NameClashing(std::set<std::string> &objnameset) ;
714  void Handle_Group_NameClashing(std::set<std::string> &objnameset) ;
715  void Handle_Obj_AttrNameClashing() ;
716  template<typename T> void Handle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec) ;
717 
718  void Add_One_FakeDim_Name(Dimension *dim) ;
719  void Adjust_Duplicate_FakeDim_Name(Dimension * dim) ;
720  void Insert_One_NameSizeMap_Element(std::string name, hsize_t size, bool unlimited) ;
721  void Insert_One_NameSizeMap_Element2(std::map<std::string, hsize_t> &, std::map<std::string, bool>&, std::string name, hsize_t size,
722  bool unlimited) ;
723 
724  virtual std::string get_CF_string(std::string);
725  virtual void Replace_Var_Info(Var* src, Var *target);
726  virtual void Replace_Var_Attrs(Var *src, Var*target);
727 
728  void Add_Str_Attr(Attribute* attr, const std::string &attrname, const std::string& strvalue) ;
729  std::string Retrieve_Str_Attr_Value(Attribute *attr, const std::string var_path);
730  bool Is_Str_Attr(Attribute* attr, std::string varfullpath, const std::string &attrname, const std::string& strvalue);
731  void Add_One_Float_Attr(Attribute* attr, const std::string &attrname, float float_value) ;
732  void Replace_Var_Str_Attr(Var* var, const std::string &attr_name, const std::string& strvalue);
733  void Change_Attr_One_Str_to_Others(Attribute *attr, Var *var) ;
734 
735  // Check if having variable latitude by variable names (containing ???latitude/Latitude/lat)
736  bool Is_geolatlon(const std::string &var_name, bool is_lat);
737  bool has_latlon_cf_units(Attribute*attr, const std::string &varfullpath, bool is_lat);
738 
739  // Check if a variable with a var name is under a specific group with groupname
740  // note: the variable's size at each dimension is also returned. The user must allocate the
741  // memory for the dimension sizes(an array(vector is perferred).
742  bool is_var_under_group(const std::string &varname, const std::string &grpname, const int var_rank, std::vector<size_t> &var_size);
743 
744  // Remove netCDF internal attributes. Right now, only CLASS=DIMENSION_SCALE and NAME=Var_name and NAME=pure netCDF dimesnion are handled.
745  void remove_netCDF_internal_attributes(bool include_attr);
746 
747  virtual void Gen_Unsupported_Dtype_Info(bool) = 0;
748  virtual void Gen_Unsupported_Dspace_Info() ;
749  void Gen_DimScale_VarAttr_Unsupported_Dtype_Info() ;
750  void add_ignored_info_page_header();
751  void add_ignored_info_obj_header();
752  // void add_ignored_info_obj_dtype_header();
753  //void add_ignored_info_obj_dspace_header();
754  void add_ignored_info_links_header();
755  void add_ignored_info_links(const std::string& link_name);
756  void add_ignored_info_namedtypes(const std::string&, const std::string&);
757  void add_ignored_info_attrs(bool is_grp, const std::string & obj_path, const std::string &attr_name);
758  void add_ignored_info_objs(bool is_dim_related, const std::string & obj_path);
759  void add_no_ignored_info();
760  bool ignored_dimscale_ref_list(Var *var);
761  bool Check_DropLongStr(Var *var, Attribute *attr) ;
762  void add_ignored_var_longstr_info(Var*var, Attribute *attr) ;
763  void add_ignored_grp_longstr_info(const std::string& grp_path, const std::string& attr_name);
764  void add_ignored_droplongstr_hdr();
765  bool Check_VarDropLongStr(const std::string &varpath, const std::vector<Dimension *>&, H5DataType) ;
766 
767  void release_standalone_var_vector(std::vector<Var*>&vars);
768 
769  // Handle grid_mapping attributes
770  std::string Check_Grid_Mapping_VarName(const std::string& attr_value,const std::string& var_full_path);
771  std::string Check_Grid_Mapping_FullPath(const std::string& attr_value);
772 
773 protected:
774  File(const char *h5_path, hid_t file_id) :
775  path(std::string(h5_path)), fileid(file_id), rootid(-1), unsupported_var_dtype(false), unsupported_attr_dtype(false), unsupported_var_dspace(
776  false), unsupported_attr_dspace(false), unsupported_var_attr_dspace(false), addeddimindex(0), check_ignored(
777  false), have_ignored(false), have_udim(false)
778  {
779  }
780 
781  // TODO: Will see if having time to make the following memembers private. See ESDIS-560
782  std::string path;
783  hid_t fileid;
784  hid_t rootid;
785 
787  std::vector<Var *> vars;
788 
790  std::vector<Attribute *> root_attrs;
791 
793  std::vector<Group*> groups;
794 
795  bool unsupported_var_dtype;
796  bool unsupported_attr_dtype;
797 
798  bool unsupported_var_dspace;
799  bool unsupported_attr_dspace;
800  bool unsupported_var_attr_dspace;
801 
802  std::set<std::string> dimnamelist;
803  //"set<string>unlimited_dimnamelist "
804  std::map<std::string, hsize_t> dimname_to_dimsize;
805 
806  // Unlimited dim. info
807  std::map<std::string, bool> dimname_to_unlimited;
808 
810  std::map<hsize_t, std::string> dimsize_to_fakedimname;
811  int addeddimindex;
812 
813  bool check_ignored;
814  bool have_ignored;
815  bool have_udim;
816  std::string ignored_msg;
817 
818 };
819 
821 class GMFile: public File {
822 public:
823  GMFile(const char*path, hid_t file_id, H5GCFProduct product, GMPattern gproduct_pattern);
824  virtual ~GMFile();
825 
826  H5GCFProduct getProductType() const
827  {
828  return product_type;
829  }
830 
831  const std::vector<GMCVar *>&getCVars() const
832  {
833  return this->cvars;
834  }
835 
836  const std::vector<GMSPVar *>&getSPVars() const
837  {
838  return this->spvars;
839  }
840 
842  void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr);
843 
846 
848 
850  void Adjust_H5_Attr_Value(Attribute *attr) ;
851 
853  void Handle_Unsupported_Dtype(bool) ;
854 
856  void Handle_Unsupported_Dspace(bool) ;
857 
859  void Handle_Unsupported_Others(bool) ;
860 
863 
865  void Add_Dim_Name() ;
866 
868  void Handle_CVar() ;
869 
871  void Handle_SpVar() ;
872 
874  void Handle_SpVar_Attr() ;
875 
877  void Adjust_Obj_Name() ;
878 
880  void Flatten_Obj_Name(bool include_attr) ;
881 
883  void Handle_Obj_NameClashing(bool) ;
884 
886  void Adjust_Dim_Name() ;
887 
888  void Handle_DimNameClashing() ;
889 
891  void Add_Supplement_Attrs(bool) ;
892 
895 
898 
899  //
900  bool Is_Hybrid_EOS5();
901  void Handle_Hybrid_EOS5();
902 
904  void Handle_Coor_Attr();
905 
908 
911 
913  void Update_Product_Type() ;
914 
917  {
918  return check_ignored;
919  }
920 
922  const std::string& Get_Ignored_Msg()
923  {
924  return ignored_msg;
925  }
926 
927 protected:
928  void Remove_OMPSNPP_InputPointers();
929  void Add_Dim_Name_GPM() ;
930  void Add_Dim_Name_Mea_SeaWiFS() ;
931  void Handle_UseDimscale_Var_Dim_Names_Mea_SeaWiFS_Ozone(Var*) ;
932  void Add_UseDimscale_Var_Dim_Names_Mea_SeaWiFS_Ozone(Var *, Attribute*) ;
933 
934  void Add_Dim_Name_Mea_Ozonel3z() ;
935  bool check_cv(std::string & varname) ;
936 
937  void Add_Dim_Name_Aqu_L3() ;
938  void Add_Dim_Name_OBPG_L3() ;
939  void Add_Dim_Name_OSMAPL2S() ;
940  void Add_Dim_Name_ACOS_L2S_OCO2_L1B() ;
941 
942  void Add_Dim_Name_General_Product() ;
943  void Check_General_Product_Pattern() ;
944  bool Check_Dimscale_General_Product_Pattern() ;
945  bool Check_LatLon2D_General_Product_Pattern() ;
946  bool Check_LatLon2D_General_Product_Pattern_Name_Size(const std::string& latname, const std::string& lonname)
947  ;
948  bool Check_LatLon1D_General_Product_Pattern() ;
949  bool Check_LatLon1D_General_Product_Pattern_Name_Size(const std::string& latname, const std::string& lonname)
950  ;
951 
952  bool Check_LatLon_With_Coordinate_Attr_General_Product_Pattern() ;
953  void Build_lat1D_latlon_candidate(Var*, const std::vector<Var*>&);
954  void Build_latg1D_latlon_candidate(Var*, const std::vector<Var*>&);
955  void Build_unique_latlon_candidate();
956  void Add_Dim_Name_LatLon1D_Or_CoordAttr_General_Product() ;
957  void Add_Dim_Name_LatLon2D_General_Product() ;
958  void Add_Dim_Name_Dimscale_General_Product() ;
959  void Handle_UseDimscale_Var_Dim_Names_General_Product(Var*) ;
960  void Add_UseDimscale_Var_Dim_Names_General_Product(Var*, Attribute*) ;
961 
962  // Check if we have 2-D lat/lon CVs, and if yes, add those to the CV list.
963  void Update_M2DLatLon_Dimscale_CVs() ;
964  bool Check_1DGeolocation_Dimscale() ;
965  void Obtain_1DLatLon_CVs(std::vector<GMCVar*> &cvar_1dlat, std::vector<GMCVar*> &cvar_1dlon);
966  void Obtain_2DLatLon_Vars(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
967  std::map<std::string, int>&latlon2d_path_to_index);
968  void Obtain_2DLLVars_With_Dims_not_1DLLCVars(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
969  std::vector<GMCVar*> &cvar_1dlat, std::vector<GMCVar*> &cvar_1dlon, std::map<std::string, int>&latlon2d_path_to_index);
970  void Obtain_2DLLCVar_Candidate(std::vector<Var*> &var_2dlat, std::vector<Var*> &var_2dlon,
971  std::map<std::string, int>&latlon2d_path_to_index) ;
972  void Obtain_unique_2dCV(std::vector<Var*>&, std::map<std::string, int>&);
973  void Remove_2DLLCVar_Final_Candidate_from_Vars(std::vector<int>&) ;
974 
975  void Handle_CVar_GPM_L1() ;
976  void Handle_CVar_GPM_L3() ;
977  void Handle_CVar_Mea_SeaWiFS() ;
978  void Handle_CVar_Aqu_L3() ;
979  void Handle_CVar_OBPG_L3() ;
980  void Handle_CVar_OSMAPL2S() ;
981  void Handle_CVar_Mea_Ozone() ;
982  void Handle_SpVar_ACOS_OCO2() ;
983  void Handle_CVar_Dimscale_General_Product() ;
984  void Handle_CVar_LatLon2D_General_Product() ;
985  void Handle_CVar_LatLon1D_General_Product() ;
986  void Handle_CVar_LatLon_General_Product() ;
987 
988  void Adjust_Mea_Ozone_Obj_Name() ;
989  void Adjust_GPM_L3_Obj_Name() ;
990 
991  void Handle_GMCVar_NameClashing(std::set<std::string> &) ;
992  void Handle_GMCVar_AttrNameClashing() ;
993  void Handle_GMSPVar_NameClashing(std::set<std::string> &) ;
994  void Handle_GMSPVar_AttrNameClashing() ;
995  template<typename T> void GMHandle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec)
996  ;
997 
998  std::string get_CF_string(std::string s);
999 
1000  // The following routines are for generating coordinates attributes for netCDF-4 like 2D-latlon cases.
1001  bool Check_Var_2D_CVars(Var*) ;
1002  bool Flatten_VarPath_In_Coordinates_Attr(Var*) ;
1003  //bool Flatten_VarPath_In_Coordinates_Attr_EOS5(Var*) ;
1004  void Handle_LatLon_With_CoordinateAttr_Coor_Attr() ;
1005  bool Coord_Match_LatLon_NameSize(const std::string & coord_values) ;
1006  bool Coord_Match_LatLon_NameSize_Same_Group(const std::string & coord_values, const std::string &var_path) ;
1007  void Add_VarPath_In_Coordinates_Attr(Var*, const std::string &);
1008 
1009  // The following three routines handle the GPM CF-related attributes
1010  void Handle_GPM_l1_Coor_Attr() ;
1011  void Correct_GPM_L1_LatLon_units(Var *var, const std::string unit_value) ;
1012  void Add_GPM_Attrs() ;
1013 
1014  void Add_Aqu_Attrs() ;
1015  void Add_SeaWiFS_Attrs() ;
1016  void Create_Missing_CV(GMCVar*, const std::string &) ;
1017 
1018  bool Is_netCDF_Dimension(Var *var) ;
1019 
1020  void Gen_Unsupported_Dtype_Info(bool);
1021  void Gen_VarAttr_Unsupported_Dtype_Info() ;
1022  void Gen_GM_VarAttr_Unsupported_Dtype_Info();
1023  void Gen_Unsupported_Dspace_Info() ;
1024  void Handle_GM_Unsupported_Dtype(bool) ;
1025  void Handle_GM_Unsupported_Dspace(bool) ;
1026 
1027  bool Remove_EOS5_Strings(std::string &);
1028  bool Remove_EOS5_Strings_NonEOS_Fields (std::string &);
1029  void release_standalone_GMCVar_vector(std::vector<GMCVar*> &tempgc_vars);
1030 
1031 private:
1032  H5GCFProduct product_type;
1033  GMPattern gproduct_pattern;
1034  std::vector<GMCVar *> cvars;
1035  std::vector<GMSPVar *> spvars;
1036  std::string gp_latname;
1037  std::string gp_lonname;
1038  std::set<std::string> grp_cv_paths;
1039  std::vector<struct Name_Size_2Pairs> latloncv_candidate_pairs;
1040  //"map<string,string>dimcvars_2dlatlon"
1041  bool iscoard;
1042 #if 0
1043  bool ll2d_no_cv;
1044 #endif
1045  bool have_nc4_non_coord;
1046 
1047 };
1048 
1050 class EOS5CFGrid {
1051 public:
1052  EOS5CFGrid() :
1053  point_lower(0.0), point_upper(0.0), point_left(0.0), point_right(0.0),
1054  eos5_pixelreg(HE5_HDFE_CENTER), // may change later
1055  eos5_origin(HE5_HDFE_GD_UL), // may change later
1056  eos5_projcode(HE5_GCTP_GEO), //may change later
1057  zone(-1), sphere(0),
1058  addeddimindex(0),
1059  xdimsize(0), ydimsize(0),
1060  has_nolatlon(true), has_1dlatlon(false), has_2dlatlon(false), has_g2dlatlon(false)
1061  {
1062  std::fill_n(param, 13, 0);
1063  }
1064 
1065  ~EOS5CFGrid()
1066  {
1067  }
1068 
1069 protected:
1070  void Update_Dimnamelist();
1071 
1072 private:
1073  float point_lower;
1074  float point_upper;
1075  float point_left;
1076  float point_right;
1077  EOS5GridPRType eos5_pixelreg;
1078  EOS5GridOriginType eos5_origin;
1079  EOS5GridPCType eos5_projcode;
1080 
1081  double param[13];
1082  int zone;
1083  int sphere;
1084 
1085  std::vector<std::string> dimnames;
1086  std::set<std::string> vardimnames;
1087  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1088 
1089  // Unlimited dim. info
1090  std::map<std::string, bool> dimnames_to_unlimited;
1091 
1092  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1093  int addeddimindex;
1094 
1095  std::map<std::string, std::string> dnames_to_1dvnames;
1096  std::string name;
1097  int xdimsize;
1098  int ydimsize;
1099  bool has_nolatlon;
1100  bool has_1dlatlon;
1101  bool has_2dlatlon;
1102  bool has_g2dlatlon;
1103 
1104  friend class EOS5File;
1105 };
1106 
1109 public:
1110  EOS5CFSwath() :
1111  addeddimindex(0), has_nolatlon(true), has_1dlatlon(false), has_2dlatlon(false), has_g2dlatlon(false)
1112  {
1113  }
1114 
1115  ~EOS5CFSwath()
1116  {
1117  }
1118 
1119 private:
1120 
1121  std::vector<std::string> dimnames;
1122  std::set<std::string> vardimnames;
1123  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1124 
1125  // Unlimited dim. info
1126  std::map<std::string, bool> dimnames_to_unlimited;
1127 
1128  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1129  int addeddimindex;
1130 
1131  std::map<std::string, std::string> dnames_to_geo1dvnames;
1132  std::string name;
1133  bool has_nolatlon;
1134  bool has_1dlatlon;
1135  bool has_2dlatlon;
1136  bool has_g2dlatlon;
1137 
1138  friend class EOS5File;
1139 };
1140 
1142 class EOS5CFZa {
1143 public:
1144  EOS5CFZa() :
1145  addeddimindex(0)
1146  {
1147  }
1148 
1149  ~EOS5CFZa()
1150  {
1151  }
1152 
1153 private:
1154 
1155  std::vector<std::string> dimnames;
1156  std::set<std::string> vardimnames;
1157  std::map<std::string, hsize_t> dimnames_to_dimsizes;
1158  // Unlimited dim. info
1159  std::map<std::string, bool> dimnames_to_unlimited;
1160 
1161  std::map<hsize_t, std::string> dimsizes_to_dimnames;
1162  int addeddimindex;
1163 
1164  std::map<std::string, std::string> dnames_to_1dvnames;
1165  std::string name;
1166 
1167  friend class EOS5File;
1168 };
1169 
1171 class EOS5File: public File {
1172 public:
1173  EOS5File(const char*he5_path, hid_t file_id) :
1174  File(he5_path, file_id), iscoard(false), grids_multi_latloncvs(false), isaura(false), aura_name(NOTAURA),
1175  orig_num_grids(0)
1176  {
1177  }
1178 
1179  virtual ~EOS5File();
1180 public:
1181 
1183  const std::vector<EOS5CVar *>&getCVars() const
1184  {
1185  return this->cvars;
1186  }
1187 
1189  void Retrieve_H5_Info(const char *path, hid_t file_id, bool include_attr);
1190 
1193 
1196 
1198  void Handle_Unsupported_Dtype(bool) ;
1199 
1201  void Handle_Unsupported_Dspace(bool);
1202 
1204  void Handle_Unsupported_Others(bool) ;
1205 
1207  void Adjust_EOS5Dim_Info(HE5Parser*strmeta_info) ;
1208 
1210  void Add_EOS5File_Info(HE5Parser*, bool) ;
1211 
1214 
1216  void Adjust_Obj_Name() ;
1217 
1219  void Add_Dim_Name(HE5Parser *) ;
1220 
1222  void Check_Aura_Product_Status() ;
1223 
1225  void Handle_CVar() ;
1226 
1228  void Handle_SpVar() ;
1229 
1231  void Handle_SpVar_Attr() ;
1232 
1235 
1237  void Flatten_Obj_Name(bool include_attr) ;
1238 
1240  void Set_COARDS_Status() ;
1241 
1243  void Adjust_Attr_Info() ;
1244 
1246  void Handle_Obj_NameClashing(bool) ;
1247 
1249  void Add_Supplement_Attrs(bool) ;
1250 
1252  void Handle_Coor_Attr();
1253 
1255  void Adjust_Dim_Name() ;
1256 
1257  void Handle_DimNameClashing() ;
1258 
1260  bool Have_Grid_Mapping_Attrs();
1261 
1263  void Handle_Grid_Mapping_Vars();
1264 
1265 
1267  {
1268  return check_ignored;
1269  }
1270 
1271  const std::string& Get_Ignored_Msg()
1272  {
1273  return ignored_msg;
1274  }
1275 
1276 protected:
1277  void Adjust_H5_Attr_Value(Attribute *attr) ;
1278 
1279  void Adjust_EOS5Dim_List(std::vector<HE5Dim>&) ;
1280  void Condense_EOS5Dim_List(std::vector<HE5Dim>&) ;
1281  void Remove_NegativeSizeDims(std::vector<HE5Dim>&) ;
1282  void Adjust_EOS5DimSize_List(std::vector<HE5Dim>&,const std::vector<HE5Var>&, const EOS5Type,const std::string & eos5objname);
1283  void Adjust_EOS5VarDim_Info(std::vector<HE5Dim>&, std::vector<HE5Dim>&, const std::string &, EOS5Type) ;
1284 
1285  void EOS5Handle_nonlatlon_dimcvars(std::vector<HE5Var> & eos5varlist, EOS5Type, std::string groupname,
1286  std::map<std::string, std::string>& dnamesgeo1dvnames) ;
1287  template<class T> void EOS5SwathGrid_Set_LatLon_Flags(T* eos5gridswath, std::vector<HE5Var>& eos5varlist)
1288  ;
1289 
1290  void Obtain_Var_NewName(Var*) ;
1291  EOS5Type Get_Var_EOS5_Type(Var*) ;
1292 
1293  bool Obtain_Var_Dims(Var*, HE5Parser*) ;
1294  template<class T> bool Set_Var_Dims(T*, Var*, std::vector<HE5Var>&, const std::string&, int, EOS5Type) ;
1295  template<class T> void Create_Unique_DimName(T*, std::set<std::string>&, Dimension *, int, EOS5Type) ;
1296 
1297  template<class T> bool Check_All_DimNames(T*, std::string &, hsize_t);
1298  std::string Obtain_Var_EOS5Type_GroupName(Var*, EOS5Type) ;
1299  int Check_EOS5Swath_FieldType(Var*) ;
1300  void Get_Unique_Name(std::set<std::string>&, std::string&) ;
1301 
1302  template<class T> std::string Create_Unique_FakeDimName(T*, EOS5Type) ;
1303  template<class T> void Set_NonParse_Var_Dims(T*, Var*, std::map<hsize_t, std::string>&, int, EOS5Type) ;
1304 
1305  void Handle_Grid_CVar(bool) ;
1306  void Handle_Augmented_Grid_CVar() ;
1307  template<class T> void Handle_Single_Augment_CVar(T*, EOS5Type) ;
1308 
1309  void Handle_Multi_Nonaugment_Grid_CVar() ;
1310  void Handle_Single_Nonaugment_Grid_CVar(EOS5CFGrid*) ;
1311  bool Handle_Single_Nonaugment_Grid_CVar_OwnLatLon(EOS5CFGrid *, std::set<std::string>&) ;
1312  bool Handle_Single_Nonaugment_Grid_CVar_EOS5LatLon(EOS5CFGrid *, std::set<std::string>&) ;
1313  void Handle_NonLatLon_Grid_CVar(EOS5CFGrid *, std::set<std::string>&) ;
1314  void Remove_MultiDim_LatLon_EOS5CFGrid() ;
1315  void Adjust_EOS5GridDimNames(EOS5CFGrid *) ;
1316 
1317  void Handle_Swath_CVar(bool) ;
1318  void Handle_Single_1DLatLon_Swath_CVar(EOS5CFSwath *cfswath, bool is_augmented) ;
1319  void Handle_Single_2DLatLon_Swath_CVar(EOS5CFSwath *cfswath, bool is_augmented) ;
1320  void Handle_NonLatLon_Swath_CVar(EOS5CFSwath *cfswath, std::set<std::string>& tempvardimnamelist) ;
1321  void Handle_Special_NonLatLon_Swath_CVar(EOS5CFSwath *cfswath, std::set<std::string>&tempvardimnamelist) ;
1322 
1323  void Handle_Za_CVar(bool) ;
1324 
1325  bool Check_Augmentation_Status() ;
1326  // Don't remove the following commented if 0 line!
1327 #if 0
1328  //bool Check_Augmented_Var_Attrs(Var *var) throw(Exception);
1329 #endif
1330  template<class T> bool Check_Augmented_Var_Candidate(T*, Var*, EOS5Type) ;
1331 
1332  template<class T> void Adjust_Per_Var_Dim_NewName_Before_Flattening(T*, bool, int, int, int) ;
1333  void Adjust_SharedLatLon_Grid_Var_Dim_Name() ;
1334 
1335  void Adjust_Aura_Attr_Name() ;
1336  void Adjust_Aura_Attr_Value() ;
1337  void Handle_EOS5CVar_Unit_Attr() ;
1338  void Add_EOS5_Grid_CF_Attr() ;
1339  void Handle_Aura_Special_Attr() ;
1340 
1341  std::string get_CF_string(std::string s);
1342  void Replace_Var_Info(EOS5CVar *src, EOS5CVar *target);
1343  void Replace_Var_Attrs(EOS5CVar *src, EOS5CVar *target);
1344  void Handle_EOS5CVar_NameClashing(std::set<std::string> &) ;
1345  void Handle_EOS5CVar_AttrNameClashing() ;
1346  template<typename T> void EOS5Handle_General_NameClashing(std::set<std::string>&objnameset, std::vector<T*>& objvec)
1347  ;
1348  template<typename T> void Create_Missing_CV(T*, EOS5CVar*, const std::string &, EOS5Type, int) ;
1349  void Create_Added_Var_NewName_FullPath(EOS5Type, const std::string&, const std::string&, std::string &, std::string &) ;
1350 
1351  void Handle_EOS5_Unsupported_Dtype(bool) ;
1352  void Handle_EOS5_Unsupported_Dspace(bool) ;
1353 
1354  void Gen_Unsupported_Dtype_Info(bool);
1355  void Gen_VarAttr_Unsupported_Dtype_Info() ;
1356  void Gen_EOS5_VarAttr_Unsupported_Dtype_Info() ;
1357 
1358  void Gen_Unsupported_Dspace_Info() ;
1359 
1360 private:
1361  std::vector<EOS5CVar *> cvars;
1362  std::vector<EOS5CFGrid *> eos5cfgrids;
1363  std::vector<EOS5CFSwath *> eos5cfswaths;
1364  std::vector<EOS5CFZa *> eos5cfzas;
1365  std::map<std::string, std::string> eos5_to_cf_attr_map;
1366  bool iscoard;
1367  bool grids_multi_latloncvs;
1368  bool isaura;
1369  EOS5AuraName aura_name;
1370  int orig_num_grids;
1371  std::multimap<std::string, std::string> dimname_to_dupdimnamelist;
1372 };
1373 
1374 }
1375 #endif
HDF5CF::File::Adjust_Dim_Name
virtual void Adjust_Dim_Name()=0
Adjust dimension names based on different products.
HDF5CF::GMFile::Get_IgnoredInfo_Flag
bool Get_IgnoredInfo_Flag()
Obtain ignored info. flag.
Definition: HDF5CF.h:916
HDF5CF::EOS5File::Handle_Unsupported_Others
void Handle_Unsupported_Others(bool)
Handle other unmapped objects/attributes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:356
HDF5CF::File::Handle_Grid_Mapping_Vars
virtual void Handle_Grid_Mapping_Vars()
Handle Grid Mapping Vars.
Definition: HDF5CF.cc:2123
HDF5CF::File::getGroups
const std::vector< Group * > & getGroups() const
Public interface to obtain all the group info.
Definition: HDF5CF.h:670
HDF5CF::GMFile::Handle_Unsupported_Others
void Handle_Unsupported_Others(bool)
Handle other unmapped objects/attributes for general HDF5 products.
Definition: HDF5GMCF.cc:674
HDF5CF::EOS5File::getCVars
const std::vector< EOS5CVar * > & getCVars() const
Obtain coordinate variables for HDF-EOS5 products.
Definition: HDF5CF.h:1183
HDF5CF::File::root_attrs
std::vector< Attribute * > root_attrs
Root attribute vectors.
Definition: HDF5CF.h:790
HDF5CF::Var::getRank
int getRank() const
Get the dimension rank of this variable.
Definition: HDF5CF.h:295
HDF5CF::GMFile::Get_Ignored_Msg
const std::string & Get_Ignored_Msg()
Get the message that contains the ignored obj. info.
Definition: HDF5CF.h:922
HDF5CF::EOS5File::Handle_Unsupported_Dtype
void Handle_Unsupported_Dtype(bool)
Handle unsupported HDF5 datatypes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:204
HDF5CF::EOS5CFSwath
This class simulates an HDF-EOS5 Swath.
Definition: HDF5CF.h:1108
HDF5CF::GMCVar
This class is a derived class of CVar. It represents a coordinate variable for general HDF5 files.
Definition: HDF5CF.h:415
HDF5CF::EOS5File::Adjust_EOS5Dim_Info
void Adjust_EOS5Dim_Info(HE5Parser *strmeta_info)
Adjust HDF-EOS5 dimension information.
Definition: HDFEOS5CF.cc:535
HDF5CF::GMFile::Handle_Unsupported_Dtype
void Handle_Unsupported_Dtype(bool)
Handle unsupported HDF5 datatypes for general HDF5 products.
Definition: HDF5GMCF.cc:384
HDF5CF::GMFile::Update_Product_Type
void Update_Product_Type()
Update "product type" attributes for general HDF5 products.
Definition: HDF5GMCF.cc:235
HDF5CF::File::Have_Grid_Mapping_Attrs
virtual bool Have_Grid_Mapping_Attrs()
Check if having Grid Mapping Attrs.
Definition: HDF5CF.cc:2103
HDF5CFUtil.h
This file includes several helper functions for translating HDF5 to CF-compliant.
HDF5CF::EOS5File::Adjust_Dim_Name
void Adjust_Dim_Name()
Adjust the dimension name for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3636
HDF5CF::File::getAttributes
const std::vector< Attribute * > & getAttributes() const
Public interface to obtain information of all attributes under the root group.
Definition: HDF5CF.h:664
HE5Parser.h
A class for parsing NASA HDF-EOS5 StructMetadata.
HDF5CF::EOS5CFGrid
This class simulates an HDF-EOS5 Grid. Currently only geographic projection is supported.
Definition: HDF5CF.h:1050
HDF5CF::EOS5File::Check_Aura_Product_Status
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:1712
HDF5CF::Var
This class represents one HDF5 dataset(CF variable)
Definition: HDF5CF.h:259
HDF5CF::EOS5CVar
This class is a derived class of CVar. It represents a coordinate variable for HDF-EOS5 files.
Definition: HDF5CF.h:438
HDF5CF::GMFile::Handle_Obj_NameClashing
void Handle_Obj_NameClashing(bool)
Handle object name clashing for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4873
HDF5CF::GMFile::Handle_SpVar_Attr
void Handle_SpVar_Attr()
Handle special variable attributes for general NASA HDF5 products.
Definition: HDF5GMCF.cc:6450
HDF5CF::GMFile::Handle_CVar
void Handle_CVar()
Handle coordinate variables for general NASA HDF5 products.
Definition: HDF5GMCF.cc:2768
HDF5CF::GMFile::Handle_DimNameClashing
void Handle_DimNameClashing()
Definition: HDF5GMCF.cc:4978
HDF5CF::File::Retrieve_H5_CVar_Supported_Attr_Values
virtual void Retrieve_H5_CVar_Supported_Attr_Values()=0
Retrieve coordinate variable attributes.
HDF5CF::File::getFileID
hid_t getFileID() const
Obtain the HDF5 file ID.
Definition: HDF5CF.h:646
HDF5CF::GMFile::Handle_Grid_Mapping_Vars
void Handle_Grid_Mapping_Vars()
Handle Grid Mapping Vars.
Definition: HDF5GMCF.cc:6749
HDF5CF::File::Handle_DimNameClashing
virtual void Handle_DimNameClashing()=0
HDF5CF::Var::getType
H5DataType getType() const
Get the data type of this variable(Not HDF5 datatype id)
Definition: HDF5CF.h:301
HDF5CF::EOS5File::Adjust_Var_Dim_NewName_Before_Flattening
void Adjust_Var_Dim_NewName_Before_Flattening()
Adjust variable dimension names before the flattening for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3030
HDF5GCFProduct.h
This file includes functions to identify different NASA HDF5 products. Current supported products inc...
HDF5CF::GMFile::Rename_NC4_NonCoordVars
void Rename_NC4_NonCoordVars()
Remove the _nc4_non_coord from the variable new names.
Definition: HDF5GMCF.cc:6801
HDF5CF::EOS5File::Handle_CVar
void Handle_CVar()
Handle coordinate variable for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1764
HDF5CF::EOS5File::Add_Dim_Name
void Add_Dim_Name(HE5Parser *)
Add the dimension name for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1316
HDF5CF::EOS5File::Handle_SpVar
void Handle_SpVar()
Handle special variables for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3965
HDF5CF::Dimension
This class repersents one dimension of an HDF5 dataset(variable).
Definition: HDF5CF.h:145
HDF5CF::Var::getNewName
const std::string & getNewName() const
Get the new name of this variable.
Definition: HDF5CF.h:277
HDF5CF::File::HaveUnlimitedDim
bool HaveUnlimitedDim() const
Has unlimited dimensions.
Definition: HDF5CF.h:676
HDF5CF::GMFile::Handle_Coor_Attr
void Handle_Coor_Attr()
Handle "coordinates" attributes for general HDF5 products.
Definition: HDF5GMCF.cc:5820
HDF5CF::GMFile::Add_Dim_Name
void Add_Dim_Name()
Add dimension name.
Definition: HDF5GMCF.cc:803
HDF5CF::GMFile
This class is a derived class of File. It includes methods applied to general HDF5 files only.
Definition: HDF5CF.h:821
HDF5CF::File::Adjust_Obj_Name
virtual void Adjust_Obj_Name()=0
Adjust object names based on different products.
HDF5CF::GMFile::Remove_Unused_FakeDimVars
void Remove_Unused_FakeDimVars()
Unsupported datatype array may generate FakeDim. Remove them.
Definition: HDF5GMCF.cc:6753
HDF5CF::CVar
This class is a derived class of Var. It represents a coordinate variable.
Definition: HDF5CF.h:350
HDF5CF::EOS5File::Handle_Obj_NameClashing
void Handle_Obj_NameClashing(bool)
Handle the object name clashing for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3230
HDF5CF::EOS5File::Adjust_Var_NewName_After_Parsing
void Adjust_Var_NewName_After_Parsing()
Adjust variable names for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:1224
HDF5CF::File::Handle_SpVar_Attr
virtual void Handle_SpVar_Attr()=0
Handle special variable attributes.
HDF5CF::Var::getName
const std::string & getName() const
Get the original name of this variable.
Definition: HDF5CF.h:271
HDF5CF::EOS5CFZa
This class simulates an HDF-EOS5 Zonal average object.
Definition: HDF5CF.h:1142
HDF5CF::File::Retrieve_H5_Var_Attr_Values
virtual void Retrieve_H5_Var_Attr_Values(Var *var)
Retrieve attribute values for a variable.
Definition: HDF5CF.cc:741
HDF5CF::File::Add_Supplement_Attrs
virtual void Add_Supplement_Attrs(bool)
Add supplemental attributes such as fullpath and original name.
Definition: HDF5CF.cc:1948
HDF5CF::File::groups
std::vector< Group * > groups
Non-root group vectors.
Definition: HDF5CF.h:793
HDF5CF::File::Retrieve_H5_Info
virtual void Retrieve_H5_Info(const char *path, hid_t file_id, bool)
Definition: HDF5CF.cc:168
HDF5CF::GMFile::Retrieve_H5_Supported_Attr_Values
void Retrieve_H5_Supported_Attr_Values()
Retrieve attribute values for the supported HDF5 datatypes for general HDF5 products.
Definition: HDF5GMCF.cc:332
HDF5CF::Exception::Exception
Exception(const std::string &msg)
Constructor.
Definition: HDF5CF.h:73
HDF5CF::EOS5File::Set_COARDS_Status
void Set_COARDS_Status()
Set COARDS flag.
Definition: HDFEOS5CF.cc:3380
HDF5CF::File::Handle_Unsupported_Dtype
virtual void Handle_Unsupported_Dtype(bool)
Handle unsupported HDF5 datatypes.
Definition: HDF5CF.cc:910
HDF5CF::GMFile::Adjust_H5_Attr_Value
void Adjust_H5_Attr_Value(Attribute *attr)
Adjust attribute values for general HDF5 products.
Definition: HDF5GMCF.cc:366
HDF5CF::EOS5File::Get_IgnoredInfo_Flag
bool Get_IgnoredInfo_Flag()
Obtain the flag to see if ignored objects should be generated.
Definition: HDF5CF.h:1266
HDF5CF::EOS5File::Handle_Grid_Mapping_Vars
void Handle_Grid_Mapping_Vars()
Handle Grid Mapping Vars.
Definition: HDFEOS5CF.cc:4131
HDF5CF::File::Handle_CVar
virtual void Handle_CVar()=0
Handle coordinate variables.
HDF5CF::Dimension::HaveUnlimitedDim
bool HaveUnlimitedDim() const
Has unlimited dimensions.
Definition: HDF5CF.h:161
HDF5CF::delete_elem
Definition: HDF5CF.h:134
HDF5CF::EOS5File::Adjust_Attr_Info
void Adjust_Attr_Info()
Adjust the attribute info for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3403
HDF5CF::File::Handle_SpVar
virtual void Handle_SpVar()=0
Handle special variables.
HDF5CF::File::vars
std::vector< Var * > vars
Var vectors.
Definition: HDF5CF.h:787
HDF5CF::EOS5File::Handle_DimNameClashing
void Handle_DimNameClashing()
Definition: HDFEOS5CF.cc:3315
HDF5CF::GMFile::Handle_Unsupported_Dspace
void Handle_Unsupported_Dspace(bool)
Handle unsupported HDF5 dataspaces for general HDF5 products.
Definition: HDF5GMCF.cc:577
HDF5CF::CVar::getCVType
CVType getCVType() const
Get the coordinate variable type of this variable.
Definition: HDF5CF.h:360
HE5Parser
Definition: HE5Parser.h:49
HDF5CF::Var::getCompRatio
int getCompRatio() const
Get the compression ratio of this dataset.
Definition: HDF5CF.h:318
HDF5CF::EOS5File
This class is a derived class of File. It includes methods applied to HDF-EOS5 files only.
Definition: HDF5CF.h:1171
HDF5CF::File::Handle_Unsupported_Dspace
virtual void Handle_Unsupported_Dspace(bool)
Handle unsupported HDF5 dataspaces for datasets.
Definition: HDF5CF.cc:1253
HDF5CF::EOS5File::Handle_Unsupported_Dspace
void Handle_Unsupported_Dspace(bool)
Handle unsupported HDF5 dataspaces for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:297
HDF5CF::EOS5File::Retrieve_H5_CVar_Supported_Attr_Values
void Retrieve_H5_CVar_Supported_Attr_Values()
Retrieve coordinate variable attributes.
Definition: HDFEOS5CF.cc:166
HDF5CF::GMFile::Retrieve_H5_Info
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:216
HDF5CF::File::Flatten_Obj_Name
virtual void Flatten_Obj_Name(bool)
Flatten the object name.
Definition: HDF5CF.cc:1350
HDF5CF::File::dimsize_to_fakedimname
std::map< hsize_t, std::string > dimsize_to_fakedimname
Handle added dimension names.
Definition: HDF5CF.h:810
HDF5CF::File::getVars
const std::vector< Var * > & getVars() const
Public interface to obtain information of all variables.
Definition: HDF5CF.h:658
HDF5CF::EOS5File::Adjust_Obj_Name
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:4123
HDF5CF::EOS5File::Retrieve_H5_Supported_Attr_Values
void Retrieve_H5_Supported_Attr_Values()
Retrieve attribute values for the supported HDF5 datatypes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:182
HDF5CF::GMFile::Adjust_Obj_Name
void Adjust_Obj_Name()
Adjust object names based on different general NASA HDF5 products.
Definition: HDF5GMCF.cc:4730
HDF5CF::GMFile::Flatten_Obj_Name
void Flatten_Obj_Name(bool include_attr)
Flatten the object name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4815
HDF5CF::EOS5File::Get_Ignored_Msg
const std::string & Get_Ignored_Msg()
Obtain the message that contains the ignored object info.
Definition: HDF5CF.h:1271
HDF5CF::EOS5File::Handle_Coor_Attr
void Handle_Coor_Attr()
Handle the coordinates attribute for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3751
HDF5CF::GMFile::Add_Supplement_Attrs
void Add_Supplement_Attrs(bool)
Add supplemental attributes such as fullpath and original name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:5105
HDF5CF::EOS5File::Handle_SpVar_Attr
void Handle_SpVar_Attr()
Handle special variables for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:4087
HDF5CF::GMCVar::getPtType
H5GCFProduct getPtType() const
Get the data type of this variable.
Definition: HDF5CF.h:427
HDF5CF::GMFile::Handle_SpVar
void Handle_SpVar()
Handle special variables for general NASA HDF5 products.
Definition: HDF5GMCF.cc:4640
HDF5CF::Exception
Definition: HDF5CF.h:70
HDF5CF::Attribute
This class represents one attribute.
Definition: HDF5CF.h:189
HDF5CF::EOS5File::Retrieve_H5_Info
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:159
HDF5CF::File::getPath
const std::string & getPath() const
Obtain the path of the file.
Definition: HDF5CF.h:652
HDF5CF::EOS5File::Have_Grid_Mapping_Attrs
bool Have_Grid_Mapping_Attrs()
Check if having Grid Mapping Attrs.
Definition: HDFEOS5CF.cc:4128
HDF5CF::Var::getDimensions
const std::vector< Dimension * > & getDimensions() const
Get the list of the dimensions.
Definition: HDF5CF.h:312
HDF5CF::EOS5File::Add_EOS5File_Info
void Add_EOS5File_Info(HE5Parser *, bool)
Add HDF-EOS5 dimension and coordinate variable related info. to EOS5Grid,EOS5Swath etc.
Definition: HDFEOS5CF.cc:837
HDF5CF::File::Handle_Unsupported_Others
virtual void Handle_Unsupported_Others(bool)
Handle other unmapped objects/attributes.
Definition: HDF5CF.cc:1300
HDF5CF::GMFile::Retrieve_H5_CVar_Supported_Attr_Values
void Retrieve_H5_CVar_Supported_Attr_Values()
Retrieve coordinate variable attributes.
Definition: HDF5GMCF.cc:317
HDF5CF::GMFile::Have_Grid_Mapping_Attrs
bool Have_Grid_Mapping_Attrs()
Check if having Grid Mapping Attrs.
Definition: HDF5GMCF.cc:6745
HDF5CF::Group::getNewName
const std::string & getNewName() const
Get the new name of this group(flattened,name clashed checked)
Definition: HDF5CF.h:556
HDF5CF::GMFile::Adjust_Dim_Name
void Adjust_Dim_Name()
Adjust dimension name for general NASA HDF5 products.
Definition: HDF5GMCF.cc:5043
HDF5CF::GMFile::Remove_Unneeded_Objects
void Remove_Unneeded_Objects()
Remove unneeded objects.
Definition: HDF5GMCF.cc:257
HDF5CF::EOS5File::Flatten_Obj_Name
void Flatten_Obj_Name(bool include_attr)
Flatten the object name for HDF-EOS5 files.
Definition: HDFEOS5CF.cc:3208
HDF5CF::File::Handle_Coor_Attr
virtual void Handle_Coor_Attr()=0
Handle "coordinates" attributes.
HDF5CF::File::Retrieve_H5_Supported_Attr_Values
virtual void Retrieve_H5_Supported_Attr_Values()
Retrieve attribute values for the supported HDF5 datatypes.
Definition: HDF5CF.cc:722
HDF5CF::File::Get_Ignored_Msg
virtual const std::string & Get_Ignored_Msg()=0
Obtain the message that contains the ignored object info.
HDF5CF::File::Get_IgnoredInfo_Flag
virtual bool Get_IgnoredInfo_Flag()=0
Obtain the flag to see if ignored objects should be generated.
HDF5CF::EOS5File::Add_Supplement_Attrs
void Add_Supplement_Attrs(bool)
Add the supplemental attributes for HDF-EOS5 products.
Definition: HDFEOS5CF.cc:3666
HDF5CF::GMSPVar
This class is a derived class of Var. It represents a special general HDF5 product(currently ACOS and...
Definition: HDF5CF.h:380
HDF5CF::Var::getFullPath
const std::string & getFullPath() const
Get the full path of this variable.
Definition: HDF5CF.h:283
HDF5CF::Group::getPath
const std::string & getPath() const
Get the original path of this group.
Definition: HDF5CF.h:550
HDF5CF::File
This class retrieves all information from an HDF5 file.
Definition: HDF5CF.h:581
HDF5CF::Group
This class represents an HDF5 group. The group will be flattened according to the CF conventions.
Definition: HDF5CF.h:540