bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
hdfdesc.cc File Reference

DAP attributes and structure description generation code. More...

#include "config.h"
#include "config_hdf.h"
#include <cstdio>
#include <cassert>
#include <cmath>
#include <libgen.h>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <functional>
#include <unordered_set>
#include <set>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <iomanip>
#include <cerrno>
#include <mfhdf.h>
#include <libdap/DMR.h>
#include <libdap/D4Group.h>
#include <libdap/D4Attributes.h>
#include <libdap/DDS.h>
#include <libdap/DAS.h>
#include <libdap/escaping.h>
#include <libdap/parser.h>
#include <libdap/InternalErr.h>
#include <libdap/debug.h>
#include <libdap/Array.h>
#include <BESDebug.h>
#include <BESLog.h>
#include "HDF4RequestHandler.h"
#include "hcstream.h"
#include "hdfclass.h"
#include "hcerr.h"
#include "dhdferr.h"
#include "HDFArray.h"
#include "HDFSequence.h"
#include "HDFTypeFactory.h"
#include "HDFGrid.h"
#include "dodsutil.h"
#include "hdf-maps.h"
#include "HDFByte.h"
#include "HDFInt8.h"
#include "HDFInt16.h"
#include "HDFUInt16.h"
#include "HDFInt32.h"
#include "HDFUInt32.h"
#include "HDFFloat32.h"
#include "HDFFloat64.h"
#include "HDFStr.h"
#include "HE2CF.h"
#include "HDFSP.h"
#include "HDFSPArray_RealField.h"
#include "HDFSPArrayGeoField.h"
#include "HDFSPArrayMissField.h"
#include "HDFSPArrayAddCVField.h"
#include "HDFSPArray_VDField.h"
#include "HDFCFStrField.h"
#include "HDFCFStr.h"
#include "HDFCFUtil.h"
#include "HDFDMRArray_VD.h"
#include "HDFDMRArray_SDS.h"
#include "HDFDMRArray_EOS2LL.h"
#include "HDFDMRArray_SPLL.h"
Include dependency graph for hdfdesc.cc:

Go to the source code of this file.

Macros

#define ATTR_STRING_QUOTE_FIX
 
#define HANDLE_CASE(tid, type)
 
#define HANDLE_CASE(tid, type)
 
#define HANDLE_CASE(tid, type)
 
#define SIGNED_BYTE_TO_INT32   1
 

Typedefs

typedef struct eos2_grid_info eos2_grid_info_t
 
typedef struct eos2_grid eos2_grid_t
 

Functions

void add_CF_1D_cv_attrs (libdap::BaseType *var, bool is_ydim)
 
void add_CF_1D_cvs (D4Group *d4_grp, D4Group *root_grp, const eos2_grid_t &eos2_grid, const eos2_grid_info_t &eos2_grid_info, const string &xdim_path, const string &ydim_path)
 
void add_dummy_grid_cv (D4Group *d4_grp, const eos2_grid_t &eos2_grid, const eos2_grid_info_t &eos2_grid_info)
 
void add_eos2_latlon_info (D4Group *d4_grp, D4Group *root_grp, const eos2_grid_t &eos2_grid, const eos2_grid_info_t &eos2_grid_info, const string &filename)
 
void add_lamaz_cf_grid_mapping_attrs (libdap::BaseType *var, const eos2_grid_info_t &eg_info)
 
void add_obj_ref_attr (BaseType *d4b, bool is_sds, int32 obj_ref)
 
void add_ps_cf_grid_mapping_attrs (libdap::BaseType *var, const eos2_grid_info_t &eg_info)
 
void add_sds_fvalue_attr (BaseType *d4b, int32 sds_id)
 
void add_sp_hdf4_additional_info (D4Group *d4_grp)
 
bool add_sp_hdf4_info (D4Group *d4_grp, const string &filename, string &err_msg)
 
bool add_sp_hdf4_trmm_info (D4Group *d4_grp, const string &filename, const D4Attribute *d4_attr, string &err_msg)
 
void add_var_dap4_attr (BaseType *d4_var, const string &attr_name, D4AttributeType attr_type, const string &attr_value)
 
void AddHDFAttr (DAS &das, const string &varname, const vector< hdf_attr > &hav)
 
void AddHDFAttr (DAS &das, const string &varname, const vector< string > &anv)
 
void change_das_mod08_scale_offset (DAS &das, const HDFSP::File *spf)
 
int check_special_eosfile (const string &filename, string &grid_name, int32 sdfd)
 
void close_vgroup_fileids (int32 fileid, int32 sdfd, int32 vgroup_id)
 
