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 the PDL::IO::HDF5 object 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