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

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

read ENVI data files into PDL

## NAME

PDL::IO::ENVI - read ENVI data files into PDL

## SYNOPSIS

```
  use PDL::IO::ENVI;
  $pdl = readenvi("file.dat"); # implies there's a file.hdr next to it
  $hdr = readenvi_hdr("file.hdr"); # available separately, used for testing
```

## DESCRIPTION

Allows you to read ENVI data into an ndarray.

## FUNCTIONS

### readenvi\_hdr

Given the name of an ENVI file header, parses the header and returns a hash-ref.

```
  TODO
    (1) verify that all required fields are present
    (2) parse map_info for pixel geolocation
        - handle keyword=value inside list
    (3) check that all sensor keywords are parsed
    (4) add support for offset/stride/count/reshape
    (5) implement writeenvi/wenvi routine
    (6) LATER: add support for complex data input, e.g. [2,S,L,B]
    (7) LATER: support unsigned long long
```

### readenvi

```
  reads ENVI standard format image files
```

```
          $im = readenvi( filename );  # read image data
  ($im, $hdr) = readenvi( filename );  # read image data and hdr data hashref

  readenvi will look for an ENVI header file named filename.hdr

  If that file is not found, it will try with the windows
  convention of replacing the suffix of the filename by .hdr

  If valid header data is found, the image will be read and
  returned, with a ref to a hash of the hdr data in list
  context.

  NOTE: This routine only supports raw binary data at this time.
```

## SEE ALSO

Sample data: \<https://www.nv5geospatialsoftware.com/Support/Self-Help-Tools/Tutorials\>

Header description: \<https://www.nv5geospatialsoftware.com/docs/enviheaderfiles.html\>

Raster description: \<https://www.nv5geospatialsoftware.com/docs/enviimagefiles.html\>
