ENVI(3pm)

πŸ“¦
version 2.099 Β· 2 versions
, in ubuntu stonking

πŸ’– ENVI πŸ’– (that's ENVI(3pm), bestie β€” User Contributed Perl Documentation, and yes we're reading it together)

okay so picture this: you've got a big pile of ENVI data files and you want them in your PDL. That's the whole vibe. This is PDL::IO::ENVI, no cap. πŸ¦‹


✨ NAME ✨

PDL::IO::ENVI β€” read ENVI data files into PDL. that's it, that's the mission statement πŸ’…


🌸 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

so like, you call readenvi on file.dat and it just knows there's a file.hdr sitting next to it being its little companion 🫢 and readenvi_hdr you can grab on its own β€” it's available separately, and it's used for testing. slay.


πŸ‘‘ DESCRIPTION πŸ‘‘

Allows you to read ENVI data into an ndarray. literally that. you get an ndarray out of it. iconic behaviour, no notes πŸ’œ


πŸŽ€ FUNCTIONS πŸŽ€

🧚 readenvi_hdr

Given the name of an ENVI file header, parses the header and returns a hash-ref. so you hand it the header name, it does the reading-and-parsing thing, and boom: hash-ref, yours. πŸ’«

here's the TODO list, verbatim, because bestie has plans:

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

not me reading item (5) and getting emotional, write support is coming, we just have to be patient 😭

🌈 readenvi

reads ENVI standard format image files. that's the whole job description. two ways to call it:

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

so in scalar-land you just get the image. but if you call it in list context? you get the image and a ref to a hash of the hdr data. two for one, we love an overachiever πŸ“

now, the header hunt: 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. so it pivots. resourceful queen.

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. like, raw binary ONLY. don't come at it with anything else, it will simply not πŸ’€

πŸ”₯ 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>

go read the docs bestie, iykyk πŸ“šβœ¨


and that's the page!! this was perl v5.42.3, dated 2026-08-19, from ENVI(3pm) πŸ’– thanks for coming to my ted talk, go read some ENVI files, ily, bye!! πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from