Hyperslab selection of compound dataset

Hello,

I have a compound dataset which is something like:
INT64, INT8, INT16, INT8

What I would like to do is only read INT64 and INT8 (1st and 3rd position).
Can I achieve that using hyperslab selection ?

I tried but it seems that hyperslab selection works in number of "elements"
(in my cas compound type which is (INT64+INT8+INT16+INT8). Is there any way
around ?

I also saw that H5TB (in code H5TBread_fields_index) is using hyperslab to
select rows and creates a compound type using offsets for reading. It is the
only way ?

What I like with hyperslab is the possibility to save a selection in a
dataset, if i'm using the H5TB way I loose the ability to save selection.

Thanks for you help.
Guillaume.

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Hyperslab-selection-of-compound-dataset-tp3379104p3379104.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Hi Guillaume,

···

On Sep 29, 2011, at 7:28 AM, guillaume wrote:

Hello,

I have a compound dataset which is something like:
INT64, INT8, INT16, INT8

What I would like to do is only read INT64 and INT8 (1st and 3rd position).
Can I achieve that using hyperslab selection ?

I tried but it seems that hyperslab selection works in number of "elements"
(in my cas compound type which is (INT64+INT8+INT16+INT8). Is there any way
around ?

I also saw that H5TB (in code H5TBread_fields_index) is using hyperslab to
select rows and creates a compound type using offsets for reading. It is the
only way ?

What I like with hyperslab is the possibility to save a selection in a
dataset, if i'm using the H5TB way I loose the ability to save selection.

  I don't know if you can select individual fields with the H5TB interface, but this is possible with the lower level (main) APIs. Here's an example program that shows how to do this:

http://www.hdfgroup.org/HDF5/doc/Intro/IntroExamples.html#Compound

  Quincey

Thank you for your reply it seems to be what I was looking for too !

Yves

Thank you for your reply.
This is what H5TB does internally. This is using field name to get data, but
what if I want to extract 2 fields in one ? For instance, if I have
compound type {
"a_name" INT8
"b_name" INT8
"c_name" INT16
}

and I want to read "a_name" and "b_name" in a INT16 ?
Is there any lower API that can achieve that ?

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Hyperslab-selection-of-compound-dataset-tp3379104p3379367.html
Sent from the hdf-forum mailing list archive at Nabble.com.

What I meant was: reading "a_name" and "b_name" together into a new
"variable" with size of 16 bits. This new variable being "a_name << 8 |
b_name". But according to your answer, it doesn't seem to be possible as it
is not how H5D reads internally.

So, as an alternative, is there any way to create a new dataset with
"a_name" and "c_name" without having to copy data from DS1 to DS2 ? So that
DS2 would use data from DS1 ?

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Hyperslab-selection-of-compound-dataset-tp3379104p3379425.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Yes, that's work too. The HDF5 library matches fields by name when doing I/O, so just define your compound datatype in memory with 'a_name' and 'b_name' fields that are of INT16 type and the library will extract just those two fields and also type convert from INT8 to INT16.

  Quincey

···

On Sep 29, 2011, at 9:15 AM, guillaume wrote:

Thank you for your reply.
This is what H5TB does internally. This is using field name to get data, but
what if I want to extract 2 fields in one ? For instance, if I have
compound type {
"a_name" INT8
"b_name" INT8
"c_name" INT16
}

and I want to read "a_name" and "b_name" in a INT16 ?
Is there any lower API that can achieve that ?

Hi Guillaume,

What I meant was: reading "a_name" and "b_name" together into a new
"variable" with size of 16 bits. This new variable being "a_name << 8 |
b_name". But according to your answer, it doesn't seem to be possible as it
is not how H5D reads internally.

  Ah, yes, the HDF5 library won't do that. You could "fake" it by laying out your struct in memory such that 'a_name' and 'b_name' are next to each other in memory and could be read in as separate fields and then treated by the application as the way you would like.

So, as an alternative, is there any way to create a new dataset with
"a_name" and "c_name" without having to copy data from DS1 to DS2 ? So that
DS2 would use data from DS1 ?

  Not currently, although we've given the idea some thought.

  Quincey

···

On Sep 29, 2011, at 9:35 AM, guillaume wrote: