Skip to content

Instantly share code, notes, and snippets.

@adamabernathy
Created June 24, 2015 21:11
Show Gist options
  • Save adamabernathy/a5b088392104bbb7c5e8 to your computer and use it in GitHub Desktop.
Save adamabernathy/a5b088392104bbb7c5e8 to your computer and use it in GitHub Desktop.
Read a variable from a HDF5 file in IDL
function get_hdf5,f,branch,var_name
fid = h5f_open(f) ; open file
gid = h5g_open(fid,branch) ; access the branch
did = h5d_open(gid,var_name) ; access the variable
var = h5d_read(did) ; read the variable
h5d_close,did ; close the variable
h5f_close,fid ; close file
return,var ; send back the data
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment