bes
Updated for version 3.20.6
|
48 #include "HDFSPEnumType.h"
50 #define MAX_FULL_PATH_LEN 1024
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"
109 virtual const char *
what ()
const throw ()
111 return this->message.c_str ();
117 this->message = exception_message;
142 return this->dimsize;
149 return this->dimtype;
153 Dimension (
const std::string & dim_name, int32 hdf4_dimsize, int32 hdf4_dimtype)
154 : name (dim_name), dimsize (hdf4_dimsize), dimtype (hdf4_dimtype)
170 friend class SDField;
187 return this->newname;
223 std::vector < char >value;
272 std::vector < Attribute * >attrs;
349 :fieldtype (0), fieldref (-1), condenseddim (
false),is_noscale_dim(
false),is_dim_scale(
false)
353 special_product_fullpath=
"";
362 return this->correcteddims;
368 return &(this->correcteddims);
374 correcteddims = cor_dims;
380 return this->coordinates;
396 void setUnits (std::string uni)
402 int getFieldType ()
const
404 return this->fieldtype;
408 int32 getFieldRef ()
const
410 return this->fieldref;
422 return this->dims_info;
429 return is_noscale_dim;
441 return special_product_fullpath;
446 std::vector < Dimension * >dims;
451 std::vector < Dimension * >correcteddims;
454 std::vector<AttrContainer *>dims_info;
456 std::string coordinates;
479 std::string special_product_fullpath;
496 std::string rootfieldname;
506 VDField ():order (-1), numrec (-1), size (-1)
550 std::vector < char >value;
569 const std::string & getPath ()
const
596 SD (int32 sdfileid, int32 hfileid)
597 : sdfd (sdfileid), fileid (hfileid)
692 VDATA (int32 vdata_myid, int32 obj_ref)
743 bool Check_update_special(
const std::string &gridname)
throw(
Exception);
758 return this->OTHERHDF_Has_Dim_NoScale_Field;
791 explicit File (
const char *hdf4file_path)
792 :
path (hdf4file_path),
sd(NULL),sdfd (-1), fileid (-1), sptype (OTHERHDF),OTHERHDF_Has_Dim_NoScale_Field(false),EOS2Swathflag(false)
804 std::vector < VDATA * >
vds;
849 bool Obtain_TRMM_V7_latlon_name(const
SDField* sdfield, const
int latsize, const
int lonsize, std::
string& latname, std::
string& lonname) throw(
Exception);
904 void obtain_path (int32 file_id, int32 sd_id,
char *full_path, int32 pobj_ref) throw (
Exception);
922 bool OTHERHDF_Has_Dim_NoScale_Field;
const std::vector< Attribute * > & getAttributes() const
Public interface to obtain the SD(file) attributes.
const std::vector< VDATA * > & getVDATAs() const
Public interface to Obtain Vdata.
std::vector< VDField * > vdfields
Vdata field vectors.
int32 getFieldsize() const
Get the field size.
void PrepareTRMML3C_V6()
Special method to prepare TRMM Level 3 CSH latitude,longitude and Height information.
const std::vector< SDField * > & getFields() const
Redundant member function.
int32 getNumRec() const
Get the number of record.
void PrepareOBPGL2()
Special method to prepare OBPG Level 2 latitude and longitude information. The latitude and longitude...
std::map< std::string, std::string > dimcvarlist
dimension name to coordinate variable name list: the key list to generate CF "coordinates" attributes...
SD * sd
Pointer to the SD instance. There is only one SD instance in an HDF4 file.
const std::vector< Attribute * > & getAttributes() const
Obtain Vdata attributes.
const std::vector< Attribute * > & getAttributes() const
This class retrieves all SDS objects and SD file attributes.
One instance of this class represents one SDS object.
std::vector< Dimension * > * getCorrectedDimensionsPtr()
Get the list of the corrected dimension ptrs.
void setCorrectedDimensions(std::vector< Dimension * >cor_dims)
Set the list of the corrected dimensions.
void Obtain_TRMML3S_V7_latlon_size(int &latsize, int &lonsize)
void Obtain_TRMML3S_V7_latlon_size(int &latsize, int&lonsize) throw(Exception);
static SD * Read_Hybrid(int32 sdfileid, int32 hfileid)
Read the information of all hybrid SDS objects from the HDF4 file.
SPType getSPType() const
Obtain special HDF4 product type.
void InsertOrigFieldPath_ReadVgVdata()
The full path of SDS and Vdata will be obtained.
const std::string & getName() const
Get the attribute name.
int32 vdref
Vdata reference number.
void ReadVgattrs(int32 vgroup_id, char *fullpath)
Obtain vgroup attributes.
const std::string getCoordinate() const
Get the "coordinates" attribute.
bool TreatAsAttrFlag
Flag to map vdata fields to DAP variables or DAP attributes.
void ReadAttributes(int32 vdata_id)
Retrieve all attributes of this Vdata.
std::vector< AttrContainer * > vg_attrs
Vgroup attribute information. See the description of the class AttrContainer.
void PrepareTRMML3A_V6()
Special method to prepare TRMM Level 3A46 latitude and longitude information.
SD * getSD() const
Public interface to Obtain SD.
const std::string & getNewName() const
Obtain new names(with the path and special characters and name clashing handlings)
virtual ~ Exception()
Destructor.
std::set< std::string > fulldimnamelist
Full dimension name list set.
const std::string & getNewName() const
Get the CF attribute name(special characters are replaced by underscores)
void CheckSDType()
This method will check if the HDF4 file is one of TRMM or OBPG products we supported.
std::string newname
New name with path and CF compliant(no special characters and name clashing).
const std::string & getNewName() const
Get the CF name(special characters replaced by underscores) of this field.
void handle_sds_fakedim_names()
void handle_sds_final_dim_names()
Create the final CF-compliant dimension name list for each field.
virtual const char * what() const
Return exception message.
std::string path
The absolute path of the file.
std::vector< Attribute * > attrs
The attributes of this field.
void PrepareTRMML3M_V7()
Special method to prepare TRMM multiple grid Level 3 geolocation fields(latitude,longitude,...
int32 getType() const
Get the data type of this field.
void handle_sds_missing_fields()
Add the missing coordinate variables based on the corrected dimension name list.
void PrepareOBPGL3()
Special method to prepare OBPG Level 3 latitude and longitude information. The latitude and longitude...
std::vector< Attribute * > attrs
Vdata attribute vectors.
const std::string & getName() const
Get dimension name.
std::list< int32 > sds_ref_list
SDS reference number list.
const std::string & getName() const
Obtain the original vdata name.
void setCoordinates(std::string coor)
Set the coordinate attribute.
static SD * Read(int32 sdfileid, int32 hfileid)
Read the information of all SDS objects from the HDF4 file.
const std::string & getName() const
Get the name of this attribute container.
const std::vector< char > & getValue() const
Get the vdata field values.
void PrepareOTHERHDF()
We still provide a hook for other HDF data product although no CF compliant is followed.
const std::vector< AttrContainer * > & getDimInfo() const
Get the list of OHTERHDF dimension attribute container information.
const std::vector< Dimension * > & getCorrectedDimensions() const
Get the list of the corrected dimensions.
void handle_vdata()
Handle Vdata.
void PrepareTRMML2_V6()
Latitude and longitude are stored in one array(geolocation). Need to separate.
const std::vector< AttrContainer * > & getVgattrs() const
Get attributes for all vgroups.
bool getTreatAsAttrFlag() const
virtual void setException(std::string exception_message)
Set exception message.
std::string newname
The CF full path(special characters replaced by underscores) of this field.
const std::vector< VDField * > & getFields() const
Obtain Vdata fields.
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...
void ReadLoneVdatas(File *)
Handle non-attribute lone vdatas.
int32 getRank() const
Get the dimension rank of this field.
const std::vector< Attribute * > & getAttributes() const
Get the attributes of this field.
int32 type
The datatype of this field.
const std::string getSpecFullPath() const
This function returns the full path of some special products that have a very long path.
std::set< std::string > nonmisscvdimnamelist
void ReadHybridNonLoneVdatas(File *)
const std::string & getName() const
Get the name of this field.
std::string name
Original vdata name.
std::map< std::string, std::string > n2dimnamelist
Original dimension name to corrected dimension name map.
int32 getCount() const
Get the number of elements of this attribute.
void handle_sds_coords(bool &COARDFLAG, std::string &lldimname1, std::string &lldimname2)
Create "coordinates", "units" CF attributes.
int32 rank
The rank of this field.
static File * Read(const char *path, int32 sdid, int32 fileid)
Retrieve SDS and Vdata information from the HDF4 file.
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.
std::map< int32, int > refindexlist
SDS reference number to index map, use to quickly obtain the SDS id.
void handle_sds_names(bool &COARDFLAG, std::string &lldimname1, std::string &lldimname2)
Create the final CF-compliant field name list.
void PrepareTRMML3B_V6()
Special method to prepare TRMM Level 3B latitude and longitude information.
std::vector< VDATA * > vds
Vdata objects in this file.
static VDATA * Read(int32 vdata_id, int32 obj_ref)
Retrieve all information of this Vdata.
void create_sds_dim_name_list()
Create the new dimension name set and the dimension name to size map.
const std::vector< Dimension * > & getDimensions() const
Get the list of dimensions.
int32 getObjRef() const
Obtain Vdata reference number, this is necessary for retrieving Vdata information from HDF4.
std::string name
The original name of this field.
static File * Read_Hybrid(const char *path, int32 sdid, int32 fileid)
void PrepareTRMML3S_V7()
Special method to prepare TRMM single grid Level 3 geolocation fields(latitude,longitude,...
std::vector< SDField * > sdfields
SDS objects stored in vectors.
void PrepareTRMML2_V7()
Latitude and longitude are stored in different fields. Need to separate.
const std::vector< char > & getValue() const
Get the attribute value.
void PrepareCERZAVG()
Special method to prepare CERES Zonal Average latitude and longitude information.
std::vector< Attribute * > attrs
SD attributes stored in vectors.
int32 getSize() const
Get dimension size.
bool IsDimNoScale() const
Is this field a dimension without dimension scale(or empty[no data]dimension variable)
const std::string & getPath() const
Obtain the path of the file.
bool Has_Dim_NoScale_Field() const
This file has a field that is a SDS dimension but no dimension scale.
One instance of this class represents one Vdata field.
void obtain_path(int32 file_id, int32 sd_id, char *full_path, int32 pobj_ref)
The internal function used by InsertOrigFieldPath_ReadVgVdata.
Representing one attribute in grid or swath.
Exception(const std::string &msg)
Constructor.
bool IsDimScale() const
Is this field a dimension scale field?
int32 getFieldOrder() const
Get the order of this field.
const std::string getUnits() const
Get the "units" attribute.
int32 getType() const
Get the attribute datatype.
void ReadAttributes(int32 vdata_id, int32 fieldindex)
Read vdata field attributes.
This class retrieves all information of one Vdata.
std::map< std::string, int32 > n1dimnamelist