HDF5::Dataset(3pm)
π HDF5::Dataset β the PDL::IO::HDF5 helper bestie that handles your datasets π
okay so welcome to HDF5::Dataset(3pm) from the User Contributed Perl Documentation, bestie πΈ grab a snack, we're doing HDF5 today and it's gonna be so good.
β¨ NAME β¨
PDL::IO::HDF5::Dataset β the PDL::IO::HDF5 Helper Object that represents HDF5 datasets. yes. that's the whole job. and she eats π
π¦ DESCRIPTION π¦
So this is a helper-object β a little sidekick that PDL::IO::HDF5 uses to talk to the dataset objects inside the HDF5 format. she doesn't run the show, she makes the show work β¨
and if you wanna go read up on the whole HDF5 Format (respect, nerd, love that for you π), it's at the HDF Group's web site, literally right here: http://www.hdfgroup.org π«Ά
π SYNOPSIS π
go look at PDL::IO::HDF5. that's it. that's the whole synopsis. iconic minimalism honestly π
π MEMBER DATA π
the lil data girlies that live inside every one of these objects:
IDβ the ID number the HDF5 library handed to this dataset. like a lil serial number but make it β¨fancyβ¨nameβ the name of the dataset. what she's called. her government name fr fr.parentβ a ref to the parent object (the group) that owns this dataset πΌfileObjβ a ref to thePDL::IO::HDF5object that owns this object. it's refs all the way down bestie π
π METHODS π
π§ new
PDL::IO::HDF5::Dataset Constructor β makes a brand new object, fresh out the box β¨
Usage:
ngl this object will usually just get created for you using the calling format detailed up in the SYNOPSIS. but here's the syntax that the PDL::IO::HDF5 object uses to build it:
$a = new PDL::IO::HDF5:Dataset( name => $name, parent => $parent,
fileObj => $fileObj);
Args:
$nameβ name of the dataset$parentβ Parent Object that owns this dataset$fileObjβ PDL::HDF object that owns this dateset.
(that last one is spelled dateset in the source and I am not touching it, we preserve the lore π)
π DESTROY
PDL::IO::HDF5::Dataset Destructor β closes the dataset object. it's giving the end, respectfully π₯
Usage:
No Usage. Automatically called
you don't call her. she calls you. main character energy, honestly.
π₯ set
write data to the HDF5 dataset. putting the numbers in π₯
Usage:
$dataset->set($pdl, unlimited => 1); # Write the array data in the dataset
Options:
unlimitedβ if present, the dataset is created with unlimited dimensions. go big or go home, no cap π
π get
grab data out of an HDF5 dataset and turn it into a PDL. pulling the numbers out π€
Usage:
$pdl = $dataset->get; # Read the Array from the HDF5 dataset, create a PDL from it
# and put in $pdl
# Assuming $dataset is three dimensional
# with dimensions (20,100,90)
okay so the get method can ALSO be used to snag particular slices or hyperslabs of the dataset array. like, if $dataset is three dimensional with dimensions (20,100,90) then we could do:
$start=pdl([0,0,0]); # We begin the slice at the very beginning
$end=pdl([19,0,0]); # We take the first vector of the array,
$stride=pdl([2,1,1]); # taking only every two values of the vector
$pdl = $dataset->get($start,$end,[$stride]); # Read a slice or
# hyperslab from the HDF5 dataset.
# $start, $end and optionally $stride
# should be PDL vectors with length the
# number of dimensions of the dataset.
# $start gives the starting coordinates
# in the array.
# $end gives the ending coordinate
# in the array
# $stride gives the steps taken from one
# coordinate to the next of the slice
the mapping of HDF5 datatypes in the file to PDL datatypes in memory goes according to this table, and I'm handing it to you verbatim because every single line matters π«Ά:
HDF5 File Type PDL Type
------------------------ -----------------
PDL::IO::HDF5::H5T_C_S1() => PDL::Char Object (Special Case for Char Strings)
PDL::IO::HDF5::H5T_STD_I8BE() => $PDL::Types::PDL_SB,
PDL::IO::HDF5::H5T_STD_I8LE() => $PDL::Types::PDL_SB,
PDL::IO::HDF5::H5T_STD_U8BE() => $PDL::Types::PDL_B,
PDL::IO::HDF5::H5T_STD_U8LE() => $PDL::Types::PDL_B,
PDL::IO::HDF5::H5T_STD_I16BE() => $PDL::Types::PDL_S,
PDL::IO::HDF5::H5T_STD_I16LE() => $PDL::Types::PDL_S,
PDL::IO::HDF5::H5T_STD_U16BE() => $PDL::Types::PDL_U,
PDL::IO::HDF5::H5T_STD_U16LE() => $PDL::Types::PDL_U,
PDL::IO::HDF5::H5T_STD_I32BE() => $PDL::Types::PDL_L,
PDL::IO::HDF5::H5T_STD_I32LE() => $PDL::Types::PDL_L,
PDL::IO::HDF5::H5T_STD_U32LE() => $PDL::Types::PDL_UL,
PDL::IO::HDF5::H5T_STD_U32BE() => $PDL::Types::PDL_UL,
PDL::IO::HDF5::H5T_STD_I64LE() => $PDL::Types::PDL_LL,
PDL::IO::HDF5::H5T_STD_I64BE() => $PDL::Types::PDL_LL,
PDL::IO::HDF5::H5T_STD_U64LE() => $PDL::Types::PDL_ULL,
PDL::IO::HDF5::H5T_STD_U64BE() => $PDL::Types::PDL_ULL,
PDL::IO::HDF5::H5T_IEEE_F32BE() => $PDL::Types::PDL_F,
PDL::IO::HDF5::H5T_IEEE_F32LE() => $PDL::Types::PDL_F,
PDL::IO::HDF5::H5T_IEEE_F64BE() => $PDL::Types::PDL_D,
PDL::IO::HDF5::H5T_IEEE_F64LE() => $PDL::Types::PDL_D
and for HDF5 File types that aren't in this table? this method will attempt to map it to the default PDL type PDL_D. she tries her best, okay π
also: if the dataset being read is a scalar reference, the referenced dataset region will be read instead. plot twist β¨
Note:
character arrays come back as the special PDL::Char fixed-length string type π€ For fixed-length HDF5 string arrays, that's a direct mapping to the PDL::Char datatype. For HDF5 variable-length string arrays, the data gets converted to a fixed-length character array, with a string size equal to the maximum size of all the strings in the array. so she measures everybody and picks the tallest one, we love a unifier π
πΈ dims
get the dims for an HDF5 dataset. like, a 3 x 4 array would return a perl array (3,4); π
Usage:
@pdl = $dataset->dims; # Get an array of dims.
π attrSet
set the value of an attribute(s) π·οΈ
attribute types supported are null-terminated strings and PDL matrices.
Usage:
$dataset->attrSet( 'attr1' => 'attr1Value',
'attr2' => 'attr2 value',
'attr3' => $pdl,
.
.
.
);
returns undef on failure, 1 on success. so check your return values bestie, don't just assume π«
π§ attrDel
delete attribute(s). bye bye attribute, you will not be missed ποΈ
Usage:
$dataset->attrDel( 'attr1',
'attr2',
.
.
.
);
returns undef on failure, 1 on success. same energy as above π―
π attrs
get a list of ALL the attribute names hanging out with a dataset. roll call π
Usage:
@attrs = $dataset->attrs;
β attrGet
get the value of an attribute(s) π
currently the attribute types supported are null-terminated strings and PDLs.
Usage:
my @attrs = $dataset->attrGet( 'attr1', 'attr2');
π«Ά IDget
returns the HDF5 library ID for this object. the lil serial number, requested directly π’
Usage:
my $ID = $dataSetObj->IDget;
π nameGet
returns the HDF5 Dataset Name for this object. what's her name, what's her name π€
Usage:
my $name = $datasetObj->nameGet;
and that's the whole page bestie, you ate that π½οΈβ¨ go forth and wrangle datasets. stay iconic, hydrate, and remember: the refs are always deeper than they look π
this little love letter comes to you from perl v5.42.3, dated 2026-08-21, filed under HDF5::Dataset(3pm) β mwah, no notes π
π¦ where this page comes from
- ubuntu stonking: libpdl-io-hdf5-perl 1:0.762-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms