How to read hdf5 dataset with unknown datatype in c?How do you set, clear, and toggle a single bit?Improve INSERT-per-second performance of SQLite?How do I achieve the theoretical maximum of 4 FLOPs per cycle?“Large data” work flows using pandasHDF5 struct with pointer arrayRead from dataset in HDF5 file with datatype detectionIs there an analysis speed or memory usage advantage to using HDF5 for large array storage (instead of flat binary files)?Reading a large hdf5 dataset.How to read HDF5 dataset with HDF.Pinvoke?Read HDF5 dataset of multiple data types
Is open-sourcing the code of a webapp not recommended?
How can I defend against Pokémon Cinccino “Fluffy Tail”
How would a aircraft visually signal in distress?
Russian equivalents of "no love lost"
Inconsistent behavior of compiler optimization of unused string
What does the "c." listed under weapon length mean?
Do the English have an ancient (obsolete) verb for the action of the book opening?
Can a user sell my software (MIT license) without modification?
Do any instruments not produce overtones?
Smooth switching between 12 V batteries, with a toggle switch
Payment instructions allegedly from HomeAway look fishy to me
How does an ordinary object become radioactive?
Why would future John risk sending back a T-800 to save his younger self?
What makes Ada the language of choice for the ISS's safety-critical systems?
Understanding the TeXlive release cycle: What is the meaning of a TeXlive release and is it ever 'finished'?
Are there downsides to using std::string as a buffer?
"You've got another thing coming" - translation into French
Is it possible to 'live off the sea'
What can plausibly explain many of my very long and low-tech bridges?
Avoiding cliches when writing gods
Last survivors from different time periods living together
Confusion about off peak timings of London trains
How did they achieve the Gunslinger's shining eye effect in Westworld?
How Can I Tell The Difference Between Unmarked Sugar and Stevia?
How to read hdf5 dataset with unknown datatype in c?
How do you set, clear, and toggle a single bit?Improve INSERT-per-second performance of SQLite?How do I achieve the theoretical maximum of 4 FLOPs per cycle?“Large data” work flows using pandasHDF5 struct with pointer arrayRead from dataset in HDF5 file with datatype detectionIs there an analysis speed or memory usage advantage to using HDF5 for large array storage (instead of flat binary files)?Reading a large hdf5 dataset.How to read HDF5 dataset with HDF.Pinvoke?Read HDF5 dataset of multiple data types
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to open an hdf5 dataset in c without knowing the dataset type. I can get the dataset type using "H5Dget_type(dataset_id)", however, when I want to allocate memory to the data array, i.e. "datatype(int, float, etc.) dset[n]", I cannot do it without knowing the datatype(int, float, etc.).
So, my question is that how can I get the data type in order to use it to allocate memory to the array which I'm going to use?
Thank!
c hdf5
add a comment |
I'm trying to open an hdf5 dataset in c without knowing the dataset type. I can get the dataset type using "H5Dget_type(dataset_id)", however, when I want to allocate memory to the data array, i.e. "datatype(int, float, etc.) dset[n]", I cannot do it without knowing the datatype(int, float, etc.).
So, my question is that how can I get the data type in order to use it to allocate memory to the array which I'm going to use?
Thank!
c hdf5
add a comment |
I'm trying to open an hdf5 dataset in c without knowing the dataset type. I can get the dataset type using "H5Dget_type(dataset_id)", however, when I want to allocate memory to the data array, i.e. "datatype(int, float, etc.) dset[n]", I cannot do it without knowing the datatype(int, float, etc.).
So, my question is that how can I get the data type in order to use it to allocate memory to the array which I'm going to use?
Thank!
c hdf5
I'm trying to open an hdf5 dataset in c without knowing the dataset type. I can get the dataset type using "H5Dget_type(dataset_id)", however, when I want to allocate memory to the data array, i.e. "datatype(int, float, etc.) dset[n]", I cannot do it without knowing the datatype(int, float, etc.).
So, my question is that how can I get the data type in order to use it to allocate memory to the array which I'm going to use?
Thank!
c hdf5
c hdf5
asked Mar 24 at 15:39
RezaReza
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If you are not bound to a particular tool, check out HDFql as this will alleviate you from low-level details when dealing with HDF5 files. Your problem may be solved using HDFql in C as follows (assume you want to read dataset my_dataset):
// declare variables
void *data;
long long size;
// get size (in bytes) of dataset "my_dataset" and populate HDFql default cursor with it
hdfql_execute("SHOW SIZE my_dataset");
// move HDFql default cursor to first position
hdfql_cursor_first(NULL);
// retrieve size (in bytes) from HDFql default cursor
size = hdfql_cursor_get_bigint(NULL);
// allocate memory based on the size (in bytes) of dataset "my_dataset"
data = malloc(size);
// register variable "data" for subsequent usage
hdfql_variable_register(&data);
// select (i.e. read) data from dataset "my_dataset" and populate variable "data" with it
hdfql_execute("SELECT FROM my_dataset INTO MEMORY 0");
// from this point on, variable "data" contains the data from "my_dataset"
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325503%2fhow-to-read-hdf5-dataset-with-unknown-datatype-in-c%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you are not bound to a particular tool, check out HDFql as this will alleviate you from low-level details when dealing with HDF5 files. Your problem may be solved using HDFql in C as follows (assume you want to read dataset my_dataset):
// declare variables
void *data;
long long size;
// get size (in bytes) of dataset "my_dataset" and populate HDFql default cursor with it
hdfql_execute("SHOW SIZE my_dataset");
// move HDFql default cursor to first position
hdfql_cursor_first(NULL);
// retrieve size (in bytes) from HDFql default cursor
size = hdfql_cursor_get_bigint(NULL);
// allocate memory based on the size (in bytes) of dataset "my_dataset"
data = malloc(size);
// register variable "data" for subsequent usage
hdfql_variable_register(&data);
// select (i.e. read) data from dataset "my_dataset" and populate variable "data" with it
hdfql_execute("SELECT FROM my_dataset INTO MEMORY 0");
// from this point on, variable "data" contains the data from "my_dataset"
add a comment |
If you are not bound to a particular tool, check out HDFql as this will alleviate you from low-level details when dealing with HDF5 files. Your problem may be solved using HDFql in C as follows (assume you want to read dataset my_dataset):
// declare variables
void *data;
long long size;
// get size (in bytes) of dataset "my_dataset" and populate HDFql default cursor with it
hdfql_execute("SHOW SIZE my_dataset");
// move HDFql default cursor to first position
hdfql_cursor_first(NULL);
// retrieve size (in bytes) from HDFql default cursor
size = hdfql_cursor_get_bigint(NULL);
// allocate memory based on the size (in bytes) of dataset "my_dataset"
data = malloc(size);
// register variable "data" for subsequent usage
hdfql_variable_register(&data);
// select (i.e. read) data from dataset "my_dataset" and populate variable "data" with it
hdfql_execute("SELECT FROM my_dataset INTO MEMORY 0");
// from this point on, variable "data" contains the data from "my_dataset"
add a comment |
If you are not bound to a particular tool, check out HDFql as this will alleviate you from low-level details when dealing with HDF5 files. Your problem may be solved using HDFql in C as follows (assume you want to read dataset my_dataset):
// declare variables
void *data;
long long size;
// get size (in bytes) of dataset "my_dataset" and populate HDFql default cursor with it
hdfql_execute("SHOW SIZE my_dataset");
// move HDFql default cursor to first position
hdfql_cursor_first(NULL);
// retrieve size (in bytes) from HDFql default cursor
size = hdfql_cursor_get_bigint(NULL);
// allocate memory based on the size (in bytes) of dataset "my_dataset"
data = malloc(size);
// register variable "data" for subsequent usage
hdfql_variable_register(&data);
// select (i.e. read) data from dataset "my_dataset" and populate variable "data" with it
hdfql_execute("SELECT FROM my_dataset INTO MEMORY 0");
// from this point on, variable "data" contains the data from "my_dataset"
If you are not bound to a particular tool, check out HDFql as this will alleviate you from low-level details when dealing with HDF5 files. Your problem may be solved using HDFql in C as follows (assume you want to read dataset my_dataset):
// declare variables
void *data;
long long size;
// get size (in bytes) of dataset "my_dataset" and populate HDFql default cursor with it
hdfql_execute("SHOW SIZE my_dataset");
// move HDFql default cursor to first position
hdfql_cursor_first(NULL);
// retrieve size (in bytes) from HDFql default cursor
size = hdfql_cursor_get_bigint(NULL);
// allocate memory based on the size (in bytes) of dataset "my_dataset"
data = malloc(size);
// register variable "data" for subsequent usage
hdfql_variable_register(&data);
// select (i.e. read) data from dataset "my_dataset" and populate variable "data" with it
hdfql_execute("SELECT FROM my_dataset INTO MEMORY 0");
// from this point on, variable "data" contains the data from "my_dataset"
edited Mar 28 at 15:29
answered Mar 28 at 15:03
SOGSOG
1722
1722
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325503%2fhow-to-read-hdf5-dataset-with-unknown-datatype-in-c%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown