OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
HDFCFUtil Struct Reference

#include <HDFCFUtil.h>

Collaboration diagram for HDFCFUtil:
Collaboration graph

Static Public Member Functions

static void add_missing_cf_attrs (HDFSP::File *f, libdap::DAS &das)
 
static void add_obpg_special_attrs (HDFSP::File *f, libdap::DAS &das, HDFSP::SDField *spsds, std::string &scaling, float &slope, bool &global_slope_flag, float &intercept, bool &global_intercept_flag)
 
static bool check_beskeys (const std::string &key)
 Check the BES key. This function will check a BES key specified at the file h4.conf.in. If the key's value is either true or yes. The handler claims to find a key and will do some operations. Otherwise, will do different operations. For example, One may find a line H4.EnableCF=true at h4.conf.in. That means, the HDF4 handler will handle the HDF4 files by following CF conventions. More...
 
static void check_obpg_global_attrs (HDFSP::File *f, std::string &scaling, float &slope, bool &global_slope_flag, float &intercept, bool &global_intercept_flag)
 
static void close_fileid (int32 sdfd, int32 file_id, int32 gridfd, int32 swathfd, bool pass_fileid_key)
 Close HDF4 and HDF-EOS2 file IDs. For performance reasons, we want to keep HDF-EOS2/HDF4 IDs open for one operation(DDS,DAS or DATA). In case of exceptions, these IDs need to be closed. More...
 
static void correct_fvalue_type (libdap::AttrTable *at, int32 dtype)
 CF requires the _FillValue attribute datatype is the same as the corresponding field datatype. For some NASA files, this is not true. So we need to check if the _FillValue's datatype is the same as the attribute's. If not, we need to correct them. More...
 
static void correct_scale_offset_type (libdap::AttrTable *at)
 CF requires the scale_factor and add_offset attribute datatypes hold the same datatype. So far we haven't found that scale_factor and add_offset attributes hold different datatypes in NASA files. But just in case, we implement a BES key to give users a chance to check this. By default, the key is always off. More...
 
static void dtoa (double, char *, int)
 
static std::string escattr (std::string s)
 A customized escaping function to escape special characters following OPeNDAP's escattr function that can be found at escaping.cc and escaping.h. i Note: the customized version will not treat
(new line),(tab),(Carriage return) as special characters since NASA HDF files use this characters to make the attribute easy to read. Escaping these characters in the attributes will use \012 etc to replace
etc. in these attributes and make attributes hard to read. More...
 
static void gen_unique_name (std::string &str, std::set< std::string > &namelist, int &clash_index)
 Obtain the unique name for the clashed names and save it to set namelist. More...
 
static std::string get_CF_string (std::string s)
 Change special characters to "_". More...
 
static std::string get_double_str (double, int, int)
 
static std::string get_int_str (int)
 
static void handle_merra_ceres_attrs_with_bes_keys (HDFSP::File *f, libdap::DAS &das, const std::string &filename)
 
static void Handle_NameClashing (std::vector< std::string > &newobjnamelist)
 General routines to handle name clashings. More...
 
static void Handle_NameClashing (std::vector< std::string > &newobjnamelist, std::set< std::string > &objnameset)
 
static void handle_otherhdf_special_attrs (HDFSP::File *f, libdap::DAS &das)
 
static void handle_vdata_attrs_with_desc_key (HDFSP::File *f, libdap::DAS &das)
 
static bool insert_map (std::map< std::string, std::string > &m, std::string key, std::string val)
 This is a safer way to insert and update a c++ map value. Otherwise, the local testsuite at The HDF Group will fail for HDF-EOS2 data under iMac machine platform. More...
 
static int int_to_str (int, char str[], int)
 
template<typename T >
static void LatLon2DSubset (T *outlatlon, int ydim, int xdim, T *latlon, int32 *offset, int32 *count, int32 *step)
 
static void parser_trmm_v7_gridheader (const std::vector< char > &value, int &latsize, int &lonsize, float &lat_start, float &lon_start, float &lat_res, float &lon_res, bool check_reg_orig)
 
static std::string print_attr (int32, int, void *)
 Print attribute values in string. More...
 
static std::string print_type (int32)
 Print datatype in string. More...
 
static ssize_t read_vector_from_file (int fd, vector< double > &, size_t)
 
static void rev_str (char *str, int len)
 
static void Split (const char *s, int len, char sep, std::vector< std::string > &names)
 From a string separated by a separator to a list of string, for example, split "ab,c" to {"ab","c"}. More...
 
static void Split (const char *sz, char sep, std::vector< std::string > &names)
 Assume sz is Null terminated string. More...
 

Detailed Description

Definition at line 62 of file HDFCFUtil.h.

Member Function Documentation

