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;
std::vector< VDATA * > vds
Vdata objects in this file.
std::string name
Original vdata name.
bool getTreatAsAttrFlag() const
const std::vector< Dimension * > & getCorrectedDimensions() const
Get the list of the corrected dimensions.
const std::vector< Attribute * > & getAttributes() const
Obtain Vdata attributes.
std::vector< AttrContainer * > vg_attrs
Vgroup attribute information. See the description of the class AttrContainer.
std::map< std::string, std::string > dimcvarlist
dimension name to coordinate variable name list: the key list to generate CF "coordinates" attributes...
const std::vector< VDField * > & getFields() const
Obtain Vdata fields.
const std::vector< SDField * > & getFields() const
Redundant member function.
void ReadHybridNonLoneVdatas(File *)
const std::vector< AttrContainer * > & getDimInfo() const
Get the list of OHTERHDF dimension attribute container information.
const std::string getSpecFullPath() const
This function returns the full path of some special products that have a very long path.
static SD * Read_Hybrid(int32 sdfileid, int32 hfileid)
Read the information of all hybrid SDS objects from the HDF4 file.
void handle_sds_coords(bool &COARDFLAG, std::string &lldimname1, std::string &lldimname2)
Create "coordinates", "units" CF attributes.
void handle_sds_final_dim_names()
Create the final CF-compliant dimension name list for each field.
const std::string getUnits() const
Get the "units" attribute.
void ReadAttributes(int32 vdata_id, int32 fieldindex)
Read vdata field attributes.
void PrepareTRMML2_V6()
Latitude and longitude are stored in one array(geolocation). Need to separate.
void handle_vdata()
Handle Vdata.
int32 getCount() const
Get the number of elements of this attribute.
virtual void setException(std::string exception_message)
Set exception message.
const std::string & getName() const
Get the name of this attribute container.
bool TreatAsAttrFlag
Flag to map vdata fields to DAP variables or DAP attributes.
std::vector< Attribute * > attrs
Vdata attribute vectors.
Exception(const std::string &msg)
Constructor.
This class retrieves all SDS objects and SD file attributes.
void PrepareTRMML3S_V7()
Special method to prepare TRMM single grid Level 3 geolocation fields(latitude,longitude,...
virtual const char * what() const
Return exception message.
void PrepareCERZAVG()
Special method to prepare CERES Zonal Average latitude and longitude information.
std::set< std::string > fulldimnamelist
Full dimension name list set.
void PrepareOBPGL3()
Special method to prepare OBPG Level 3 latitude and longitude information. The latitude and longitude...
const std::vector< char > & getValue() const
Get the attribute value.
const std::string & getPath() const
Obtain the path of the file.
int32 getType() const
Get the data type of this field.
std::vector< Dimension * > * getCorrectedDimensionsPtr()
Get the list of the corrected dimension ptrs.
int32 getFieldOrder() const
Get the order of this field.
One instance of this class represents one Vdata field.
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,...
const std::string & getNewName() const
Get the CF name(special characters replaced by underscores) of this field.
void setCoordinates(std::string coor)
Set the coordinate attribute.
void PrepareTRMML2_V7()
Latitude and longitude are stored in different fields. Need to separate.
std::string newname
The CF full path(special characters replaced by underscores) of this field.
void PrepareTRMML3A_V6()
Special method to prepare TRMM Level 3A46 latitude and longitude information.
const std::vector< Attribute * > & getAttributes() const
Get the attributes of this field.
void ReadAttributes(int32 vdata_id)
Retrieve all attributes of this Vdata.
bool IsDimScale() const
Is this field a dimension scale field?
SD * getSD() const
Public interface to Obtain SD.
const std::string & getName() const
Get the attribute name.
This class retrieves all information of one Vdata.
bool IsDimNoScale() const
Is this field a dimension without dimension scale(or empty[no data]dimension variable)
static VDATA * Read(int32 vdata_id, int32 obj_ref)
Retrieve all information of this Vdata.
const std::string & getNewName() const
Get the CF attribute name(special characters are replaced by underscores)
int32 getFieldsize() const
Get the field size.
const std::string getCoordinate() const
Get the "coordinates" attribute.
std::set< std::string > nonmisscvdimnamelist
One instance of this class represents one SDS object.
bool Has_Dim_NoScale_Field() const
This file has a field that is a SDS dimension but no dimension scale.
void handle_sds_missing_fields()
Add the missing coordinate variables based on the corrected dimension name list.
const std::vector< AttrContainer * > & getVgattrs() const
Get attributes for all vgroups.
void obtain_path(int32 file_id, int32 sd_id, char *full_path, int32 pobj_ref)
The internal function used by InsertOrigFieldPath_ReadVgVdata.
void PrepareTRMML3B_V6()
Special method to prepare TRMM Level 3B latitude and longitude information.
const std::string & getName() const
Get the name of this field.
void create_sds_dim_name_list()
Create the new dimension name set and the dimension name to size map.
static SD * Read(int32 sdfileid, int32 hfileid)
Read the information of all SDS objects from the HDF4 file.
static File * Read(const char *path, int32 sdid, int32 fileid)
Retrieve SDS and Vdata information from the HDF4 file.
int32 getType() const
Get the attribute datatype.
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.
SPType getSPType() const
Obtain special HDF4 product type.
void handle_sds_fakedim_names()
int32 getRank() const
Get the dimension rank of this field.
static File * Read_Hybrid(const char *path, int32 sdid, int32 fileid)
std::map< std::string, std::string > n2dimnamelist
Original dimension name to corrected dimension name map.
const std::vector< Dimension * > & getDimensions() const
Get the list of dimensions.
const std::string & getName() const
Get dimension name.
const std::string & getName() const
Obtain the original vdata name.
std::list< int32 > sds_ref_list
SDS reference number list.
const std::vector< Attribute * > & getAttributes() const
int32 type
The datatype of this field.
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...
int32 vdref
Vdata reference number.
void handle_sds_names(bool &COARDFLAG, std::string &lldimname1, std::string &lldimname2)
Create the final CF-compliant field name list.
std::vector< SDField * > sdfields
SDS objects stored in vectors.
const std::vector< char > & getValue() const
Get the vdata field values.
void setCorrectedDimensions(std::vector< Dimension * >cor_dims)
Set the list of the corrected dimensions.
std::string name
The original name of this field.
int32 getSize() const
Get dimension size.
void ReadVgattrs(int32 vgroup_id, char *fullpath)
Obtain vgroup attributes.
SD * sd
Pointer to the SD instance. There is only one SD instance in an HDF4 file.
void PrepareOTHERHDF()
We still provide a hook for other HDF data product although no CF compliant is followed.
void PrepareTRMML3C_V6()
Special method to prepare TRMM Level 3 CSH latitude,longitude and Height information.
const std::vector< VDATA * > & getVDATAs() const
Public interface to Obtain Vdata.
void ReadLoneVdatas(File *)
Handle non-attribute lone vdatas.
std::map< int32, int > refindexlist
SDS reference number to index map, use to quickly obtain the SDS id.
int32 rank
The rank of this field.
std::string path
The absolute path of the file.
std::vector< Attribute * > attrs
SD attributes stored in vectors.
void PrepareOBPGL2()
Special method to prepare OBPG Level 2 latitude and longitude information. The latitude and longitude...
std::vector< VDField * > vdfields
Vdata field vectors.
void Obtain_TRMML3S_V7_latlon_size(int &latsize, int &lonsize)
void Obtain_TRMML3S_V7_latlon_size(int &latsize, int&lonsize) throw(Exception);
int32 getNumRec() const
Get the number of record.
int32 getObjRef() const
Obtain Vdata reference number, this is necessary for retrieving Vdata information from HDF4.
Representing one attribute in grid or swath.
std::map< std::string, int32 > n1dimnamelist
void CheckSDType()
This method will check if the HDF4 file is one of TRMM or OBPG products we supported.
const std::vector< Attribute * > & getAttributes() const
Public interface to obtain the SD(file) attributes.
virtual ~ Exception()
Destructor.
std::string newname
New name with path and CF compliant(no special characters and name clashing).
void InsertOrigFieldPath_ReadVgVdata()
The full path of SDS and Vdata will be obtained.
const std::string & getNewName() const
Obtain new names(with the path and special characters and name clashing handlings)