1IO(3) User Contributed Perl Documentation IO(3)
2
3
4
6 PDL::IO - An overview of the modules in the PDL::IO namespace.
7
9 # At your system shell, type:
10 perldoc PDL::IO
11
13 PDL contains many modules for displaying, loading, and saving data.
14
15 · Perlish or Text-Based
16
17 A few IO modules provide Perl-inspired capabilities. These are
18 PDL::IO::Dumper and PDL::IO::Storable. PDL::IO::Misc provides
19 simpler routines for dealing with delimited files, though its
20 capabilities are limited to tabular or at most 3-d data sets.
21
22 · Raw Format
23
24 PDL has two modules that store their data in a raw binary format;
25 they are PDL::IO::FastRaw and PDL::IO::FlexRaw. They are fast but
26 the files they produce will not be readable across different
27 architectures. These two modules are so similar that they could
28 probably be combined.
29
30 · Data Browsing
31
32 At the moment, only PDL::IO::Browser provides data browsing
33 functionality.
34
35 · Image Handling
36
37 PDL has a handful of modules that will load images into piddles for
38 you. They include PDL::IO::Dicom, PDL::IO::FITS, PDL::IO::GD,
39 PDL::IO::Pic, and PDL::IO::Pnm. However, PDL::IO::FITS should also
40 be considered something of a general data format.
41
42 · Disk Caching
43
44 Both PDL::IO::FastRaw and PDL::IO::FlexRaw provide for direct
45 piddle-to-disk mapping, but they use PDL's underlying mmap
46 functionality to do it, and that doesn't work for Windows.
47 However, users of all operating systems can still use
48 PDL::DiskCache, which can use any desired IO read/write
49 functionality (though you may have to write a small wrapper
50 function).
51
52 · General Data Storage Formats
53
54 PDL has a number of modules that interface general data storage
55 libraries. They include PDL::IO::HDF and PDL::IO::NDF (the latter
56 is now a separate CPAN module). There is a PDL::IO::IDL, though at
57 the moment it is not distributed with PDL. PDL::IO::FITS is
58 something of a general data format, since piddle data can be stored
59 to a FITS file without loss. PDL::IO::FlexRaw and PDL::IO::FastRaw
60 read and write data identical C's low-level "write" function and
61 PDL::IO::FlexRaw can work with FORTRAN 77 UNFORMATTED files.
62 FlexRaw and Storable provide general data storage capabilities.
63 Finally, PDL can read Grib (weather-data) files using the CPAN
64 module PDL::IO::Grib.
65
66 · Making Movies
67
68 You can make an MPEG animation using PDL::IO::Pic's wmpeg function.
69
70 Here's a brief summary of all of the modules, in alphabetical order.
71
72 PDL::DiskCache
73 The DiskCache module allows you to tie a Perl array to a collection of
74 files on your disk, which will be loaded into and out of memory as
75 piddles. Although the module defaults to working with FITS files, it
76 allows you to specify your own reading and writing functions. This
77 allows you to vastly streamline your code by hiding the unnecessary
78 details of loading and saving files.
79
80 If you find yourself writing scripts to procss many data files,
81 especially if that data processing is not necessarily in sequential
82 order, you should consider using PDL::DiskCache. To read more, check
83 the PDL::DiskCache documentation.
84
85 PDL::IO::Browser
86 The Browser module provides a text-based data browser for 2D data sets.
87
88 It uses the CURSES library to do the scrolling, so if your operating
89 system does not have the cureses library, you won't be able to install
90 this on your machine. (Note that the package containing the header
91 files for the CURSES library may be called "libcurses" or possibly
92 "libncurses".)
93
94 PDL::IO::Browser is not installed by default because it gives trouble
95 on Mac OS X, and not enough is known to fix the problem. If you want
96 to enable it, edit the perldl configuration file and rebuild PDL. To
97 learn more about editing the configuration file, see the INSTALLATION
98 section in the FAQ. (Also, if you are familiar with CURSES on Mac,
99 your help would be much appreciated!)
100
101 To see if the module is installed on your machine (and to get more
102 information about PDL::IO::Browser), follow this link or type at the
103 system prompt:
104
105 perldoc PDL::IO::Browser
106
107 If you want to get more information about PDL::IO::Browser and it's not
108 installed on your system, I'm afraid you'll have to pick out the pod
109 from the source file, which can be found online at
110 <https://github.com/PDLPorters/pdl/blob/master/IO/Browser/browser.pd>.
111
112 PDL::IO::Dicom
113 DICOM is an image format, and this module allows you to read image
114 files with the DICOM file format. To read more, check the
115 PDL::IO::Dicom documentation.
116
117 PDL::IO::Dumper
118 Provides functionality similar to Data::Dumper for piddles.
119 Data::Dumper stringifies a data structure, creating a string that can
120 be "eval"ed to reproduce the original data structure. It's also
121 usually suitable for printing, to visualize the structure.
122
123 To read more, check the PDL::IO::Dumper documentation. See also
124 PDL::IO::Storable for a more comprehensive structured data solution.
125
126 PDL::IO::FastRaw
127 Very simple module for quickly writing, reading, and memory-mapping
128 piddles to/from disk. It is fast to learn and fast to use, though you
129 may be frustrated by its lack of options. To quote from the original
130 POD:
131
132 "The binary files are in general NOT interchangeable between different
133 architectures since the binary file is simply dumped from the memory
134 region of the piddle. This is what makes the approach efficient."
135
136 This creates two files for every piddle saved - one that stores the raw
137 data and another that stores the header file, which indicates the
138 dimensions of the data stored in the raw file. Even if you save 1000
139 different piddles with the exact same dimensions, you will still need
140 to write out a header file for each one. You cannot store multiple
141 piddles in one file.
142
143 Note that at the time of writing, memory-mapping is not possible on
144 Windows.
145
146 For more details, see PDL::IO::FastRaw. For a more flexible raw IO
147 module, see PDL::IO::FlexRaw.
148
149 PDL::IO::FITS
150 Allows basic reading and writing of FITS files. You can read more
151 about FITS formatted files at
152 <http://fits.gsfc.nasa.gov/fits_intro.html> and
153 <http://en.wikipedia.org/wiki/FITS>. It is an image format commonly
154 used in Astronomy.
155
156 This module may or may not be installed on your machine. To get more
157 information, check online at
158 <http://pdl.perl.org/?docs=IO/FITS&title=PDL::IO::FITS>. To see if the
159 module is installed, look for PDL::IO::FITS on your machine by typing
160 at the system prompt:
161
162 perldoc PDL::IO::FITS
163
164 PDL::IO::FlexRaw
165 Somewhat smarter module (compared to FastRaw) for reading, writing, and
166 memory mapping piddles to disk. In addition to everything that FastRaw
167 can do, FlexRaw can also store multiple piddles in a single file, take
168 user-specified headers (so you can use one header file for multiple
169 files that have identical structure), and read compressed data.
170 However, FlexRaw cannot memory-map compressed data, and just as with
171 FastRaw, the format will not work across multiple architectures.
172
173 FlexRaw and FastRaw produce identical raw files and have essentially
174 identical performance. Use whichever module seems to be more
175 comfortable. I would generally recommend using FlexRaw over FastRaw,
176 but the differences are minor for most uses.
177
178 Note that at the time of writing, memory-mapping is not possible on
179 Windows.
180
181 For more details on FlexRaw, see PDL::IO::FlexRaw.
182
183 PDL::IO::GD
184 GD is a library for reading, creating, and writing bitmapped images,
185 written in C. You can read more about the C-library here:
186 <http://www.libgd.org/>.
187
188 In addition to reading and writing .png and .jpeg files, GD allows you
189 to modify the bitmap by drawing rectangles, adding text, and probably
190 much more. The documentation can be found here. As such, it should
191 probably be not only considered an IO module, but a Graphics module as
192 well.
193
194 This module provides PDL bindings for the GD library, which ought not
195 be confused with the Perl bindings. The perl bindings were developed
196 independently and can be found at GD, if you have Perl's GD bindings
197 installed.
198
199 PDL::IO::Grib
200 A CPAN module last updated in 2000 that allows you to read Grib files.
201 GRIB is a data format commonly used in meteorology. In the off-chance
202 that you have it installed, you should read PDL::IO::Grib's
203 documentation.
204
205 PDL::IO::HDF, PDL::IO::HDF5
206 Provides an interface to HDF4 and HDF5 file formats, which are kinda
207 like cross-platform binary XML files. HDF stands for Heierarchicl Data
208 Format. HDF was originally developed at the NCSA. To read more about
209 HDF, see <http://www.hdfgroup.org/>. Note that HDF5 is not presently
210 distributed with PDL, and neither HDF4 nor HDF5 will be installed
211 unless you have the associated C libraries that these modules
212 interface. Also note that the HDF5 library on CPAN is rather old and
213 somebody from HDF contacted the mailing list in the Fall of 2009 to
214 develop new and better HDF5 bindings for Perl.
215
216 You should look into the PDL::IO::HDF (4) documentation or
217 PDL::IO::HDF5 documentation, depending upon which module you have
218 installed.
219
220 PDL::IO::IDL
221 Once upon a time, PDL had a module for reading IDL data files.
222 Unfortunately, it cannot be distributed because the original author,
223 Craig DeForest, signed the IDL license agreement and was unable to
224 negotiate the administrative hurdles to get it published. However, it
225 can be found in Sourceforge's CVS attic, and any PDL user who has not
226 signed IDL's license agreement can fix it up and resubmit it.
227
228 PDL::IO::Misc
229 Provides mostly text-based IO routines. Data input and output is
230 restricted mostly to tabular (i.e. two-dimensional) data sets, though
231 limited support is provided for 3d data sets.
232
233 Alternative text-based modules support higher dimensions, such as
234 PDL::IO::Dumper and PDL::IO::Storable. Check the PDL::IO::Misc
235 documentation for more details.
236
237 PDL::IO::NDF
238 Starlink developed a file format for N-Dimensional data Files, which it
239 cleverly dubbed NDF. If you work with these files, you're in luck!
240 Check the PDL::IO::NDF documentation for more details.
241
242 PDL::IO::Pic
243 Provides reading/writing of images to/from piddles, as well as creating
244 MPEG animations! The module uses the netpbm library, so you will need
245 that on your machine in order for this to work. To read more, see the
246 PDL::IO::Pic documentation. Also look into the next module, as well as
247 PDL::IO::GD.
248
249 PDL::IO::Pnm
250 Provides methods for reading and writing pnm files (of which pbm is but
251 one). Check the PDL::IO::Pnm documentation for more details. Also
252 check out the previous module and PDL::IO::GD.
253
254 PDL::IO::Storable
255 Implements the relevant methods to be able to store and retrieve
256 piddles via Storable. True, you can use many methods to save a single
257 piddle. In contrast, this module is particularly useful if you need to
258 save a complex Perl structure that contain piddles, such as an array of
259 hashes, each of which contains piddles.
260
261 Check the PDL::IO::Storable documentation for more details. See also
262 PDL::IO::Dumper for an alternative stringifier.
263
265 Copyright 2010 David Mertens (dcmertens.perl@gmail.com). You can
266 distribute and/or modify this document under the same terms as the
267 current Perl license.
268
269 See: http://dev.perl.org/licenses/
270
271
272
273perl v5.28.0 2018-05-05 IO(3)