26 #ifdef USE_HDFEOS2_LIB
27 #include "HdfEosDef.h"
36 #include <InternalErr.h>
41 #define MAX_NON_SCALE_SPECIAL_VALUE 65535
44 #define MIN_NON_SCALE_SPECIAL_VALUE 65500
67 static void close_fileid(int32 sdfd,int32 file_id,int32 gridfd,int32 swathfd,
bool pass_fileid_key);
77 static std::string
escattr(std::string s);
90 static void Split (
const char *s,
int len,
char sep,
91 std::vector < std::string > &names);
94 static void Split (
const char *sz,
char sep,
95 std::vector < std::string > &names);
100 static bool insert_map(std::map<std::string,std::string>& m, std::string key, std::string val);
106 static void gen_unique_name(std::string &str,std::set<std::string>& namelist,
int&clash_index);
110 static void Handle_NameClashing(std::vector<std::string>&newobjnamelist,std::set<std::string>&objnameset);
113 static std::string
print_attr(int32,
int,
void*);
119 template <
typename T>
static void LatLon2DSubset (T* outlatlon,
int ydim,
int xdim, T* latlon, int32 * offset, int32 * count, int32 * step);
132 #ifdef USE_HDFEOS2_LIB
145 static bool change_data_type(libdap::DAS & das,
SOType scaletype,
const std::string & new_field_name);
151 static bool is_special_value(int32 dtype,
float fillvalue,
float realvalue);
154 static int check_geofile_dimmap(
const std::string & geofilename);
159 static bool is_modis_dimmap_nonll_field(std::string & fieldname);
162 static void obtain_dimmap_info(
const std::string& filename, HDFEOS2::Dataset*dataset,std::vector<struct dimmap_entry>& dimmaps, std::string & modis_geofilename,
bool &geofile_nas_dimmap);
165 static void handle_modis_special_attrs_disable_scale_comp(libdap::AttrTable *at,
const string &filename,
bool is_grid,
const std::string &newfname,
SOType scaletype);
171 static void handle_modis_special_attrs(libdap::AttrTable *at,
const std::string &filename,
bool is_grid,
const std::string & newfname,
SOType scaletype,
bool gridname_change_valid_range,
bool changedtype,
bool &change_fvtype);
174 static void handle_modis_vip_special_attrs(
const std::string& valid_range_value,
const std::string& scale_factor_value,
float& valid_min,
float & valid_max);
177 static void handle_amsr_attrs(libdap::AttrTable *at);
204 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);
208 static void rev_str(
char *str,
int len);
214 static void dtoa(
double,
char *,
int);
225 static size_t write_vector_to_file(
const std::string &,
const vector<double> &,
size_t);
226 static ssize_t write_vector_to_file2(
const std::string &,
const vector<double> &,
size_t);
236 const std::vector < int32 > &pos)
242 assert (dims.size () == pos.size ());
246 for (
unsigned int p = 0; p < pos.size (); p++) {
249 for (
unsigned int j = start; j < dims.size (); j++)
static void add_missing_cf_attrs(HDFSP::File *f, libdap::DAS &das)
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 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 G...
static void check_obpg_global_attrs(HDFSP::File *f, std::string &scaling, float &slope, bool &global_slope_flag, float &intercept, bool &global_intercept_flag)
This class retrieves all information from an HDF4 file. It is a container for SDS and Vdata...
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...
static void handle_otherhdf_special_attrs(HDFSP::File *f, libdap::DAS &das)
static void handle_merra_ceres_attrs_with_bes_keys(HDFSP::File *f, libdap::DAS &das, const std::string &filename)
static void handle_vdata_attrs_with_desc_key(HDFSP::File *f, libdap::DAS &das)
static void Handle_NameClashing(std::vector< std::string > &newobjnamelist)
General routines to handle name clashings.
static void correct_fvalue_type(libdap::AttrTable *at, int32 dtype)
CF requires the _FillValue attribute datatype is the same as the corresponding field datatype...
static std::string get_int_str(int)
static std::string get_double_str(double, int, int)
One instance of this class represents one SDS object.
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.
static void dtoa(double, char *, int)
static std::string print_type(int32)
Print datatype in string.
int32 INDEX_nD_TO_1D(const std::vector< int32 > &dims, const std::vector< int32 > &pos)
This inline routine will translate N dimensions into 1 dimension.
static int int_to_str(int, char str[], int)
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 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"}.
static std::string escattr(std::string s)
A customized escaping function to escape special characters following OPeNDAP's escattr function that...
static std::string print_attr(int32, int, void *)
Print attribute values in string.
static void rev_str(char *str, int len)
static ssize_t read_vector_from_file(int fd, vector< double > &, size_t)
static std::string get_CF_string(std::string s)
Change special characters to "_".
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.
static void LatLon2DSubset(T *outlatlon, int ydim, int xdim, T *latlon, int32 *offset, int32 *count, int32 *step)
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.