void convert_sds (int32 file_id, int32 sdfd, int32 vgroup_id, int32 obj_ref, D4Group *d4g, D4Group *root_grp, const string &filename, bool is_eos2_grid, bool is_eos2_grid_cf_mapping)
 
void convert_vdata (int32 fileid, int32 sdfd, int32 vgroup_id, int32 obj_ref, D4Group *d4g, const string &filename)
 
void convert_vgroup_attrs (int32 vgroup_id, D4Group *d4g, const string &vgroupname)
 
void convert_vgroup_objects (int32 vgroup_id, int32 file_id, int32 sdfd, D4Group *d4g, D4Group *root_grp, const string &vgroupname, const string &filename, bool is_eos2_grid, bool is_eos2_grid_cf_mapping)
 
void dims_transform_to_dap4 (Array *ar, D4Group *root_grp, bool missing_vars)
 
void exclude_all_sds_refs_in_vgroups (int32 file_id, int32 sdfd, unordered_set< int32 > &sds_ref)
 
void exclude_sds_refs_in_vgroup (int32 file_id, int32 sdfd, int32 vgroup_id, unordered_set< int32 > &sds_ref)
 
BaseType * gen_dap_var (int32 h4_type, const string &h4_str, const string &filename)
 
D4AttributeType h4type_to_dap4_attrtype (int32 h4_type)
 
void handle_sds_dims (D4Group *root_grp, int32 fileid, int32 sdfd)
 
void hdfeos_delete_buffer (void *buffer)
 
yy_buffer_state * hdfeos_scan_string (const char *str)
 
void * hdfeos_string (const char *yy_str)
 
void hdfeos_switch_to_buffer (void *new_buffer)
 
int hdfeosparse (libdap::parser_arg *arg)
 
int is_group_eos2_grid (const string &vgroup_name, vector< eos2_grid_t > &eos2_grid_lls)
 
void map_sds_var_dap4_attrs (HDFDMRArray_SDS *ar, int32 sds_id, int32 obj_ref, int32 n_sds_attrs)
 
void map_sds_vdata_attr (BaseType *d4b, const string &attr_name, int32 attr_type, int32 attr_count, vector< char > &attr_value)
 
void map_vdata_to_dap4_atomic_array (int32 vdata_id, int32 num_elms, int32 obj_ref, D4Group *d4g, const string &filename)
 
void map_vdata_to_dap4_attrs (HDFDMRArray_VD *ar, int32 vdata_id, int32 obj_ref)
 
void map_vdata_to_dap4_structure_array (int32 vdata_id, int32 num_elms, int32 nflds, int32 obj_ref, D4Group *d4g, const string &filename)
 
void map_vgroup_attr (D4Group *d4g, const string &dap4_attrname, int32 attr_type, int32 attr_count, vector< char > &attr_value)
 
template<class T>
string num2string (T n)
 
void obtain_all_sds_refs (int32 file_id, int32 sdfd, unordered_set< int32 > &sds_ref)
 
void obtain_cf_simple_lat_lon (int32 sdfd, int32 fileid, int32 n_sds, string &lat_name, string &lon_name, int &lat_size, int &lon_size)
 
void obtain_cf_simple_lat_lon (int32 sdfd, string &lat_name, string &lon_name, int &lat_size, int &lon_size)
 
string print_dap4_attr (int32 type, int loc, void *vals)
 
void read_das (DAS &das, const string &filename)
 
bool read_das_hdfhybrid (DAS &das, const string &filename, int32 sdfd, int32 fileid, HDFSP::File **h4filepptr)
 
bool read_das_hdfsp (DAS &das, const string &filename, int32 sdfd, int32 fileid, HDFSP::File **h4filepptr)
 
void read_das_sds (DAS &das, const string &filename, int32 sdfd, bool ecs_metadata, HDFSP::File **h4fileptr)
 
void read_das_simple_cf (DAS &das, int32 sdfd, int32 fileid)
 
bool read_das_special_eos2 (DAS &das, const string &filename, int32 sdid, int32 fileid, bool ecs_metadata, HDFSP::File **h4filepptr)
 
bool read_das_special_eos2_core (DAS &das, const HDFSP::File *spf, const string &filename, bool ecs_metadata)
 
void read_dds (DDS &dds, const string &filename)
 
bool read_dds_hdfhybrid (DDS &dds, const string &filename, int32 sdfd, int32 fileid, const HDFSP::File *h4file)
 
bool read_dds_hdfsp (DDS &dds, const string &filename, int32 sdfd, int32 fileid, const HDFSP::File *h4file)
 
void read_dds_sds (DDS &dds, const string &filename, int32 sdfd, HDFSP::File *h4file, bool dds_set_cache)
 
void read_dds_simple_cf (DDS &dds, const string &filename, int32 sdfd, int32 fileid, short cf_simple_type)
 
bool read_dds_special_1d_grid (DDS &dds, const HDFSP::File *spf, const string &filename, int32 sdfd, bool can_cache)
 
void read_dds_spfields (DDS &dds, const string &filename, const int sdfd, const HDFSP::SDField *spsds, SPType sptype)
 
void read_dds_spvdfields (DDS &dds, const string &filename, const int fileid, int32 vdref, int32 numrec, HDFSP::VDField *spvd)
 
void read_dmr (DMR *dmr, const string &filename)
 
void read_dmr_vlone_groups (D4Group *root_grp, int32 file_id, int32 sdfd, const string &filename)
 
void read_lone_sds (D4Group *root_grp, int32 file_id, int32 sdfd, const string &filename)
 
void read_lone_vdata (D4Group *root_grp, int32 file_id, int32 sdfd, const string &filename)
 
void read_sd_attrs (D4Group *root_grp, int32 fileid, int32 sdfd)
 
bool reserved_vgroups (const vector< char > &vgroup_class)
 

Detailed Description

DAP attributes and structure description generation code.

Definition in file hdfdesc.cc.

Macro Definition Documentation

◆ ATTR_STRING_QUOTE_FIX

#define ATTR_STRING_QUOTE_FIX

Definition at line 171 of file hdfdesc.cc.

◆ HANDLE_CASE [1/3]

#define HANDLE_CASE ( tid,
type )
Value:
case tid: \
bt = new (type)(spsdsf->getNewName(),filename); \
break;

◆ HANDLE_CASE [2/3]

#define HANDLE_CASE ( tid,
type )
Value:
case tid: \
bt = new (type)(spsds->getNewName(),filename); \
break;

◆ HANDLE_CASE [3/3]

#define HANDLE_CASE ( tid,
type )
Value:
case tid: \
bt = new (type)(spvd->getNewName(),filename); \
break;

◆ SIGNED_BYTE_TO_INT32

#define SIGNED_BYTE_TO_INT32   1

Definition at line 116 of file hdfdesc.cc.

Function Documentation

◆ add_eos2_latlon_info()

void add_eos2_latlon_info ( D4Group * d4_grp,
D4Group * root_grp,
const eos2_grid_t & eos2_grid,
const eos2_grid_info_t & eos2_grid_info,
const string & filename )

Definition at line 6298 of file hdfdesc.cc.

◆ add_obj_ref_attr()

void add_obj_ref_attr ( BaseType * d4b,
bool is_sds,
int32 obj_ref )

Definition at line 6145 of file hdfdesc.cc.

◆ add_sds_fvalue_attr()

void add_sds_fvalue_attr ( BaseType * d4b,
int32 sds_id )

Definition at line 6163 of file hdfdesc.cc.

◆ add_sp_hdf4_additional_info()

void add_sp_hdf4_additional_info ( D4Group * d4_grp)

Definition at line 6791 of file hdfdesc.cc.

◆ add_sp_hdf4_info()

bool add_sp_hdf4_info ( D4Group * d4_grp,
const string & filename,
string & err_msg )

Definition at line 6646 of file hdfdesc.cc.

◆ add_sp_hdf4_trmm_info()

bool add_sp_hdf4_trmm_info ( D4Group * d4_grp,
const string & filename,
const D4Attribute * d4_attr,
string & err_msg )

Definition at line 6666 of file hdfdesc.cc.

◆ add_var_dap4_attr()

void add_var_dap4_attr ( BaseType * d4_var,
const string & attr_name,
D4AttributeType attr_type,
const string & attr_value )

Definition at line 6276 of file hdfdesc.cc.

◆ AddHDFAttr() [1/2]

void AddHDFAttr ( DAS & das,
const string & varname,
const vector< hdf_attr > & hav )

Definition at line 4503 of file hdfdesc.cc.

◆ AddHDFAttr() [2/2]

void AddHDFAttr ( DAS & das,
const string & varname,
const vector< string > & anv )

Definition at line 4600 of file hdfdesc.cc.

◆ change_das_mod08_scale_offset()

void change_das_mod08_scale_offset ( DAS & das,
const HDFSP::File * spf )

Definition at line 2712 of file hdfdesc.cc.

◆ check_special_eosfile()

int check_special_eosfile ( const string & filename,
string & grid_name,
int32 sdfd )

Definition at line 3433 of file hdfdesc.cc.

