compression does not work well on variable length data. the data is larger because
of the overhead from storing the compression information.

On 2/5/2013 4:02 PM, heatherk wrote:
Hi,

I'm trying to write several array of Strings with compression using the
lower level H5 functions.  However, I'm finding that my files are larger
with compression.  Has anyone experienced this?  I wasn't sure how to chunk
an array of length 8 so i tried cutting it in half.

I copied and pasted parts of my code below:

String[] array = new String[8];
....
long[]  dims = { array.length };
long[] chunk_dims = {array.length/2};
...
// create type id
                try {
                        type_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
                H5.H5Tset_size(type_id, HDF5Constants.H5T_VARIABLE);
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        
            // Create the dataset creation property list, add the gzip 
compression
            // filter.
            try {
                dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
                if (dcpl_id >= 0) {
                        H5.H5Pset_deflate(dcpl_id, 9);
                    // Set the chunk size.
                    H5.H5Pset_chunk(dcpl_id, 1, chunk_dims);
                }
            }
            catch (Exception e) {
                e.printStackTrace();
            }
try {
                if ( (dataspace_id >= 0)) {
                        dataset_id = H5.H5Dcreate(file_id, NAME,
                           type_id, dataspace_id,
                           HDF5Constants.H5P_DEFAULT, dcpl_id,
HDF5Constants.H5P_DEFAULT);
        
                }
            }
            catch (Exception e) {
                e.printStackTrace();
            }






--
View this message in context: 
http://hdf-forum.184993.n3.nabble.com/H5-H5Pset-deflate-results-in-larger-file-size-tp4025851.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org



_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to