void HDFCFUtil::add_missing_cf_attrs ( HDFSP::File f,
libdap::DAS &  das 
)
static
void HDFCFUtil::add_obpg_special_attrs ( HDFSP::File f,
libdap::DAS &  das,
HDFSP::SDField spsds,
std::string &  scaling,
float &  slope,
bool &  global_slope_flag,
float &  intercept,
bool &  global_intercept_flag 
)
static
bool HDFCFUtil::check_beskeys ( const std::string &  key)
static

Check the BES key. This function will check a BES key specified at the file h4.conf.in. If the key's value is either true or yes. The handler claims to find a key and will do some operations. Otherwise, will do different operations. For example, One may find a line H4.EnableCF=true at h4.conf.in. That means, the HDF4 handler will handle the HDF4 files by following CF conventions.

Definition at line 17 of file HDFCFUtil.cc.

References BESKeys::get_value(), BESUtil::lowercase(), and TheBESKeys::TheKeys().

Referenced by handle_merra_ceres_attrs_with_bes_keys(), HDFSP::File::handle_sds_names(), HDFSP::File::handle_vdata(), handle_vdata_attrs_with_desc_key(), HDF4RequestHandler::hdf4_build_das(), HDF4RequestHandler::hdf4_build_data(), HDF4RequestHandler::hdf4_build_data_with_IDs(), HDF4RequestHandler::hdf4_build_dds(), HDFSPArray_RealField::read(), HDFSPArray_VDField::read(), HDFCFStr::read(), HDFCFStrField::read(), HDFSP::VDATA::Read(), read_das_hdfsp(), and read_dds_hdfsp().

Here is the call graph for this function:

void HDFCFUtil::check_obpg_global_attrs ( HDFSP::File f,
std::string &  scaling,
float &  slope,
bool &  global_slope_flag,
float &  intercept,
bool &  global_intercept_flag 
)
static

Definition at line 1384 of file HDFCFUtil.cc.

References GET_INTERCEPT, GET_SLOPE, HDFSP::SD::getAttributes(), HDFSP::File::getSD(), HDFSP::File::getSPType(), OBPGL2, and OBPGL3.

Referenced by read_das_hdfsp().

Here is the call graph for this function:

void HDFCFUtil::close_fileid ( int32  sdfd,
int32  file_id,
int32  gridfd,
int32  swathfd,
bool  pass_fileid_key 
)
static

Close HDF4 and HDF-EOS2 file IDs. For performance reasons, we want to keep HDF-EOS2/HDF4 IDs open for one operation(DDS,DAS or DATA). In case of exceptions, these IDs need to be closed.

Definition at line 2881 of file HDFCFUtil.cc.

Referenced by HDFSPArray_RealField::read(), HDFSPArray_VDField::read(), HDFCFStr::read(), and HDFCFStrField::read().

void HDFCFUtil::correct_fvalue_type ( libdap::AttrTable *  at,
int32  dtype 
)
static

CF requires the _FillValue attribute datatype is the same as the corresponding field datatype. For some NASA files, this is not true. So we need to check if the _FillValue's datatype is the same as the attribute's. If not, we need to correct them.

Definition at line 395 of file HDFCFUtil.cc.

References print_type().

Referenced by read_das_hdfsp().

Here is the call graph for this function:

void HDFCFUtil::correct_scale_offset_type ( libdap::AttrTable *  at)
static

CF requires the scale_factor and add_offset attribute datatypes hold the same datatype. So far we haven't found that scale_factor and add_offset attributes hold different datatypes in NASA files. But just in case, we implement a BES key to give users a chance to check this. By default, the key is always off.

Definition at line 462 of file HDFCFUtil.cc.

Referenced by read_das_hdfsp().

void HDFCFUtil::dtoa ( double  n,
char *  res,
int  afterpoint 
)
static

Definition at line 2739 of file HDFCFUtil.cc.

string HDFCFUtil::escattr ( std::string  s)
static

A customized escaping function to escape special characters following OPeNDAP's escattr function that can be found at escaping.cc and escaping.h. i Note: the customized version will not treat
(new line),(tab),(Carriage return) as special characters since NASA HDF files use this characters to make the attribute easy to read. Escaping these characters in the attributes will use \012 etc to replace
etc. in these attributes and make attributes hard to read.

Definition at line 2502 of file HDFCFUtil.cc.

Referenced by handle_vdata_attrs_with_desc_key(), read_das_hdfsp(), read_das_special_eos2_core(), and HE2CF::set_non_ecsmetadata_attrs().

void HDFCFUtil::gen_unique_name ( std::string &  str,
std::set< std::string > &  namelist,
int &  clash_index 
)
static

Obtain the unique name for the clashed names and save it to set namelist.

Definition at line 110 of file HDFCFUtil.cc.

Referenced by Handle_NameClashing().

string HDFCFUtil::get_double_str ( double  x,
int  total_digit,
int  after_point 
)
static

