OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
HDFSP.h
Go to the documentation of this file.
1 // This file is part of the hdf4 data handler for the OPeNDAP data server.
12 // TRMM version 7 Level2
13 // TRMM version 7 Level3
23 
32 
33 
34 //#include "InternalErr.h"
35 #ifndef _HDFSP_H
36 #define _HDFSP_H
37 
38 #include <iostream>
39 #include <sstream>
40 #include <string>
41 #include <vector>
42 #include <map>
43 #include <set>
44 #include <list>
45 #include "mfhdf.h"
46 #include "hdf.h"
47 
48 #include "HDFSPEnumType.h"
49 
50 #define MAX_FULL_PATH_LEN 1024
51 //#define EOS_DATA_PATH "Data Fields"
52 //#define EOS_GEO_PATH "Geolocation Fields"
53 
54 #define _HDF_CHK_TBL_CLASS "_HDF_CHK_TBL_"
55 #define CERE_META_NAME "CERES_metadata"
56 #define CERE_META_FIELD_NAME "LOCALGRANULEID"
57 #define SENSOR_NAME "Sensor Name"
58 #define PRO_NAME "Product Name"
59 #define CER_AVG_NAME "CER_AVG"
60 #define CER_ES4_NAME "CER_ES4"
61 #define CER_CDAY_NAME "CER_ISCCP-D2like-Day"
62 #define CER_CGEO_NAME "CER_ISCCP-D2like-GEO"
63 #define CER_SRB_NAME "CER_SRBAVG3"
64 #define CER_SYN_NAME "CER_SYN"
65 #define CER_ZAVG_NAME "CER_ZAVG"
66 
67 
82 
83 
84 
85 namespace HDFSP
86 {
89  class File;
90  class SD;
91  class VDATA;
92 
93  class Exception:public std::exception
94  {
95  public:
96 
98  Exception (const std::string & msg)
99  : message (msg)
100  {
101  }
102 
104  virtual ~ Exception () throw ()
105  {
106  }
107 
109  virtual const char *what () const throw ()
110  {
111  return this->message.c_str ();
112  }
113 
115  virtual void setException (std::string message)
116  {
117  this->message = message;
118  }
119 
120 
121  protected:
123  std::string message;
124  };
125 
126 
129  class Dimension
130  {
131  public:
132 
134  const std::string & getName () const
135  {
136  return this->name;
137  }
138 
140  int32 getSize () const
141  {
142  return this->dimsize;
143  }
144 
147  int32 getType () const
148  {
149  return this->dimtype;
150  }
151 
152  protected:
153  Dimension (const std::string & name, int32 dimsize, int32 dimtype)
154  : name (name), dimsize (dimsize), dimtype (dimtype)
155  {
156  }
157 
158  protected:
159 
160  // dimension name
161  std::string name;
162 
163  // dimension size
164  int32 dimsize;
165 
167  int32 dimtype;
168 
169  friend class SD;
170  friend class File;
171  friend class SDField;
172  };
173 
175  class Attribute
176  {
177  public:
178 
180  const std::string & getName () const
181  {
182  return this->name;
183  }
184 
186  const std::string & getNewName () const
187  {
188  return this->newname;
189  }
190 
192  int32 getType () const
193  {
194  return this->type;
195  }
196 
198  int32 getCount () const
199  {
200  return this->count;
201  }
202 
204  const std::vector < char >&getValue () const
205  {
206  return this->value;
207  }
208 
209  protected:
210 
212  std::string name;
213 
215  std::string newname;
216 
218  int32 type;
219 
221  int32 count;
222 
224  std::vector < char >value;
225 
226  friend class SD;
227  friend class VDATA;
228  friend class File;
229  friend class Field;
230  friend class VDField;
231  };
232 
238  public:
240  {
241  }
242  ~AttrContainer();
243 
244  public:
245 
247  const std::string & getName () const
248  {
249  return this->name;
250  }
251 
254  // const std::string & getNewName () const
255  //{
256  // return this->newname;
257  //}
258 
259  const std::vector < Attribute * >&getAttributes () const
260  {
261  return this->attrs;
262  }
263 
264  protected:
265  // std:: string newname;
266 
267  // The name of this attribute container(an attribute container is a DAP DAS table)
268  std:: string name;
269 
270  // The attributes in this attribute container
271  std::vector < Attribute * >attrs;
272  friend class SD;
273  friend class File;
274 
275  };
276 
277 
278  // This field class describes SDS or Vdata fields.
279  class Field
280  {
281  public:
282  Field ():type (-1), rank (-1)
283  {
284  }
285  ~Field ();
286 
287  public:
288 
290  const std::string & getName () const
291  {
292  return this->name;
293  }
294 
296  const std::string & getNewName () const
297  {
298  return this->newname;
299  }
300 
302  int32 getRank () const
303  {
304  return this->rank;
305  }
306 
308  int32 getType () const
309  {
310  return this->type;
311  }
312 
314  const std::vector < Attribute * >&getAttributes () const
315  {
316  return this->attrs;
317  }
318 
319 
320  protected:
321 
323  std::string newname;
324 
326  std::string name;
327 
329  int32 type;
330 
332  int32 rank;
333 
335  std::vector < Attribute * >attrs;
336 
337  friend class SD;
338  friend class VDATA;
339  friend class File;
340  };
341 
343 
344  class SDField:public Field
345  {
346  public:
348  :fieldtype (0), fieldref (-1), condenseddim (false),is_noscale_dim(false),is_dim_scale(false)
349  {
350  }
351  ~SDField ();
352 
353  public:
354 
355 
357  const std::vector < Dimension * >&getCorrectedDimensions () const
358  {
359  return this->correcteddims;
360  }
361 
363  std::vector < Dimension * >*getCorrectedDimensionsPtr ()
364  {
365  return &(this->correcteddims);
366  }
367 
369  void setCorrectedDimensions (std::vector < Dimension * >dims)
370  {
372  }
373 
375  const std::string getCoordinate () const
376  {
377  return this->coordinates;
378  }
379 
381  void setCoordinates (std::string coor)
382  {
383  coordinates = coor;
384  }
385 
387  const std::string getUnits () const
388  {
389  return this->units;
390  }
391 
392  // Set the "units" attribute
393  void setUnits (std::string uni)
394  {
395  units = uni;
396  }
397 
398  // Get the field type
399  const int getFieldType () const
400  {
401  return this->fieldtype;
402  }
403 
404  // Get the SDS reference number
405  int32 getFieldRef () const
406  {
407  return this->fieldref;
408  }
409 
411  const std::vector < Dimension * >&getDimensions () const
412  {
413  return this->dims;
414  }
415 
417  const std::vector < AttrContainer * >&getDimInfo () const
418  {
419  return this->dims_info;
420  }
421 
422 
424  bool IsDimNoScale() const
425  {
426  return is_noscale_dim;
427  }
428 
430  bool IsDimScale() const
431  {
432  return is_dim_scale;
433  }
434 
436  const std::string getSpecFullPath() const
437  {
439  }
440  protected:
441 
443  std::vector < Dimension * >dims;
444 
448  std::vector < Dimension * >correcteddims;
449 
451  std::vector<AttrContainer *>dims_info;
452 
453  std::string coordinates;
454 
462 
464  std::string units;
465 
477 
479  int32 fieldref;
480 
483 
487 
490 
493  std::string rootfieldname;
494 
495  friend class File;
496  friend class SD;
497  };
498 
500  class VDField:public Field
501  {
502  public:
503  VDField ():order (-1), numrec (-1), size (-1)
504  {
505  }
506  ~VDField ();
507 
508  public:
509 
511  int32 getFieldOrder ()const
512  {
513  return this->order;
514  }
515 
517  int32 getFieldsize () const
518  {
519  return this->size;
520  }
521 
523  int32 getNumRec () const
524  {
525  return this->numrec;
526  }
527 
529  const std::vector < char >&getValue () const
530  {
531  return this->value;
532  }
533 
535  void ReadAttributes (int32 vdata_id, int32 fieldindex) throw (Exception);
536 
537  protected:
538 
540  int32 order;
541 
543  int32 numrec;
544 
546  int32 size;
547 
549  std::vector < char >value;
550 
551  friend class File;
552  friend class VDATA;
553  };
554 
556  class SD
557  {
558  public:
559 
561  static SD *Read (int32 sdfileid, int32 hfileid) throw (Exception);
562 
564  static SD *Read_Hybrid (int32 sdfileid, int32 hfileid) throw (Exception);
565 
567  const std::string & getPath () const
568  {
569  return this->path;
570  }
571 
573  const std::vector < SDField * >&getFields () const
574  {
575  return this->sdfields;
576  }
577 
579  const std::vector < Attribute * >&getAttributes () const
580  {
581  return this->attrs;
582  }
583 
585  void obtain_noneos2_sds_path(int32,char*,int32) throw(Exception);
586 
587 
589  ~SD ();
590 
591  protected:
592  SD (int32 sdfileid, int32 hfileid)
593  : sdfd (sdfileid), fileid (hfileid)
594  {
595  }
596 
597  protected:
598 
600  std::string path;
601 
603  std::vector < SDField * >sdfields;
604 
606  std::vector < Attribute * >attrs;
607 
609  std::list <int32> sds_ref_list;
610 
612  std::map < int32, int >refindexlist;
613 
616  std::map < std::string, int32 > n1dimnamelist;
617 
619  std::map < std::string, std::string > n2dimnamelist;
620 
622  std::set < std::string > fulldimnamelist;
623 
627  std::set < std::string > nonmisscvdimnamelist;
628 
630  std::map < std::string, std::string > dimcvarlist;
631 
632  private:
633 
635  int32 sdfd;
637  int32 fileid;
638  friend class File;
639  };
640 
642  class VDATA
643  {
644  public:
645 
646  ~VDATA ();
647 
649  static VDATA *Read (int32 vdata_id, int32 obj_ref) throw (Exception);
650 
652  void ReadAttributes (int32 vdata_id) throw (Exception);
653 
655  const std::string & getNewName () const
656  {
657  return this->newname;
658  }
659 
661  const std::string & getName () const
662  {
663  return this->name;
664  }
665 
667  const std::vector < VDField * >&getFields () const
668  {
669  return this->vdfields;
670  }
671 
673  const std::vector < Attribute * >&getAttributes () const
674  {
675  return this->attrs;
676  }
677 
681  bool getTreatAsAttrFlag () const
682  {
683  return TreatAsAttrFlag;
684  }
685 
687  int32 getObjRef () const
688  {
689  return vdref;
690  }
691 
692  protected:
693  VDATA (int32 vdata_myid, int32 obj_ref)
694  :vdref(obj_ref),TreatAsAttrFlag (true),vdata_id (vdata_myid) {
695  }
696 
697  protected:
698 
700  std::string newname;
701 
703  std::string name;
704 
706  std::vector < VDField * >vdfields;
707 
709  std::vector < Attribute * >attrs;
710 
712  int32 vdref;
713 
716 
717  private:
718 
720  int32 vdata_id;
721 
722  friend class File;
723  };
724 
727  class File
728  {
729  public:
730 
732  static File *Read (const char *path, int32 sdid,int32 fileid) throw (Exception);
733 
736  static File *Read_Hybrid (const char *path, int32 sdid,
737  int32 fileid) throw (Exception);
738 
742  void Prepare() throw(Exception);
743 
744  bool Check_update_special(const std::string &gridname) throw(Exception);
745 
746  void Handle_AIRS_L23() throw(Exception);
747 
748 
750  SPType getSPType () const
751  {
752  return this->sptype;
753  }
754 
756 
758  {
759  return this->OTHERHDF_Has_Dim_NoScale_Field;
760  }
761 
762  // Destructor
763  ~File ();
764 
766  const std::string & getPath () const
767  {
768  return this->path;
769  }
770 
772  SD *getSD () const
773  {
774  return this->sd;
775  }
776 
778  const std::vector < VDATA * >&getVDATAs () const
779  {
780  return this->vds;
781  }
782 
784  const std::vector<AttrContainer *> &getVgattrs () const
785  {
786  return this->vg_attrs;
787  }
788 
789 
790 
791  protected:
792  File (const char *path)
793  : path (path), sdfd (-1), fileid (-1), sptype (OTHERHDF),OTHERHDF_Has_Dim_NoScale_Field(false),EOS2Swathflag(false)
794  {
795  }
796 
797  protected:
798 
800  std::string path;
801 
803  SD *sd;
804 
806  std::vector < VDATA * >vds;
807 
809  std::vector<AttrContainer *>vg_attrs;
810 
813 
816  void handle_sds_fakedim_names() throw(Exception);
817 
820 
823 
825  void handle_sds_final_dim_names() throw(Exception);
826 
828  void handle_sds_names(bool & COARDFLAG , std::string & lldimname1, std::string &lldimname2) throw(Exception);
829 
831  void handle_sds_coords(bool & COARDFLAG, std::string &lldimname1,std::string &lldimname2) throw(Exception);
832 
834  void handle_vdata() throw(Exception);
835 
837  void CheckSDType () throw (Exception);
838 
840  void PrepareTRMML2_V6 () throw (Exception);
841 
843  void PrepareTRMML3A_V6 () throw (Exception);
844 
846  void PrepareTRMML3B_V6 () throw (Exception);
847 
849  void PrepareTRMML3C_V6 () throw (Exception);
850 
851 
852  void Obtain_TRMML3S_V7_latlon_size(int &latsize, int&lonsize) throw(Exception);
853  bool Obtain_TRMM_V7_latlon_name(const SDField* sdfield, const int latsize, const int lonsize, std::string& latname, std::string& lonname) throw(Exception);
854 
856  void PrepareTRMML2_V7 () throw (Exception);
857 
859  void PrepareTRMML3S_V7 () throw (Exception);
860 
862  void PrepareTRMML3M_V7 () throw (Exception);
863 
864 
867  void PrepareCERAVGSYN () throw (Exception);
868 
871  void PrepareCERES4IG () throw (Exception);
872 
876  void PrepareCERSAVGID () throw (Exception);
877 
879  void PrepareCERZAVG () throw (Exception);
880 
882  void PrepareOBPGL2 () throw (Exception);
883 
885  void PrepareOBPGL3 () throw (Exception);
886 
889  void PrepareMODISARNSS () throw (Exception);
890 
892  void PrepareOTHERHDF () throw (Exception);
893 
895  void ReadLoneVdatas(File*) throw(Exception);
896 
899  void ReadHybridNonLoneVdatas(File*) throw(Exception);
900 
902  void ReadVgattrs(int32 vgroup_id, char *fullpath) throw(Exception);
903 
905  void InsertOrigFieldPath_ReadVgVdata () throw (Exception);
906 
908  void obtain_path (int32 file_id, int32 sd_id, char *full_path, int32 pobj_ref) throw (Exception);
909 
911  void obtain_vdata_path(int32 file_id, char *full_path, int32 pobj_ref) throw (Exception);
912 
913 
914  private:
915 
917  int32 sdfd;
918 
920  int32 fileid;
921 
923  SPType sptype;
924 
926  bool OTHERHDF_Has_Dim_NoScale_Field;
927 
930  bool EOS2Swathflag;
931  };
932 
933 }
934 
935 
936 #endif
const std::vector< VDATA * > & getVDATAs() const
Public interface to Obtain Vdata.
Definition: HDFSP.h:778
std::string special_product_fullpath
This string provides the full path of a field for some products that have long path. The reasons we provide this string is as follows: 1) Some products(CERES) contain many variables and some field paths may be very long. For example,a path in a CERES file is "/Monthly 3-Hourly Averages/D2-like 9 Cloud Types/Deep Convection (High, Thick)/Ice Water Path - Deep Convection - MH". There are almost a 100 variables like this long path in this file. This will make DDS and DAS containers very huge and choke netCDF Java clients. So to avoid such cases, we provide a BES key so that by default only short names are provided. However, we still want to preserve the original path. So we include this special_product_fullpath to record this and output to DAS. 2) We decide not to use newname since as shown above, the CF form of the path is very different than the original path. KY 2013-07-02.
Definition: HDFSP.h:476
std::vector< VDATA * > vds
Vdata objects in this file.
Definition: HDFSP.h:806
File(const char *path)
Definition: HDFSP.h:792
std::string name
Original vdata name.
Definition: HDFSP.h:703
virtual ~Exception()
Destructor.
Definition: HDFSP.h:104
void PrepareCERSAVGID()
Special method to prepare CERES SAVG (CER_SAVG_???) and CERES ISCCP DAYLIKE(CER_ISCCP__???DAYLIKE) latitude and longitude information. Essentially nested CERES 2-d lat/lon need to be provided. https://eosweb.larc.nasa.gov/sites/default/files/project/ceres/quality_summaries/srbavg_ed2d/nestedgrid.pdf.
Definition: HDFSP.cc:5785
void Handle_AIRS_L23()
Definition: HDFSP.cc:969
const std::string & getName() const
Get the name of this attribute container.
Definition: HDFSP.h:247
void setCorrectedDimensions(std::vector< Dimension * >dims)
Set the list of the corrected dimensions.
Definition: HDFSP.h:369
int32 getSize() const
Get dimension size.
Definition: HDFSP.h:140
std::vector< AttrContainer * > vg_attrs
Vgroup attribute information. See the description of the class AttrContainer.
Definition: HDFSP.h:809
std::map< std::string, std::string > dimcvarlist
dimension name to coordinate variable name list: the key list to generate CF "coordinates" attributes...
Definition: HDFSP.h:630
int32 count
The number of elements.
Definition: HDFSP.h:221
int32 getRank() const
Get the dimension rank of this field.
Definition: HDFSP.h:302
void PrepareCERAVGSYN()
Special method to prepare CERES AVG (CER_AVG_???) and CERES SYN(CER_SYN_???) latitude and longitude i...
Definition: HDFSP.cc:5573
std::string coordinates
Definition: HDFSP.h:453
const std::vector< AttrContainer * > & getDimInfo() const
Get the list of OHTERHDF dimension attribute container information.
Definition: HDFSP.h:417
void ReadHybridNonLoneVdatas(File *)
Handle non-attribute non-lone vdatas. Note: this function is only used for handling hybrid Vdata func...
Definition: HDFSP.cc:527
static SD * Read_Hybrid(int32 sdfileid, int32 hfileid)
Read the information of all hybrid SDS objects from the HDF4 file.
Definition: HDFSP.cc:1901
void handle_sds_coords(bool &COARDFLAG, std::string &lldimname1, std::string &lldimname2)
Create "coordinates", "units" CF attributes.
Definition: HDFSP.cc:3843
void handle_sds_final_dim_names()
Create the final CF-compliant dimension name list for each field.
Definition: HDFSP.cc:3617
const std::vector< Attribute * > & getAttributes() const
Obtain Vdata attributes.
Definition: HDFSP.h:673
void ReadAttributes(int32 vdata_id, int32 fieldindex)
Read vdata field attributes.
Definition: HDFSP.cc:2537
void PrepareTRMML2_V6()
Latitude and longitude are stored in one array(geolocation). Need to separate.
Definition: HDFSP.cc:4803
const std::string & getName() const
Get the attribute name.
Definition: HDFSP.h:180
const std::vector< Dimension * > & getDimensions() const
Get the list of dimensions.
Definition: HDFSP.h:411
void handle_vdata()
Handle Vdata.
Definition: HDFSP.cc:3926
bool TreatAsAttrFlag
Flag to map vdata fields to DAP variables or DAP attributes.
Definition: HDFSP.h:715
std::vector< Attribute * > attrs
Vdata attribute vectors.
Definition: HDFSP.h:709
This class retrieves all information from an HDF4 file. It is a container for SDS and Vdata...
Definition: HDFSP.h:727
const std::string & getNewName() const
Get the CF name(special characters replaced by underscores) of this field.
Definition: HDFSP.h:296
STL namespace.
Exception(const std::string &msg)
Constructor.
Definition: HDFSP.h:98
This class retrieves all SDS objects and SD file attributes.
Definition: HDFSP.h:556
const std::string & getPath() const
Retrieve the absolute path of the file(full file name).
Definition: HDFSP.h:567
void PrepareTRMML3S_V7()
Special method to prepare TRMM single grid Level 3 geolocation fields(latitude,longitude,etc) information.
Definition: HDFSP.cc:4328
int32 getObjRef() const
Obtain Vdata reference number, this is necessary for retrieving Vdata information from HDF4...
Definition: HDFSP.h:687
void PrepareCERZAVG()
Special method to prepare CERES Zonal Average latitude and longitude information. ...
Definition: HDFSP.cc:5928
int32 type
Attribute type.
Definition: HDFSP.h:218
std::set< std::string > fulldimnamelist
Full dimension name list set.
Definition: HDFSP.h:622
std::string path
The full path of the file(file name).
Definition: HDFSP.h:600
void PrepareOBPGL3()
Special method to prepare OBPG Level 3 latitude and longitude information. The latitude and longitude...
Definition: HDFSP.cc:5449
std::vector< Dimension * > * getCorrectedDimensionsPtr()
Get the list of the corrected dimension ptrs.
Definition: HDFSP.h:363
std::vector< char > value
Vdata field value.
Definition: HDFSP.h:549
One instance of this class represents one Vdata field.
Definition: HDFSP.h:500
bool is_noscale_dim
Some fields have dimensions but don't have dimension scales. In HDF4, such dimension appears as a fie...
Definition: HDFSP.h:486
std::vector< Attribute * > attrs
The attributes of this field.
Definition: HDFSP.h:335
void PrepareTRMML3M_V7()
Special method to prepare TRMM multiple grid Level 3 geolocation fields(latitude,longitude,etc) information.
Definition: HDFSP.cc:4660
void setCoordinates(std::string coor)
Set the coordinate attribute.
Definition: HDFSP.h:381
void PrepareTRMML2_V7()
Latitude and longitude are stored in different fields. Need to separate.
Definition: HDFSP.cc:4179
std::string newname
The CF full path(special characters replaced by underscores) of this field.
Definition: HDFSP.h:323
bool IsDimNoScale() const
Is this field a dimension without dimension scale(or empty[no data]dimension variable) ...
Definition: HDFSP.h:424
Dimension(const std::string &name, int32 dimsize, int32 dimtype)
Definition: HDFSP.h:153
SD * getSD() const
Public interface to Obtain SD.
Definition: HDFSP.h:772
std::vector< AttrContainer * > dims_info
OTHERHDF dimension information. See the description of the class AttrContainer.
Definition: HDFSP.h:451
void PrepareTRMML3A_V6()
Special method to prepare TRMM Level 3A46 latitude and longitude information.
Definition: HDFSP.cc:5051
std::vector< char > value
Attribute values.
Definition: HDFSP.h:224
void ReadAttributes(int32 vdata_id)
Retrieve all attributes of this Vdata.
Definition: HDFSP.cc:2477
void setUnits(std::string uni)
Definition: HDFSP.h:393
int32 getType() const
If the SDS dimension scale is available, the returned value is dim. scale datatype. If there is no dimension scale, the returned value is 0.
Definition: HDFSP.h:147
const std::vector< char > & getValue() const
Get the attribute value.
Definition: HDFSP.h:204
int32 numrec
Number of record of the vdata field.
Definition: HDFSP.h:543
int32 getFieldOrder() const
Get the order of this field.
Definition: HDFSP.h:511
This class retrieves all information of one Vdata.
Definition: HDFSP.h:642
void PrepareMODISARNSS()
MODISARNSS is a special MODIS product saved as pure HDF4 files. Dimension names of different fields n...
Definition: HDFSP.cc:5979
bool Obtain_TRMM_V7_latlon_name(const SDField *sdfield, const int latsize, const int lonsize, std::string &latname, std::string &lonname)
Definition: HDFSP.cc:4155
const int getFieldType() const
Definition: HDFSP.h:399
int32 size
Vdata field size.
Definition: HDFSP.h:546
static VDATA * Read(int32 vdata_id, int32 obj_ref)
Retrieve all information of this Vdata.
Definition: HDFSP.cc:2312
const std::string getUnits() const
Get the "units" attribute.
Definition: HDFSP.h:387
std::vector< Dimension * > correcteddims
Corrected dimensions of this field. The only difference between the correcteddims and dims is the cor...
Definition: HDFSP.h:448
std::set< std::string > nonmisscvdimnamelist
This set stores non-missing coordinate variable dimension names. Many third dimensions of HDF4 files ...
Definition: HDFSP.h:627
One instance of this class represents one SDS object.
Definition: HDFSP.h:344
void handle_sds_missing_fields()
Add the missing coordinate variables based on the corrected dimension name list.
Definition: HDFSP.cc:3581
bool Check_update_special(const std::string &gridname)
Definition: HDFSP.cc:825
void Prepare()
The main step to make HDF4 SDS objects CF-complaint. All dimension(coordinate variables) information ...
Definition: HDFSP.cc:3974
int32 dimsize
Definition: HDFSP.h:164
bool getTreatAsAttrFlag() const
Some Vdata fields are very large in size. Some Vdata fields are very small. So we map smaller Vdata f...
Definition: HDFSP.h:681
void obtain_path(int32 file_id, int32 sd_id, char *full_path, int32 pobj_ref)
The internal function used by InsertOrigFieldPath_ReadVgVdata.
Definition: HDFSP.cc:2974
void PrepareTRMML3B_V6()
Special method to prepare TRMM Level 3B latitude and longitude information.
Definition: HDFSP.cc:4947
std::string units
The "units" attribute.
Definition: HDFSP.h:464
const std::string & getNewName() const
Get the CF attribute name(special characters are replaced by underscores)
Definition: HDFSP.h:186
TRMML2_V6: TRMM Level2 1B21,2A12,2B31,2A25 TRMML3A_V6: TRMM Level3 3A46 TRMML3C_V6: TRMM Level3 CSH T...
Definition: HDFSP.h:85
void create_sds_dim_name_list()
Create the new dimension name set and the dimension name to size map.
Definition: HDFSP.cc:3558
const std::string & getNewName() const
Obtain new names(with the path and special characters and name clashing handlings) ...
Definition: HDFSP.h:655
static SD * Read(int32 sdfileid, int32 hfileid)
Read the information of all SDS objects from the HDF4 file.
Definition: HDFSP.cc:1558
const std::vector< Attribute * > & getAttributes() const
No need to have the newname since we will make the name follow CF conventions Get the new name of thi...
Definition: HDFSP.h:259
static File * Read(const char *path, int32 sdid, int32 fileid)
Retrieve SDS and Vdata information from the HDF4 file.
Definition: HDFSP.cc:196
void obtain_vdata_path(int32 file_id, char *full_path, int32 pobj_ref)
The internal function used to obtain the path for hybrid non-lone vdata.
Definition: HDFSP.cc:3277
It repersents one dimension of an SDS or a VDATA. It holds the dimension name and the size of that di...
Definition: HDFSP.h:129
void handle_sds_fakedim_names()
Check name clashing for fields. Borrowed from HDFEOS.cc, unused. bool check_field_name_clashing (bool...
Definition: HDFSP.cc:3483
std::vector< Attribute * > attrs
Definition: HDFSP.h:271
int32 getFieldsize() const
Get the field size.
Definition: HDFSP.h:517
const std::string & getPath() const
Obtain the path of the file.
Definition: HDFSP.h:766
bool is_dim_scale
This is a SDS dimension scale.
Definition: HDFSP.h:489
int32 getNumRec() const
Get the number of record.
Definition: HDFSP.h:523
const std::string & getName() const
Get the name of this field.
Definition: HDFSP.h:290
static File * Read_Hybrid(const char *path, int32 sdid, int32 fileid)
Retrieve SDS and Vdata information from the hybrid HDF-EOS file. Currently we only support the access...
Definition: HDFSP.cc:249
std::map< std::string, std::string > n2dimnamelist
Original dimension name to corrected dimension name map.
Definition: HDFSP.h:619
void PrepareCERES4IG()
Special method to prepare CERES ES4 (CER_ES4_???) and CERES ISCCP GEO(CER_ISCCP__???GEO) latitude and longitude information. Essentially the lat/lon need to be condensed to 1-D for the geographic projection.
Definition: HDFSP.cc:5652
std::vector< Dimension * > dims
Dimensions of this field.
Definition: HDFSP.h:443
int32 getFieldRef() const
Definition: HDFSP.h:405
std::list< int32 > sds_ref_list
SDS reference number list.
Definition: HDFSP.h:609
std::string newname
CF attribute name(special characters are replaced by underscores)
Definition: HDFSP.h:215
std::string name
Definition: HDFSP.h:161
virtual const char * what() const
Return exception message.
Definition: HDFSP.h:109
int32 type
The datatype of this field.
Definition: HDFSP.h:329
void obtain_noneos2_sds_path(int32, char *, int32)
Obtain SDS path, this is like a clone of obtain_path in File class, except the Vdata and some minor p...
Definition: HDFSP.cc:3179
int32 vdref
Vdata reference number.
Definition: HDFSP.h:712
void handle_sds_names(bool &COARDFLAG, std::string &lldimname1, std::string &lldimname2)
Create the final CF-compliant field name list.
Definition: HDFSP.cc:3665
std::vector< SDField * > sdfields
SDS objects stored in vectors.
Definition: HDFSP.h:603
int32 getCount() const
Get the number of elements of this attribute.
Definition: HDFSP.h:198
virtual void setException(std::string message)
Set exception message.
Definition: HDFSP.h:115
const std::vector< VDField * > & getFields() const
Obtain Vdata fields.
Definition: HDFSP.h:667
std::string name
Original attribute name.
Definition: HDFSP.h:212
std::string name
Definition: HDFSP.h:268
std::string name
The original name of this field.
Definition: HDFSP.h:326
const std::vector< Attribute * > & getAttributes() const
Get the attributes of this field.
Definition: HDFSP.h:314
const std::vector< Attribute * > & getAttributes() const
Public interface to obtain the SD(file) attributes.
Definition: HDFSP.h:579
void ReadVgattrs(int32 vgroup_id, char *fullpath)
Obtain vgroup attributes.
Definition: HDFSP.cc:2598
SD * sd
Pointer to the SD instance. There is only one SD instance in an HDF4 file.
Definition: HDFSP.h:803
int32 fieldref
SDS reference number. This and the object tag are a key to identify a SDS object. ...
Definition: HDFSP.h:479
void PrepareOTHERHDF()
We still provide a hook for other HDF data product although no CF compliant is followed.
Definition: HDFSP.cc:6031
void PrepareTRMML3C_V6()
Special method to prepare TRMM Level 3 CSH latitude,longitude and Height information.
Definition: HDFSP.cc:5214
int32 dimtype
dimension scale datatype or 0 if no dimension scale.
Definition: HDFSP.h:167
int fieldtype
This flag will specify the fieldtype. 0 means this field is general field. 1 means this field is lat...
Definition: HDFSP.h:461
This class only applies to the OTHERHDF products when there are dimensions but not dimension scales...
Definition: HDFSP.h:237
void ReadLoneVdatas(File *)
Handle non-attribute lone vdatas.
Definition: HDFSP.cc:302
int32 order
Vdata field order.
Definition: HDFSP.h:540
std::map< int32, int > refindexlist
SDS reference number to index map, use to quickly obtain the SDS id.
Definition: HDFSP.h:612
int32 getType() const
Get the attribute datatype.
Definition: HDFSP.h:192
const std::vector< AttrContainer * > & getVgattrs() const
Get attributes for all vgroups.
Definition: HDFSP.h:784
const std::vector< Dimension * > & getCorrectedDimensions() const
Get the list of the corrected dimensions.
Definition: HDFSP.h:357
SPType getSPType() const
Obtain special HDF4 product type.
Definition: HDFSP.h:750
int32 rank
The rank of this field.
Definition: HDFSP.h:332
SPType
Definition: HDFSPEnumType.h:4
std::string path
The absolute path of the file.
Definition: HDFSP.h:800
std::vector< Attribute * > attrs
SD attributes stored in vectors.
Definition: HDFSP.h:606
void PrepareOBPGL2()
Special method to prepare OBPG Level 2 latitude and longitude information. The latitude and longitude...
Definition: HDFSP.cc:5364
std::vector< VDField * > vdfields
Vdata field vectors.
Definition: HDFSP.h:706
void Obtain_TRMML3S_V7_latlon_size(int &latsize, int &lonsize)
Definition: HDFSP.cc:4134
int32 getType() const
Get the data type of this field.
Definition: HDFSP.h:308
const std::string getSpecFullPath() const
This function returns the full path of some special products that have a very long path...
Definition: HDFSP.h:436
bool Has_Dim_NoScale_Field() const
This file has a field that is a SDS dimension but no dimension scale.
Definition: HDFSP.h:757
const std::string & getName() const
Obtain the original vdata name.
Definition: HDFSP.h:661
Representing one attribute in grid or swath.
Definition: HDFSP.h:175
const std::vector< SDField * > & getFields() const
Public interface to obtain information of all SDS vectors(objects).
Definition: HDFSP.h:573
const std::string getCoordinate() const
Get the "coordinates" attribute.
Definition: HDFSP.h:375
const std::vector< char > & getValue() const
Get the vdata field values.
Definition: HDFSP.h:529
std::string message
Exception message.
Definition: HDFSP.h:123
const std::string & getName() const
Get dimension name.
Definition: HDFSP.h:134
std::map< std::string, int32 > n1dimnamelist
Unique dimension name to its size map, may be replaced in the current implementation. Still leave it here for potential fakeDim handling in the future.
Definition: HDFSP.h:616
bool IsDimScale() const
Is this field a dimension scale field?
Definition: HDFSP.h:430
void CheckSDType()
This method will check if the HDF4 file is one of TRMM or OBPG products we supported.
Definition: HDFSP.cc:1249
VDATA(int32 vdata_myid, int32 obj_ref)
Definition: HDFSP.h:693
std::string newname
New name with path and CF compliant(no special characters and name clashing).
Definition: HDFSP.h:700
std::string rootfieldname
In some TRMM versions, latitude and longitude are combined into one field geolocation. This variable is to remember the root field for latitude and longitude.
Definition: HDFSP.h:493
bool condenseddim
condenseddim is to condense 2-D lat/lon to 1-D lat/lon for geographic projections. This can greatly reduce the access time of visualization clients.
Definition: HDFSP.h:482
void InsertOrigFieldPath_ReadVgVdata()
The full path of SDS and Vdata will be obtained.
Definition: HDFSP.cc:2649