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 ()
154 : name (name), dimsize (dimsize), dimtype (dimtype)
443 std::vector < Dimension * >
dims;
592 SD (int32 sdfileid, int32 hfileid)
593 : sdfd (sdfileid), fileid (hfileid)
693 VDATA (int32 vdata_myid, int32 obj_ref)
759 return this->OTHERHDF_Has_Dim_NoScale_Field;
793 : path (path), sdfd (-1), fileid (-1), sptype (
OTHERHDF),OTHERHDF_Has_Dim_NoScale_Field(false),EOS2Swathflag(false)
806 std::vector < VDATA * >
vds;
828 void handle_sds_names(
bool & COARDFLAG ,
std::
string & lldimname1,
std::
string &lldimname2) throw(Exception);
902 void ReadVgattrs(int32 vgroup_id,
char *fullpath) throw(Exception);
908 void obtain_path (int32 file_id, int32 sd_id,
char *full_path, int32 pobj_ref) throw (Exception);
911 void obtain_vdata_path(int32 file_id,
char *full_path, int32 pobj_ref) throw (Exception);
926 bool OTHERHDF_Has_Dim_NoScale_Field;
const std::vector< VDATA * > & getVDATAs() const
Public interface to Obtain Vdata.
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.
std::vector< VDATA * > vds
Vdata objects in this file.
std::string name
Original vdata name.
virtual ~Exception()
Destructor.
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.
const std::string & getName() const
Get the name of this attribute container.
void setCorrectedDimensions(std::vector< Dimension * >dims)
Set the list of the corrected dimensions.
int32 getSize() const
Get dimension size.
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...
int32 count
The number of elements.
int32 getRank() const
Get the dimension rank of this field.
void PrepareCERAVGSYN()
Special method to prepare CERES AVG (CER_AVG_???) and CERES SYN(CER_SYN_???) latitude and longitude i...
const std::vector< AttrContainer * > & getDimInfo() const
Get the list of OHTERHDF dimension attribute container information.
void ReadHybridNonLoneVdatas(File *)
Handle non-attribute non-lone vdatas. Note: this function is only used for handling hybrid Vdata func...
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::vector< Attribute * > & getAttributes() const
Obtain Vdata attributes.
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.
const std::string & getName() const
Get the attribute name.
const std::vector< Dimension * > & getDimensions() const
Get the list of dimensions.
void handle_vdata()
Handle Vdata.
bool TreatAsAttrFlag
Flag to map vdata fields to DAP variables or DAP attributes.
std::vector< Attribute * > attrs
Vdata attribute vectors.
This class retrieves all information from an HDF4 file. It is a container for SDS and Vdata...
const std::string & getNewName() const
Get the CF name(special characters replaced by underscores) of this field.
Exception(const std::string &msg)
Constructor.
This class retrieves all SDS objects and SD file attributes.
const std::string & getPath() const
Retrieve the absolute path of the file(full file name).
void PrepareTRMML3S_V7()
Special method to prepare TRMM single grid Level 3 geolocation fields(latitude,longitude,etc) information.
int32 getObjRef() const
Obtain Vdata reference number, this is necessary for retrieving Vdata information from HDF4...
void PrepareCERZAVG()
Special method to prepare CERES Zonal Average latitude and longitude information. ...
int32 type
Attribute type.
std::set< std::string > fulldimnamelist
Full dimension name list set.
std::string path
The full path of the file(file name).
void PrepareOBPGL3()
Special method to prepare OBPG Level 3 latitude and longitude information. The latitude and longitude...
std::vector< Dimension * > * getCorrectedDimensionsPtr()
Get the list of the corrected dimension ptrs.
std::vector< char > value
Vdata field value.
One instance of this class represents one Vdata field.
bool is_noscale_dim
Some fields have dimensions but don't have dimension scales. In HDF4, such dimension appears as a fie...
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,etc) information.
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.
bool IsDimNoScale() const
Is this field a dimension without dimension scale(or empty[no data]dimension variable) ...
Dimension(const std::string &name, int32 dimsize, int32 dimtype)
SD * getSD() const
Public interface to Obtain SD.
std::vector< AttrContainer * > dims_info
OTHERHDF dimension information. See the description of the class AttrContainer.
void PrepareTRMML3A_V6()
Special method to prepare TRMM Level 3A46 latitude and longitude information.
std::vector< char > value
Attribute values.
void ReadAttributes(int32 vdata_id)
Retrieve all attributes of this Vdata.
void setUnits(std::string uni)
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.
const std::vector< char > & getValue() const
Get the attribute value.
int32 numrec
Number of record of the vdata field.
int32 getFieldOrder() const
Get the order of this field.
This class retrieves all information of one Vdata.
void PrepareMODISARNSS()
MODISARNSS is a special MODIS product saved as pure HDF4 files. Dimension names of different fields n...
bool Obtain_TRMM_V7_latlon_name(const SDField *sdfield, const int latsize, const int lonsize, std::string &latname, std::string &lonname)
const int getFieldType() const
int32 size
Vdata field size.
static VDATA * Read(int32 vdata_id, int32 obj_ref)
Retrieve all information of this Vdata.
const std::string getUnits() const
Get the "units" attribute.
std::vector< Dimension * > correcteddims
Corrected dimensions of this field. The only difference between the correcteddims and dims is the cor...
std::set< std::string > nonmisscvdimnamelist
This set stores non-missing coordinate variable dimension names. Many third dimensions of HDF4 files ...
One instance of this class represents one SDS object.
void handle_sds_missing_fields()
Add the missing coordinate variables based on the corrected dimension name list.
bool Check_update_special(const std::string &gridname)
void Prepare()
The main step to make HDF4 SDS objects CF-complaint. All dimension(coordinate variables) information ...
bool getTreatAsAttrFlag() const
Some Vdata fields are very large in size. Some Vdata fields are very small. So we map smaller Vdata f...
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.
std::string units
The "units" attribute.
const std::string & getNewName() const
Get the CF attribute name(special characters are replaced by underscores)
TRMML2_V6: TRMM Level2 1B21,2A12,2B31,2A25 TRMML3A_V6: TRMM Level3 3A46 TRMML3C_V6: TRMM Level3 CSH T...
void create_sds_dim_name_list()
Create the new dimension name set and the dimension name to size map.
const std::string & getNewName() const
Obtain new names(with the path and special characters and name clashing handlings) ...
static SD * Read(int32 sdfileid, int32 hfileid)
Read the information of all SDS objects from the HDF4 file.
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...
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.
It repersents one dimension of an SDS or a VDATA. It holds the dimension name and the size of that di...
void handle_sds_fakedim_names()
Check name clashing for fields. Borrowed from HDFEOS.cc, unused. bool check_field_name_clashing (bool...
std::vector< Attribute * > attrs
int32 getFieldsize() const
Get the field size.
const std::string & getPath() const
Obtain the path of the file.
bool is_dim_scale
This is a SDS dimension scale.
int32 getNumRec() const
Get the number of record.
const std::string & getName() const
Get the name of this field.
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...
std::map< std::string, std::string > n2dimnamelist
Original dimension name to corrected dimension name map.
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.
std::vector< Dimension * > dims
Dimensions of this field.
int32 getFieldRef() const
std::list< int32 > sds_ref_list
SDS reference number list.
std::string newname
CF attribute name(special characters are replaced by underscores)
virtual const char * what() const
Return exception message.
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.
int32 getCount() const
Get the number of elements of this attribute.
virtual void setException(std::string message)
Set exception message.
const std::vector< VDField * > & getFields() const
Obtain Vdata fields.
std::string name
Original attribute name.
std::string name
The original name of this field.
const std::vector< Attribute * > & getAttributes() const
Get the attributes of this field.
const std::vector< Attribute * > & getAttributes() const
Public interface to obtain the SD(file) attributes.
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.
int32 fieldref
SDS reference number. This and the object tag are a key to identify a SDS object. ...
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.
int32 dimtype
dimension scale datatype or 0 if no dimension scale.
int fieldtype
This flag will specify the fieldtype. 0 means this field is general field. 1 means this field is lat...
This class only applies to the OTHERHDF products when there are dimensions but not dimension scales...
void ReadLoneVdatas(File *)
Handle non-attribute lone vdatas.
int32 order
Vdata field order.
std::map< int32, int > refindexlist
SDS reference number to index map, use to quickly obtain the SDS id.
int32 getType() const
Get the attribute datatype.
const std::vector< AttrContainer * > & getVgattrs() const
Get attributes for all vgroups.
const std::vector< Dimension * > & getCorrectedDimensions() const
Get the list of the corrected dimensions.
SPType getSPType() const
Obtain special HDF4 product type.
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)
int32 getType() const
Get the data type of this field.
const std::string getSpecFullPath() const
This function returns the full path of some special products that have a very long path...
bool Has_Dim_NoScale_Field() const
This file has a field that is a SDS dimension but no dimension scale.
const std::string & getName() const
Obtain the original vdata name.
Representing one attribute in grid or swath.
const std::vector< SDField * > & getFields() const
Public interface to obtain information of all SDS vectors(objects).
const std::string getCoordinate() const
Get the "coordinates" attribute.
const std::vector< char > & getValue() const
Get the vdata field values.
std::string message
Exception message.
const std::string & getName() const
Get dimension name.
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.
bool IsDimScale() const
Is this field a dimension scale field?
void CheckSDType()
This method will check if the HDF4 file is one of TRMM or OBPG products we supported.
VDATA(int32 vdata_myid, int32 obj_ref)
std::string newname
New name with path and CF compliant(no special characters and name clashing).
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.
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.
void InsertOrigFieldPath_ReadVgVdata()
The full path of SDS and Vdata will be obtained.