Definition at line 2770 of file HDFCFUtil.cc.

string HDFCFUtil::get_int_str ( int  x)
static

Definition at line 2803 of file HDFCFUtil.cc.

void HDFCFUtil::handle_merra_ceres_attrs_with_bes_keys ( HDFSP::File f,
libdap::DAS &  das,
const std::string &  filename 
)
static

Definition at line 2246 of file HDFCFUtil.cc.

References CER_AVG, CER_CDAY, CER_CGEO, CER_ES4, CER_SRB, CER_SYN, CER_ZAVG, check_beskeys(), HDFSP::SD::getAttributes(), HDFSP::SD::getFields(), HDFSP::File::getSD(), and HDFSP::File::getSPType().

Referenced by read_das_hdfsp().

Here is the call graph for this function:

void HDFCFUtil::Handle_NameClashing ( std::vector< std::string > &  newobjnamelist)
static

General routines to handle name clashings.

Definition at line 176 of file HDFCFUtil.cc.

Referenced by HDFSP::File::handle_sds_final_dim_names(), HDFSP::File::handle_sds_names(), and HDFSP::File::handle_vdata().

void HDFCFUtil::Handle_NameClashing ( std::vector< std::string > &  newobjnamelist,
std::set< std::string > &  objnameset 
)
static

Definition at line 132 of file HDFCFUtil.cc.

References gen_unique_name().

Here is the call graph for this function:

void HDFCFUtil::handle_otherhdf_special_attrs ( HDFSP::File f,
libdap::DAS &  das 
)
static

Definition at line 1577 of file HDFCFUtil.cc.

References HDFSP::SD::getFields(), HDFSP::File::getSD(), HDFSP::File::getSPType(), HDFSP::File::Has_Dim_NoScale_Field(), and OTHERHDF.

Referenced by read_das_hdfsp().

Here is the call graph for this function:

void HDFCFUtil::handle_vdata_attrs_with_desc_key ( HDFSP::File f,
libdap::DAS &  das 
)
static

Definition at line 2295 of file HDFCFUtil.cc.

References CER_AVG, CER_ES4, CER_SRB, CER_ZAVG, check_beskeys(), escattr(), HDFSP::File::getSPType(), HDFSP::File::getVDATAs(), print_attr(), and print_type().

Referenced by read_das_hdfsp().

Here is the call graph for this function:

bool HDFCFUtil::insert_map ( std::map< std::string, std::string > &  m,
std::string  key,
std::string  val 
)
static

This is a safer way to insert and update a c++ map value. Otherwise, the local testsuite at The HDF Group will fail for HDF-EOS2 data under iMac machine platform.

Definition at line 64 of file HDFCFUtil.cc.

References BESDEBUG.

Referenced by HDFSP::File::handle_sds_final_dim_names(), HDFSP::File::handle_sds_names(), and HDFSP::File::PrepareOTHERHDF().

int HDFCFUtil::int_to_str ( int  x,
char  str[],
int  d 
)
static

Definition at line 2719 of file HDFCFUtil.cc.

template<typename T >
void HDFCFUtil::LatLon2DSubset ( T *  outlatlon,
int  ydim,
int  xdim,
T *  latlon,
int32 *  offset,
int32 *  count,
int32 *  step 
)
static

Definition at line 353 of file HDFCFUtil.cc.

void HDFCFUtil::parser_trmm_v7_gridheader ( const std::vector< char > &  value,
int &  latsize,
int &  lonsize,
float &  lat_start,
float &  lon_start,
float &  lat_res,
float &  lon_res,
bool  check_reg_orig 
)
static

Definition at line 2534 of file HDFCFUtil.cc.

References NULL, and Split().

Referenced by HDFSP::File::Obtain_TRMML3S_V7_latlon_size(), and HDFSP::File::PrepareTRMML3M_V7().

Here is the call graph for this function:

string HDFCFUtil::print_attr ( int32  type,
int  loc,
void *  vals 
)
static
ssize_t HDFCFUtil::read_vector_from_file ( int  fd,
vector< double > &  val,
size_t  dtypesize 
)
static

Definition at line 2863 of file HDFCFUtil.cc.

void HDFCFUtil::rev_str ( char *  str,
int  len 
)
static

Definition at line 2701 of file HDFCFUtil.cc.

void HDFCFUtil::Split ( const char *  s,
int  len,
char  sep,
std::vector< std::string > &  names 
)
static

From a string separated by a separator to a list of string, for example, split "ab,c" to {"ab","c"}.

Definition at line 38 of file HDFCFUtil.cc.

Referenced by parser_trmm_v7_gridheader().

void HDFCFUtil::Split ( const char *  sz,
char  sep,
std::vector< std::string > &  names 
)
static

Assume sz is Null terminated string.

Definition at line 53 of file HDFCFUtil.cc.


The documentation for this struct was generated from the following files: