33 #include <sys/types.h>
40 #include <InternalErr.h>
57 #include "HDF5CFGeoCF1D.h"
58 #include "HDF5CFGeoCFProj.h"
65 using namespace HDF5CF;
68 void gen_dap_onevar_dds(DDS &dds,
const HDF5CF::Var* var,
const hid_t file_id,
const string & filename)
71 BESDEBUG(
"h5",
"Coming to gen_dap_onevar_dds() "<<endl);
72 const vector<HDF5CF::Dimension *>& dims = var->
getDimensions();
77 DMR * dmr = HDF5RequestHandler::get_dmr_64bit_int();
81 D4Group* root_grp = dmr->root();
88 string error_message =
"Cannot allocate the HDF5CFInt64: " + error_message;
89 throw InternalErr(__FILE__, __LINE__, error_message);
91 sca_int64->set_is_dap4(
true);
92 map_cfh5_attrs_to_dap4(var,sca_int64);
93 root_grp->add_var_nocopy(sca_int64);
96 else if(H5UINT64 == var->
getType()) {
102 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFInt64.");
104 sca_uint64->set_is_dap4(
true);
105 map_cfh5_attrs_to_dap4(var,sca_uint64);
106 root_grp->add_var_nocopy(sca_uint64);
112 else if (H5FSTRING == var->
getType() || H5VSTRING == var->
getType()) {
118 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFStr.");
120 dds.add_var(sca_str);
132 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFByte.");
134 dds.add_var(sca_uchar);
146 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFInt16.");
148 dds.add_var(sca_int16);
158 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFUInt16.");
160 dds.add_var(sca_uint16);
170 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFInt32.");
172 dds.add_var(sca_int32);
182 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFUInt32.");
184 dds.add_var(sca_uint32);
194 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFFloat32.");
196 dds.add_var(sca_float32);
206 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFFloat64.");
208 dds.add_var(sca_float64);
214 throw InternalErr(__FILE__, __LINE__,
"unsupported data type.");
223 bool dap4_int64 =
false;
225 DMR * dmr = HDF5RequestHandler::get_dmr_64bit_int();
234 D4Group* root_grp = dmr->root();
237 bt->transform_to_dap4(root_grp,root_grp);
244 if(
true == dap4_int64) {
247 else if(var->
getType() == H5UINT64)
253 #define HANDLE_CASE(tid,type) \
255 bt = new (type)(var->getNewName(),var->getFullPath()); \
273 HANDLE_CASE(H5FSTRING, Str)
275 HANDLE_CASE(H5VSTRING, Str)
278 throw InternalErr(__FILE__, __LINE__,
"unsupported data type.");
283 vector<HDF5CF::Dimension*>::const_iterator it_d;
284 vector<size_t> dimsizes;
285 dimsizes.resize(var->
getRank());
286 for (
int i = 0; i < var->
getRank(); i++)
287 dimsizes[i] = (dims[i])->getSize();
296 throw InternalErr(__FILE__, __LINE__,
"Cannot allocate the HDF5CFStr.");
299 for (it_d = dims.begin(); it_d != dims.end(); ++it_d) {
300 if (
"" == (*it_d)->getNewName())
301 ar->append_dim((*it_d)->getSize());
303 ar->append_dim((*it_d)->getSize(), (*it_d)->getNewName());
307 if(dap4_int64 ==
true) {
308 DMR * dmr = HDF5RequestHandler::get_dmr_64bit_int();
309 D4Group* root_grp = dmr->root();
311 BaseType* d4_var = ar->h5cfdims_transform_to_dap4(root_grp);
313 map_cfh5_attrs_to_dap4(var,d4_var);
314 root_grp->add_var_nocopy(d4_var);
331 return (((
"_FillValue" == attr->getNewName()) && (var->
getType() != attr->getType())) ?
true :
false);
338 BESDEBUG(
"h5",
"Coming to gen_dap_special_oneobj_das() "<<endl);
339 if (attr->getCount() != 1)
throw InternalErr(__FILE__, __LINE__,
"FillValue attribute can only have one element.");
341 H5DataType var_dtype = var->
getType();
342 if ((
true == HDF5RequestHandler::get_fillvalue_check())
343 && (
false == is_fvalue_valid(var_dtype, attr))) {
344 string msg =
"The attribute value is out of the range.\n";
345 msg +=
"The variable name: " + var->
getNewName() +
"\n";
346 msg +=
"The attribute name: " + attr->getNewName() +
"\n";
347 msg +=
"The error occurs inside the gen_dap_special_oneobj_das function in h5commoncfdap.cc.";
348 throw InternalErr(msg);
350 string print_rep = HDF5CFDAPUtil::print_attr(attr->getType(), 0, (
void*) (&(attr->getValue()[0])));
351 at->append_attr(attr->getNewName(), HDF5CFDAPUtil::print_type(var_dtype), print_rep);
358 BESDEBUG(
"h5",
"Coming to is_fvalue_valid() "<<endl);
359 bool ret_value =
true;
361 switch (attr->getType()) {
363 signed char final_fill_value = *((
signed char*) ((
void*) (&(attr->getValue()[0]))));
364 if ((var_dtype == H5UCHAR) && (final_fill_value<0))
370 short final_fill_value = *((
short*) ((
void*) (&(attr->getValue()[0]))));
371 if ((var_dtype == H5UCHAR) &&(final_fill_value > 255 || final_fill_value < 0))
375 else if ((var_dtype == H5UINT16) && (final_fill_value < 0))
380 unsigned short final_fill_value = *((
unsigned short*) ((
void*) (&(attr->getValue()[0]))));
381 if ((var_dtype == H5UCHAR) &&(final_fill_value > 255)) {
384 else if ((var_dtype == H5INT16) && (final_fill_value >32767)){
397 unsigned char final_fill_value = *((
unsigned char*)((
void*)(&(attr->getValue()[0]))));
398 if(var_dtype == H5CHAR) {
399 if(final_fill_value >127)
419 if (attr->getCount() != 1)
420 throw InternalErr(__FILE__,__LINE__,
"FillValue attribute can only have one element.");
422 H5DataType var_dtype = var->
getType();
427 unsigned char final_fill_value = *((
unsigned char*)((
void*)(&(attr->getValue()[0]))));
428 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
435 short final_fill_value = *((
short*)((
void*)(&(attr->getValue()[0]))));
436 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
441 short final_fill_value = *((
short*)((
void*)(&(attr->getValue()[0]))));
442 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
447 unsigned short final_fill_value = *((
unsigned short*)((
void*)(&(attr->getValue()[0]))));
448 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
454 int final_fill_value = *((
int*)((
void*)(&(attr->getValue()[0]))));
455 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
460 unsigned int final_fill_value = *((
unsigned int*)((
void*)(&(attr->getValue()[0]))));
461 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
466 float final_fill_value = *((
float*)((
void*)(&(attr->getValue()[0]))));
469 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
474 double final_fill_value = *((
double*)((
void*)(&(attr->getValue()[0]))));
475 print_rep = HDF5CFDAPUtil::print_attr(var_dtype,0,(
void*)&final_fill_value);
479 throw InternalErr(__FILE__,__LINE__,
"unsupported data type.");
482 at->append_attr(attr->getNewName(), HDF5CFDAPUtil::print_type(var_dtype), print_rep);
490 BESDEBUG(
"h5",
"Coming to gen_dap_oneobj_das() "<<endl);
492 if (H5INT64 == attr->getType() || H5UINT64 == attr->getType()) {
497 else if ((H5FSTRING == attr->getType()) || (H5VSTRING == attr->getType())) {
498 gen_dap_str_attr(at, attr);
506 size_t mem_dtype_size = (attr->getBufSize()) / (attr->getCount());
507 H5DataType mem_dtype = HDF5CFDAPUtil::get_mem_dtype(attr->getType(), mem_dtype_size);
509 for (
unsigned int loc = 0; loc < attr->getCount(); loc++) {
510 string print_rep = HDF5CFDAPUtil::print_attr(mem_dtype, loc, (
void*) &(attr->getValue()[0]));
511 at->append_attr(attr->getNewName(), HDF5CFDAPUtil::print_type(attr->getType()), print_rep);
523 bool special_attr_handling = need_special_attribute_handling(attr, var);
524 if (
true == special_attr_handling) {
525 gen_dap_special_oneobj_das(at, attr, var);
532 size_t mem_dtype_size = (attr->getBufSize()) / (attr->getCount());
533 H5DataType mem_dtype = HDF5CFDAPUtil::get_mem_dtype(attr->getType(), mem_dtype_size);
535 for (
unsigned int loc = 0; loc < attr->getCount(); loc++) {
536 string print_rep = HDF5CFDAPUtil::print_attr(mem_dtype, loc, (
void*) &(attr->getValue()[0]));
537 at->append_attr(attr->getNewName(), HDF5CFDAPUtil::print_type(attr->getType()), print_rep);
547 BESDEBUG(
"h5",
"Coming to gen_dap_str_attr() "<<endl);
548 const vector<size_t>& strsize = attr->getStrSize();
549 unsigned int temp_start_pos = 0;
550 bool is_cset_ascii = attr->getCsetType();
551 for (
unsigned int loc = 0; loc < attr->getCount(); loc++) {
552 if (strsize[loc] != 0) {
553 string tempstring(attr->getValue().begin() + temp_start_pos,
554 attr->getValue().begin() + temp_start_pos + strsize[loc]);
555 temp_start_pos += strsize[loc];
563 if ((attr->getNewName() !=
"origname") && (attr->getNewName() !=
"fullnamepath") && (
true == is_cset_ascii))
565 at->append_attr(attr->getNewName(),
"String", tempstring);
575 void add_cf_grid_cvs(DDS & dds, EOS5GridPCType cv_proj_code,
float cv_point_lower,
float cv_point_upper,
576 float cv_point_left,
float cv_point_right,
const vector<HDF5CF::Dimension*>& dims)
581 if (HE5_GCTP_SNSOID == cv_proj_code || HE5_GCTP_LAMAZ == cv_proj_code || HE5_GCTP_PS == cv_proj_code) {
584 vector<HDF5CF::Dimension*>::const_iterator it_d;
585 string dim0name = dims[0]->getNewName();
586 int dim0size = dims[0]->getSize();
587 string dim1name = dims[1]->getNewName();
588 int dim1size = dims[1]->getSize();
591 BaseType *bt_dim0 = NULL;
592 BaseType *bt_dim1 = NULL;
603 ar_dim0 =
new HDF5CFGeoCF1D(HE5_GCTP_SNSOID, cv_point_upper, cv_point_lower, dim0size, dim0name, bt_dim0);
604 ar_dim0->append_dim(dim0size, dim0name);
606 ar_dim1 =
new HDF5CFGeoCF1D(HE5_GCTP_SNSOID, cv_point_left, cv_point_right, dim1size, dim1name, bt_dim1);
607 ar_dim1->append_dim(dim1size, dim1name);
608 dds.add_var(ar_dim0);
609 dds.add_var(ar_dim1);
613 if (bt_dim0)
delete bt_dim0;
614 if (bt_dim1)
delete bt_dim1;
615 if (ar_dim0)
delete ar_dim0;
616 if (ar_dim1)
delete ar_dim1;
617 throw InternalErr(__FILE__, __LINE__,
"Unable to allocate the HDFEOS2GeoCF1D instance.");
620 if (bt_dim0)
delete bt_dim0;
621 if (bt_dim1)
delete bt_dim1;
622 if (ar_dim0)
delete ar_dim0;
623 if (ar_dim1)
delete ar_dim1;
629 void add_cf_grid_mapinfo_var(DDS & dds,
const EOS5GridPCType grid_proj_code,
const unsigned short g_suffix)
634 string cf_projection_base =
"eos_cf_projection";
637 if(HE5_GCTP_SNSOID == grid_proj_code) {
640 dummy_proj_cf =
new HDF5CFGeoCFProj(cf_projection_base, cf_projection_base);
641 dds.add_var(dummy_proj_cf);
645 stringstream t_suffix_ss;
646 t_suffix_ss << g_suffix;
647 string cf_projection_name = cf_projection_base +
"_" + t_suffix_ss.str();
648 dummy_proj_cf =
new HDF5CFGeoCFProj(cf_projection_name, cf_projection_name);
649 dds.add_var(dummy_proj_cf);
651 if (dummy_proj_cf)
delete dummy_proj_cf;
657 void add_cf_grid_cv_attrs(DAS & das,
const vector<HDF5CF::Var*>& vars, EOS5GridPCType cv_proj_code,
658 float ,
float ,
float ,
float ,
659 const vector<HDF5CF::Dimension*>& dims,
const vector<double> &eos5_proj_params,
const unsigned short g_suffix)
661 void add_cf_grid_cv_attrs(DAS & das,
const vector<HDF5CF::Var*>& vars, EOS5GridPCType cv_proj_code,
662 const vector<HDF5CF::Dimension*>& dims,
const vector<double> &eos5_proj_params,
const unsigned short g_suffix)
667 if (HE5_GCTP_SNSOID == cv_proj_code || HE5_GCTP_PS == cv_proj_code || HE5_GCTP_LAMAZ== cv_proj_code) {
669 string dim0name = (dims[0])->getNewName();
670 int dim0size = dims[0]->getSize();
671 string dim1name = (dims[1])->getNewName();
672 int dim1size = dims[1]->getSize();
675 AttrTable *at = das.get_table(dim0name);
677 at = das.add_table(dim0name,
new AttrTable);
678 at->append_attr(
"standard_name",
"String",
"projection_y_coordinate");
680 string long_name =
"y coordinate of projection ";
681 at->append_attr(
"long_name",
"String", long_name);
684 at->append_attr(
"units",
"string",
"meter");
686 at->append_attr(
"_CoordinateAxisType",
"string",
"GeoY");
688 at = das.get_table(dim1name);
689 if (!at) at = das.add_table(dim1name,
new AttrTable);
691 at->append_attr(
"standard_name",
"String",
"projection_x_coordinate");
693 long_name =
"x coordinate of projection ";
694 at->append_attr(
"long_name",
"String", long_name);
697 at->append_attr(
"units",
"string",
"meter");
700 at->append_attr(
"_CoordinateAxisType",
"string",
"GeoX");
703 string cf_projection_base =
"eos_cf_projection";
704 string cf_projection;
705 if(HE5_GCTP_SNSOID == cv_proj_code)
706 cf_projection = cf_projection_base;
708 stringstream t_suffix_ss;
709 t_suffix_ss << g_suffix;
710 cf_projection = cf_projection_base +
"_" + t_suffix_ss.str();
712 add_cf_projection_attrs(das,cv_proj_code,eos5_proj_params,cf_projection);
716 add_cf_grid_mapping_attr(das, vars, cf_projection, dim0name, dim0size, dim1name, dim1size);
723 void add_cf_projection_attrs(DAS &das,EOS5GridPCType cv_proj_code,
const vector<double> &eos5_proj_params,
const string& cf_projection) {
725 AttrTable* at = das.get_table(cf_projection);
727 at = das.add_table(cf_projection,
new AttrTable);
729 if (HE5_GCTP_SNSOID == cv_proj_code) {
730 at->append_attr(
"grid_mapping_name",
"String",
"sinusoidal");
731 at->append_attr(
"longitude_of_central_meridian",
"Float64",
"0.0");
732 at->append_attr(
"earth_radius",
"Float64",
"6371007.181");
733 at->append_attr(
"_CoordinateAxisTypes",
"string",
"GeoX GeoY");
735 else if (HE5_GCTP_PS == cv_proj_code) {
741 double vert_lon_pole = HE5_EHconvAng(eos5_proj_params[4],HE5_HDFE_DMS_DEG);
744 double lat_true_scale = HE5_EHconvAng(eos5_proj_params[5],HE5_HDFE_DMS_DEG);
747 double fe = eos5_proj_params[6];
750 double fn = eos5_proj_params[7];
752 at->append_attr(
"grid_mapping_name",
"String",
"polar_stereographic");
754 ostringstream s_vert_lon_pole;
755 s_vert_lon_pole << vert_lon_pole;
759 at->append_attr(
"straight_vertical_longitude_from_pole",
"Float64", s_vert_lon_pole.str());
760 ostringstream s_lat_true_scale;
761 s_lat_true_scale << lat_true_scale;
763 at->append_attr(
"standard_parallel",
"Float64", s_lat_true_scale.str());
766 at->append_attr(
"false_easting",
"Float64",
"0.0");
770 at->append_attr(
"false_easting",
"Float64",s_fe.str());
775 at->append_attr(
"false_northing",
"Float64",
"0.0");
779 at->append_attr(
"false_northing",
"Float64",s_fn.str());
783 if(lat_true_scale >0)
784 at->append_attr(
"latitude_of_projection_origin",
"Float64",
"+90.0");
786 at->append_attr(
"latitude_of_projection_origin",
"Float64",
"-90.0");
789 at->append_attr(
"_CoordinateAxisTypes",
"string",
"GeoX GeoY");
796 else if(HE5_GCTP_LAMAZ == cv_proj_code) {
797 double lon_proj_origin = HE5_EHconvAng(eos5_proj_params[4],HE5_HDFE_DMS_DEG);
798 double lat_proj_origin = HE5_EHconvAng(eos5_proj_params[5],HE5_HDFE_DMS_DEG);
799 double fe = eos5_proj_params[6];
800 double fn = eos5_proj_params[7];
802 at->append_attr(
"grid_mapping_name",
"String",
"lambert_azimuthal_equal_area");
804 ostringstream s_lon_proj_origin;
805 s_lon_proj_origin << lon_proj_origin;
806 at->append_attr(
"longitude_of_projection_origin",
"Float64", s_lon_proj_origin.str());
808 ostringstream s_lat_proj_origin;
809 s_lat_proj_origin << lat_proj_origin;
811 at->append_attr(
"latitude_of_projection_origin",
"Float64", s_lat_proj_origin.str());
815 at->append_attr(
"false_easting",
"Float64",
"0.0");
819 at->append_attr(
"false_easting",
"Float64",s_fe.str());
824 at->append_attr(
"false_northing",
"Float64",
"0.0");
828 at->append_attr(
"false_northing",
"Float64",s_fn.str());
831 at->append_attr(
"_CoordinateAxisTypes",
"string",
"GeoX GeoY");
842 void add_cf_grid_mapping_attr(DAS &das,
const vector<HDF5CF::Var*>& vars,
const string& cf_projection,
843 const string & dim0name, hsize_t dim0size,
const string &dim1name, hsize_t dim1size)
847 cerr<<
"dim0name is "<<dim0name <<endl;
848 cerr<<
"dim1name is "<<dim1name <<endl;
849 cerr<<
"dim0size is "<<dim0size <<endl;
850 cerr<<
"dim1size is "<<dim1size <<endl;
854 vector<HDF5CF::Var *>::const_iterator it_v;
855 for (it_v = vars.begin(); it_v != vars.end(); ++it_v) {
857 if ((*it_v)->getRank() > 1) {
858 bool has_dim0 =
false;
859 bool has_dim1 =
false;
860 const vector<HDF5CF::Dimension*>& dims = (*it_v)->getDimensions();
861 for (vector<HDF5CF::Dimension *>::const_iterator j = dims.begin(); j != dims.end(); ++j) {
862 if ((*j)->getNewName() == dim0name && (*j)->getSize() == dim0size)
864 else if ((*j)->getNewName() == dim1name && (*j)->getSize() == dim1size)
868 if (
true == has_dim0 &&
true == has_dim1) {
869 AttrTable *at = das.get_table((*it_v)->getNewName());
870 if (!at) at = das.add_table((*it_v)->getNewName(),
new AttrTable);
873 at->append_attr(
"grid_mapping",
"String", cf_projection);
881 void add_ll_valid_range(AttrTable* at,
bool is_lat) {
883 at->append_attr(
"valid_min",
"Float64",
"-90.0");
884 at->append_attr(
"valid_max",
"Float64",
"90.0");
887 at->append_attr(
"valid_min",
"Float64",
"-180.0");
888 at->append_attr(
"valid_max",
"Float64",
"180.0");
893 bool need_attr_values_for_dap4(
const HDF5CF::Var *var) {
894 bool ret_value =
false;
895 if((HDF5RequestHandler::get_dmr_64bit_int()!=NULL) &&
902 void map_cfh5_attrs_to_dap4(
const HDF5CF::Var *var,BaseType* d4_var) {
904 vector<HDF5CF::Attribute *>::const_iterator it_ra;
905 for (it_ra = var->getAttributes().begin();
906 it_ra != var->getAttributes().end(); ++it_ra) {
909 size_t mem_dtype_size = ((*it_ra)->getBufSize()) / ((*it_ra)->getCount());
910 H5DataType mem_dtype = HDF5CFDAPUtil::get_mem_dtype((*it_ra)->getType(), mem_dtype_size);
912 string dap2_attrtype = HDF5CFDAPUtil::print_type(mem_dtype);
914 D4Attribute *d4_attr =
new D4Attribute((*it_ra)->getNewName(),dap4_attrtype);
915 if(dap4_attrtype == attr_str_c) {
916 if(
"coordinates" == (*it_ra)->getNewName()) {
917 bool chg_coor_value =
false;
918 if((
true == HDF5RequestHandler::get_enable_coord_attr_add_path())
919 &&(
true == var->getCoorAttrAddPath()))
920 chg_coor_value =
true;
922 handle_coor_attr_for_int64_var((*it_ra),var->
getFullPath(),tempstring,chg_coor_value);
923 d4_attr->add_value(tempstring);
926 const vector<size_t>& strsize = (*it_ra)->getStrSize();
927 unsigned int temp_start_pos = 0;
928 for (
unsigned int loc = 0; loc < (*it_ra)->getCount(); loc++) {
929 if (strsize[loc] != 0) {
930 string tempstring((*it_ra)->getValue().begin() + temp_start_pos,
931 (*it_ra)->getValue().begin() + temp_start_pos + strsize[loc]);
932 temp_start_pos += strsize[loc];
936 d4_attr->add_value(tempstring);
943 for (
unsigned int loc = 0; loc < (*it_ra)->getCount(); loc++) {
944 string print_rep = HDF5CFDAPUtil::print_attr(mem_dtype, loc, (
void*) &((*it_ra)->getValue()[0]));
945 d4_attr->add_value(print_rep);
948 d4_var->attributes()->add_attribute_nocopy(d4_attr);
951 D4Attribute *d4_attr =
new D4Attribute(
"origname",attr_str_c);
952 d4_attr->add_value(var->
getName());
953 d4_var->attributes()->add_attribute_nocopy(d4_attr);
954 d4_attr =
new D4Attribute(
"fullnamepath",attr_str_c);
956 d4_var->attributes()->add_attribute_nocopy(d4_attr);
959 void check_update_int64_attr(
const string & obj_name,
const HDF5CF::Attribute * attr) {
960 if(attr->getType() == H5INT64 || attr->getType() == H5UINT64) {
962 DMR * dmr = HDF5RequestHandler::get_dmr_64bit_int();
964 string dap2_attrtype = HDF5CFDAPUtil::print_type(attr->getType());
966 D4Attribute *d4_attr =
new D4Attribute(attr->getNewName(),dap4_attrtype);
967 for (
unsigned int loc = 0; loc < attr->getCount(); loc++) {
968 string print_rep = HDF5CFDAPUtil::print_attr(attr->getType(), loc, (
void*) &(attr->getValue()[0]));
969 d4_attr->add_value(print_rep);
971 D4Group * root_grp = dmr->root();
972 D4Attribute *d4_hg_container;
973 if(root_grp->attributes()->empty() ==
true){
978 d4_hg_container =
new D4Attribute;
979 d4_hg_container->set_name(
"HDF5_GLOBAL_integer_64");
980 d4_hg_container->set_type(attr_container_c);
981 root_grp->attributes()->add_attribute_nocopy(d4_hg_container);
987 d4_hg_container = root_grp->attributes()->get(
"HDF5_GLOBAL_integer_64");
989 string test_obj_name =
"HDF5_GLOBAL_integer_64."+obj_name;
994 D4Attribute *d4_container = root_grp->attributes()->get(test_obj_name);
1000 if(d4_container == NULL) {
1001 d4_container =
new D4Attribute;
1002 d4_container->set_name(obj_name);
1003 d4_container->set_type(attr_container_c);
1012 d4_container->attributes()->add_attribute_nocopy(d4_attr);
1017 if(d4_hg_container->attributes()->get(obj_name)==NULL)
1018 d4_hg_container->attributes()->add_attribute_nocopy(d4_container);
1022 d4_hg_container->attributes()->add_attribute_nocopy(d4_attr);
1026 void handle_coor_attr_for_int64_var(
const HDF5CF::Attribute *attr,
const string &var_path,
string &tempstring,
bool chg_coor_value) {
1028 string tempstring2(attr->getValue().begin(),attr->getValue().end());
1029 if(
true == chg_coor_value) {
1031 vector<string>cvalue_vec;
1032 HDF5CFUtil::Split_helper(cvalue_vec,tempstring2,sep);
1033 for (
int i = 0; i<cvalue_vec.size();i++) {
1034 HDF5CFUtil::cha_co(cvalue_vec[i],var_path);
1035 string t_str = get_cf_string(cvalue_vec[i]);
1039 tempstring += sep+t_str;
1043 tempstring = tempstring2;
1049 string get_cf_string(
string & s) {
1052 return get_cf_string_helper(s);
1056 return get_cf_string_helper(s);
1060 string get_cf_string_helper(
string & s) {
1062 if (
"" == s)
return s;
1063 string insertString(1,
'_');
1066 if (
true == isdigit(s[0])) s.insert(0, insertString);
1068 for (
unsigned int i = 0; i < s.length(); i++)
1069 if ((
false == isalnum(s[i])) && (s[i] !=
'_')) s[i] =
'_';
This class includes the methods to read data array into DAP buffer from an HDF5 dataset for the CF op...
This class provides a way to map HDF5 byte to DAP byte for the CF option.
This class provides a way to map HDF5 float to DAP float for the CF option.
This class provides a way to map HDF5 64-bit floating-point(double) to DAP 64-bit floating-point for ...
This class provides a way to map HDF5 int16 to DAP int16 for the CF option.
This class provides a way to map HDF5 32-bit integer to DAP Int32 for the CF option.
This class provides a way to map HDF5 64-bit integer to DAP4 Int64 for the CF option.
This class provides a way to map HDF5 Str to DAP Str for the CF option.
This class provides a way to map HDF5 unsigned 16-bit integer to DAP uint16 for the CF option.
This class provides a way to map HDF5 unsigned 32-bit integer to DAP uint32 for the CF option.
This class provides a way to map HDF5 64-bit unsigned integer to DAP4 UInt64 for the CF option.
This file includes several helper functions for translating HDF5 to CF-compliant.
This class provides a way to map HDF5 Int64 to DAP Int64 for the default option.
include the entry functions to execute the handlers
static string escattr(string s)
static D4AttributeType daptype_strrep_to_dap4_attrtype(std::string s)
This class represents one attribute.
This class represents one HDF5 dataset(CF variable)
int getRank() const
Get the dimension rank of this variable.
const std::string & getFullPath() const
Get the full path of this variable.
const std::string & getName() const
Get the original name of this variable.
H5DataType getType() const
Get the data type of this variable(Not HDF5 datatype id)
const std::vector< Dimension * > & getDimensions() const
Get the list of the dimensions.
int getCompRatio() const
Get the compression ratio of this dataset.
const std::string & getNewName() const
Get the new name of this variable.
Helper functions for generating DAS attributes and a function to check BES Key.
Map and generate DDS and DAS for the CF option for generic HDF5 products.