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