Hi Hakon,

I assume you are using 1D array of strings. Here are some hints for you:

1) You may just use string dataype. You can use variable length string if your strings have different size, or you can use fixed length string if your strings are about the same length, e.g.
           tid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
           for fixed length of 128
           H5.H5Tset_size(128);
           for variable length
           H5.H5Tset_size(tid, HDF5Constants.H5T_VARIABLE
2) Set dataset creation property for chunking and compression
               plist = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
               H5.H5Pset_layout(plist, HDF5Constants.H5D_CHUNKED);
H5.H5Pset_chunk(plist, 1, new long[] {1024}); // set the chunk size to be about 2MB for best performance
               H5.H5Pset_deflate(plist, 5);

3) Set the dimension size, e.g.
sid = H5.H5Screate_simple(1, new long[]{25000000}, new long[] {HDF5Constants.H5S_UNLIMITED});

Thanks
--pc


Håkon Sagehaug wrote:
Hi Peter

My problem is actually before I can create the dataset the first time, I can't figure out the correct data type to use. I guess I should use a byte type, since the strins are converted to bytes

Håkon

On 19 March 2010 15:29, Peter Cao <[email protected] <mailto:[email protected]>> wrote:

    Håkon,

    There was a typo in my previous email. You do NOT need to read the
    first chunk in order
    to write the second chunk. You can just select whatever chunks you
    want to write.

    Sorry for the misleading.

    Thanks
    --pc


    Håkon Sagehaug wrote:

        Hi Peter

        I'm trying to do it with the read chunk by chunk, but having
        trouble creating the data set, in the example [1] it's done
        like this

        H5.H5Dcreate(file_id, DATASETNAME,
                               HDF5Constants.H5T_STD_I32LE,
        dataspace_id, dcpl_id);

        the type is for int, but I cant seem to find the correct one
        for string, in example[2] with string arrays t looks like this,

         H5.H5Dcreate(file_id, DATASETNAME, filetype_id,
                               dataspace_id, HDF5Constants.H5P_DEFAULT);

        If I create the dataset like this when I want to dynamiccaly
        add I can only get the first byte in each of the string. Any
        tips on what type I should use?


        Håkon

        [1]
        
http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/java/examples/datasets/H5Ex_D_UnlimitedAdd.java

        
[2]http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/java/examples/datatypes/H5Ex_T_String.java




-- Håkon Sagehaug, Scientific Programmer
        Parallab, Uni BCCS/Uni Research
        [email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>,
        phone +47 55584125
        ------------------------------------------------------------------------

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

    _______________________________________________
    Hdf-forum is for HDF software users discussion.
    [email protected] <mailto:[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

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

Reply via email to