◆ close_vgroup_fileids()

void close_vgroup_fileids ( int32 fileid,
int32 sdfd,
int32 vgroup_id )

Definition at line 6267 of file hdfdesc.cc.

◆ convert_sds()

void convert_sds ( int32 file_id,
int32 sdfd,
int32 vgroup_id,
int32 obj_ref,
D4Group * d4g,
D4Group * root_grp,
const string & filename,
bool is_eos2_grid,
bool is_eos2_grid_cf_mapping )

Definition at line 5662 of file hdfdesc.cc.

◆ convert_vdata()

void convert_vdata ( int32 fileid,
int32 sdfd,
int32 vgroup_id,
int32 obj_ref,
D4Group * d4g,
const string & filename )

Definition at line 5452 of file hdfdesc.cc.

◆ convert_vgroup_attrs()

void convert_vgroup_attrs ( int32 vgroup_id,
D4Group * d4g,
const string & vgroupname )

Definition at line 5401 of file hdfdesc.cc.

◆ convert_vgroup_objects()

void convert_vgroup_objects ( int32 vgroup_id,
int32 file_id,
int32 sdfd,
D4Group * d4g,
D4Group * root_grp,
const string & vgroupname,
const string & filename,
bool is_eos2_grid,
bool is_eos2_grid_cf_mapping )

Definition at line 5298 of file hdfdesc.cc.

◆ dims_transform_to_dap4()

void dims_transform_to_dap4 ( Array * ar,
D4Group * root_grp,
bool missing_vars )

Definition at line 6804 of file hdfdesc.cc.

◆ exclude_all_sds_refs_in_vgroups()

void exclude_all_sds_refs_in_vgroups ( int32 file_id,
int32 sdfd,
unordered_set< int32 > & sds_ref )

Definition at line 4897 of file hdfdesc.cc.

◆ exclude_sds_refs_in_vgroup()

void exclude_sds_refs_in_vgroup ( int32 file_id,
int32 sdfd,
int32 vgroup_id,
unordered_set< int32 > & sds_ref )

Definition at line 4968 of file hdfdesc.cc.

◆ gen_dap_var()

BaseType * gen_dap_var ( int32 h4_type,
const string & h4_str,
const string & filename )

Definition at line 5847 of file hdfdesc.cc.

◆ h4type_to_dap4_attrtype()

D4AttributeType h4type_to_dap4_attrtype ( int32 h4_type)

Definition at line 5901 of file hdfdesc.cc.

◆ handle_sds_dims()

void handle_sds_dims ( D4Group * root_grp,
int32 fileid,
int32 sdfd )

Definition at line 4764 of file hdfdesc.cc.

◆ is_group_eos2_grid()

int is_group_eos2_grid ( const string & vgroup_name,
vector< eos2_grid_t > & eos2_grid_lls )

Definition at line 6285 of file hdfdesc.cc.

◆ map_sds_var_dap4_attrs()

void map_sds_var_dap4_attrs ( HDFDMRArray_SDS * ar,
int32 sds_id,
int32 obj_ref,
int32 n_sds_attrs )

Definition at line 5804 of file hdfdesc.cc.

◆ map_sds_vdata_attr()

void map_sds_vdata_attr ( BaseType * d4b,
const string & attr_name,
int32 attr_type,
int32 attr_count,
vector< char > & attr_value )

Definition at line 6111 of file hdfdesc.cc.

◆ map_vdata_to_dap4_atomic_array()

void map_vdata_to_dap4_atomic_array ( int32 vdata_id,
int32 num_elms,
int32 obj_ref,
D4Group * d4g,
const string & filename )

Definition at line 5506 of file hdfdesc.cc.

◆ map_vdata_to_dap4_attrs()

void map_vdata_to_dap4_attrs ( HDFDMRArray_VD * ar,
int32 vdata_id,
int32 obj_ref )

Definition at line 5614 of file hdfdesc.cc.

◆ map_vdata_to_dap4_structure_array()

void map_vdata_to_dap4_structure_array ( int32 vdata_id,
int32 num_elms,
int32 nflds,
int32 obj_ref,
D4Group * d4g,
const string & filename )

Definition at line 5556 of file hdfdesc.cc.

◆ map_vgroup_attr()

void map_vgroup_attr ( D4Group * d4g,
const string & dap4_attrname,
int32 attr_type,
int32 attr_count,
vector< char > & attr_value )

Definition at line 6078 of file hdfdesc.cc.

◆ num2string()

template<class T>
string num2string ( T n)

Definition at line 173 of file hdfdesc.cc.

◆ obtain_all_sds_refs()

void obtain_all_sds_refs ( int32 file_id,
int32 sdfd,
unordered_set< int32 > & sds_ref )

Definition at line 4865 of file hdfdesc.cc.

◆ obtain_cf_simple_lat_lon()

void obtain_cf_simple_lat_lon ( int32 sdfd,
int32 fileid,
int32 n_sds,
string & lat_name,
string & lon_name,
int & lat_size,
int & lon_size )

Definition at line 3854 of file hdfdesc.cc.

◆ print_dap4_attr()

string print_dap4_attr ( int32 type,
int loc,
void * vals )

Definition at line 5955 of file hdfdesc.cc.

◆ read_das()

void read_das ( DAS & das,
const string & filename )

Definition at line 4137 of file hdfdesc.cc.

◆ read_das_hdfsp()

bool read_das_hdfsp ( DAS & das,
const string & filename,
int32 sdfd,
int32 fileid,
HDFSP::File ** h4filepptr )

Definition at line 2031 of file hdfdesc.cc.

◆ read_das_sds()

void read_das_sds ( DAS & das,
const string & filename,
int32 sdfd,
bool ecs_metadata,
HDFSP::File ** h4fileptr )

Definition at line 3700 of file hdfdesc.cc.

◆ read_das_simple_cf()

void read_das_simple_cf ( DAS & das,
int32 sdfd,
int32 fileid )

Definition at line 3730 of file hdfdesc.cc.

◆ read_das_special_eos2()

bool read_das_special_eos2 ( DAS & das,
const string & filename,
int32 sdid,
int32 fileid,
bool ecs_metadata,
HDFSP::File ** h4filepptr )

Definition at line 2485 of file hdfdesc.cc.

◆ read_das_special_eos2_core()

bool read_das_special_eos2_core ( DAS & das,
const HDFSP::File * spf,
const string & filename,
bool ecs_metadata )

Definition at line 2528 of file hdfdesc.cc.

◆ read_dds()

void read_dds ( DDS & dds,
const string & filename )

Definition at line 4124 of file hdfdesc.cc.

◆ read_dds_hdfsp()

bool read_dds_hdfsp ( DDS & dds,
const string & filename,
int32 sdfd,
int32 fileid,
const HDFSP::File * h4file )

Definition at line 1975 of file hdfdesc.cc.

◆ read_dds_sds()

void read_dds_sds ( DDS & dds,
const string & filename,
int32 sdfd,
HDFSP::File * h4file,
bool dds_set_cache )

Definition at line 3721 of file hdfdesc.cc.

◆ read_dds_simple_cf()

void read_dds_simple_cf ( DDS & dds,
const string & filename,
int32 sdfd,
int32 fileid,
short cf_simple_type )

Definition at line 3942 of file hdfdesc.cc.

◆ read_dds_special_1d_grid()

bool read_dds_special_1d_grid ( DDS & dds,
const HDFSP::File * spf,
const string & filename,
int32 sdfd,
bool can_cache )

Definition at line 2788 of file hdfdesc.cc.

◆ read_dds_spfields()

void read_dds_spfields ( DDS & dds,
const string & filename,
const int sdfd,
const HDFSP::SDField * spsds,
SPType sptype )

Definition at line 3026 of file hdfdesc.cc.

◆ read_dds_spvdfields()

void read_dds_spvdfields ( DDS & dds,
const string & filename,
const int fileid,
int32 vdref,
int32 numrec,
HDFSP::VDField * spvd )

Definition at line 3302 of file hdfdesc.cc.

◆ read_dmr()

void read_dmr ( DMR * dmr,
const string & filename )

Definition at line 4705 of file hdfdesc.cc.

◆ read_dmr_vlone_groups()

void read_dmr_vlone_groups ( D4Group * root_grp,
int32 file_id,
int32 sdfd,
const string & filename )

Definition at line 5107 of file hdfdesc.cc.

◆ read_lone_sds()

void read_lone_sds ( D4Group * root_grp,
int32 file_id,
int32 sdfd,
const string & filename )

Definition at line 4845 of file hdfdesc.cc.

◆ read_lone_vdata()

void read_lone_vdata ( D4Group * root_grp,
int32 file_id,
int32 sdfd,
const string & filename )

Definition at line 5073 of file hdfdesc.cc.

◆ read_sd_attrs()

void read_sd_attrs ( D4Group * root_grp,
int32 fileid,
int32 sdfd )

Definition at line 5032 of file hdfdesc.cc.

◆ reserved_vgroups()

bool reserved_vgroups ( const vector< char > & vgroup_class)

Definition at line 5250 of file hdfdesc.cc.