ENVI(3pm)
π 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
- ubuntu stonking: libpdl-io-envi-perl 2.099-2 Β· 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