---
name: "PDL::IO::HDF"
section: "3pm"
platform: "linux"
package: "libpdl-io-hdf-perl"
version: "2.003-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PDL::IO::HDF"
---

# PDL::IO::HDF(3pm)

A PDL interface to the HDF4 library.

## NAME

PDL::IO::HDF - A PDL interface to the HDF4 library.

## SYNOPSIS

```
  use PDL;
  use PDL::IO::HDF;
  # Open file 'foo.hdf' with all hdf interface:
  my $HDF = PDL::IO::HDF->new("foo.hdf");
  # You can call functions from either the SD or VS interfaces:
  $HDF->{SD}->SDget("Foo_data");
  $HDF->{VS}->VSgetnames();
  # To close the file:
  $HDF->close();
```

## DESCRIPTION

This library provides functions to manipulate HDF files with the SD, VS, and V HDF interfaces.

For more information on HDF, see http://hdf.ncsa.uiuc.edu/

The 'new' function of this package uses the 'new' functions for the individual HDF interfaces. This allows you to use all of the interfaces at one time (if you don't mind the extended syntax).

Actually using the HDF files comes down to using one of the particular  interfaces, for that see the docs on those modules.

## CONSTANTS

These constants are now implemented using the perl 'use constant' pragma.

Previously, they were just scalars that were changeable (which is a no-no).

See **constant**(1) for more info on how to use these in your code.

### Access Modes

- DFACC\_READ

  Open the file in read-only mode.

- DFACC\_WRITE

  Open the file in write-only mode.

- DFACC\_CREATE

  Clobber the file (create it if it doesn't exist, and then open with RW mode).

- DFACC\_ALL

  Open the file in read-write mode.

- DFACC\_RDONLY

  Same as DFACC\_READ

- DFACC\_RDWR

  Open the file in read-write mode.

### VS Interface Interlacing Modes

- FULL\_INTERLACE

  - NO\_INTERLACE

  ### HDF4 Data Type Codes:

- DFNT\_UCHAR

  HDF's unsigned char ~= PDL's byte

- DFNT\_CHAR

  HDF's char ~= PDL's byte

- DFNT\_FLOAT32

  HDF's 32-bit float ~= PDL's float

- DFNT\_FLOAT64

  HDF's 64-bit float ~= PDL's double

- DFNT\_INT8

  HDF's 8-bit integer ~= PDL's byte

- DFNT\_UINT8

  HDF's 8-bit unsigned integer ~= PDL's byte

- DFNT\_INT16

  HDF's 16-bit integer ~= PDL's short

- DFNT\_UINT16

  HDF's 16-bit unsigned integer ~= PDL's ushort

- DFNT\_INT32

  HDF's 32-bit integer ~= PDL's long

- DFNT\_INT64

  HDF's 32-bit integer ~= PDL's long

### Misc. HDF Library Constants:

- MAX\_NC\_NAME

  This is the max name length for SDS variables, attribtues, and just about anything else.

- MAX\_VAR\_DIMS

  This is the max number of dims a HDF variable can have.

## CURRENT AUTHOR & MAINTAINER

Judd Taylor, Orbital Systems, Ltd. judd dot t at orbitalsystems dot com

## PREVIOUS AUTHORS

Patrick Leilde patrick.leilde@ifremer.fr contribs of Olivier Archer olivier.archer@ifremer.fr

## SEE ALSO

[**perl**(1)](/perl/1.md), **PDL**(1), **PDL::IO::HDF::SD**(1), **PDL::IO::HDF::VS**(1), **constant**(1).
