summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/h4toh5image.c10
-rw-r--r--tools/h4toh5main.c27
-rw-r--r--tools/h4toh5pal.c15
3 files changed, 38 insertions, 14 deletions
diff --git a/tools/h4toh5image.c b/tools/h4toh5image.c
index c5bc1df..8fbbdc0 100644
--- a/tools/h4toh5image.c
+++ b/tools/h4toh5image.c
@@ -144,8 +144,14 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup) {
return FAIL;
}
- for (i=0;i<2;i++)
- h5dims[i] = edges[i]-start[i];
+ /* change the order of image dimension:
+ due to the difference of hdf4 image specification and
+ hdf5 image specification. */
+
+
+
+ h5dims[0] = edges[1]-start[1];
+ h5dims[1] = edges[0]-start[0];
gr_ref = GRidtoref(ri_id);
if(gr_ref == 0) {
diff --git a/tools/h4toh5main.c b/tools/h4toh5main.c
index 9881ce0..5e7c6d6 100644
--- a/tools/h4toh5main.c
+++ b/tools/h4toh5main.c
@@ -1100,7 +1100,25 @@ int h4toh5lonevds(int32 file_id, hid_t h5group){
/* Make sure this vdata is not an attribute of other hdf4 objects.*/
if(!VSisattr(vdata_id)) {
+
+ h4toh5_ZeroMemory(vdata_class,VGNAMELENMAX);
+ istat = VSgetclass(vdata_id,vdata_class);
+ if(istat == FAIL) {
+ printf("error in getting vdata class name.\n");
+ free(ref_vdata_array);
+ VSdetach(vdata_id);
+ return FAIL;
+ }
+
+
+ if(!strncmp(vdata_class,_HDF_CHK_TBL_CLASS,strlen(_HDF_CHK_TBL_CLASS))){
+
+ VSdetach(vdata_id);
+ continue;
+ }
+
vdata_ref = VSQueryref(vdata_id);
+
if(vdata_ref == FAIL) {
printf("error in getting vdata reference number.\n");
free(ref_vdata_array);
@@ -1116,17 +1134,10 @@ int h4toh5lonevds(int32 file_id, hid_t h5group){
return FAIL;
}
- h4toh5_ZeroMemory(vdata_class,VGNAMELENMAX);
- istat = VSgetclass(vdata_id,vdata_class);
- if(istat == FAIL) {
- printf("error in getting vdata class name.\n");
- free(ref_vdata_array);
- VSdetach(vdata_id);
- return FAIL;
- }
h4toh5_ZeroMemory(vdata_name,VGNAMELENMAX);
istat = VSQueryname(vdata_id,vdata_name);
+
if(istat == FAIL) {
printf("error in getting vdata name. \n");
free(ref_vdata_array);
diff --git a/tools/h4toh5pal.c b/tools/h4toh5pal.c
index 9fc1ec7..556ecdc 100644
--- a/tools/h4toh5pal.c
+++ b/tools/h4toh5pal.c
@@ -56,9 +56,10 @@ int Palette_h4_to_h5(int32 file_id,int32 pal_id,hid_t h5g,char*pal_name) {
size_t h4memsize;
size_t h4size;
- char palette_label[MAX_NC_NAME];
- char palette_class[MAX_NC_NAME];
- char palette_type[MAX_NC_NAME];
+ char palette_label[MAX_PAL_NAME];
+ char palette_class[MAX_PAL_NAME];
+ char palette_type[MAX_PAL_NAME];
+ char palette_colormodel[MAX_PAL_NAME];
hid_t h5memtype;
hid_t h5type;
@@ -143,7 +144,7 @@ int Palette_h4_to_h5(int32 file_id,int32 pal_id,hid_t h5g,char*pal_name) {
strcpy(palette_label,PALABEL);
strcpy(palette_class,PALETTE);
strcpy(palette_type,PAL_TYPE);
-
+ strcpy(palette_colormodel,RGB);
/* convert palette annotation into attribute of palette dataset.
Since there are no routines to find the exact tag of palette object,
we will check three possible object tags of palette objects, that is:
@@ -180,6 +181,12 @@ int Palette_h4_to_h5(int32 file_id,int32 pal_id,hid_t h5g,char*pal_name) {
return FAIL;
}
+ if(h4_transpredattrs(h5dset,PAL_COLORMODEL,palette_colormodel)==FAIL){
+ printf("unable to transfer palette type to HDF4 PALETTE TYPE.\n");
+ H5Sclose(h5d_sid);
+ H5Dclose(h5dset);
+ return FAIL;
+ }
if(h4_transnumattr(h5dset,HDF4_REF_NUM,pal_ref)==FAIL) {
printf("unable to transfer palette reference number to HDF4 REF. NUM.\n");
H5Sclose(h5d_sid);