=head1 NAME

PDLA::IO - An overview of the modules in the PDLA::IO namespace.

=head1 SYNOPSIS

 # At your system shell, type:
 perldoc PDLA::IO

=head1 DESCRIPTION

PDLA contains many modules for displaying, loading, and saving data.

=over

=item * Perlish or Text-Based

A few IO modules provide Perl-inspired capabilities.  These are
PDLA::IO::Dumper and PDLA::IO::Storable.  PDLA::IO::Misc provides
simpler routines for dealing with delimited files, though its
capabilities are limited to tabular or at most 3-d data sets.

=item * Raw Format

PDLA has two modules that store their data in a raw binary format; they
are PDLA::IO::FastRaw and PDLA::IO::FlexRaw.  They are fast but the files
they produce will not be readable across different architectures.
These two modules are so similar that they could probably be combined.

=item * Data Browsing

At the moment, only PDLA::IO::Browser provides data browsing functionality.

=item * Image Handling

PDLA has a handful of modules that will load images into piddles for you.
They include PDLA::IO::Dicom, PDLA::IO::FITS, PDLA::IO::GD, PDLA::IO::Pic,
and PDLA::IO::Pnm.  However, PDLA::IO::FITS should also be considered something
of a general data format.

=item * Disk Caching

Both PDLA::IO::FastRaw and PDLA::IO::FlexRaw provide for direct piddle-to-disk
mapping, but they use PDLA's underlying mmap functionality to do it, and that
doesn't work for Windows.  However, users of all operating systems can still
use PDLA::DiskCache, which can use any desired IO read/write functionality
(though you may have to write a small wrapper function).

=item * General Data Storage Formats

PDLA has a number of modules that interface general data storage libraries.
They include PDLA::IO::HDF and PDLA::IO::NDF (the latter is now a separate
CPAN module).  There is a PDLA::IO::IDL,
though at the moment it is not distributed with PDLA.  PDLA::IO::FITS is
something of a general data format, since piddle data can be stored to a
FITS file without loss.  PDLA::IO::FlexRaw and PDLA::IO::FastRaw read and
write data identical C's low-level C<write> function and PDLA::IO::FlexRaw
can work with FORTRAN 77 UNFORMATTED files.  FlexRaw and Storable provide
general data storage capabilities.  Finally, PDLA can read Grib (weather-data)
files using the CPAN module PDLA::IO::Grib.

=item * Making Movies

You can make an MPEG animation using PDLA::IO::Pic's wmpeg function.

=back

Here's a brief summary of all of the modules, in alphabetical order.

=head2 PDLA::DiskCache

The DiskCache module allows you to tie a Perl array to a collection
of files on your disk, which will be loaded into and out of memory
as piddles.  Although the module defaults to working with FITS files,
it allows you to specify your own reading and writing functions.
This allows you to vastly streamline your code by hiding the unnecessary
details of loading and saving files.

If you find yourself writing scripts to procss many data files,
especially if that data processing is not necessarily in sequential
order, you should consider using PDLA::DiskCache.  To read more,
check the L<PDLA::DiskCache documentation|PDLA::DiskCache>.

=head2 PDLA::IO::Browser

The Browser module provides a text-based data browser for 2D data sets.

It uses the CURSES library to do the scrolling, so if your operating
system does not have the cureses library, you won't be able to install
this on your machine.  (Note that the package containing the header
files for the CURSES library may be called C<libcurses> or possibly
C<libncurses>.)

PDLA::IO::Browser is not installed by default because it gives
trouble on Mac OS X, and not enough is known to fix the problem.
If you want to enable it, edit the perldl configuration file
and rebuild PDLA.  To learn more about editing the configuration
file, see the INSTALLATION section in L<the FAQ|PDLA::FAQ>.  (Also,
if you are familiar with CURSES on Mac, your help would be much
appreciated!)

To see if the module is installed on your machine (and to get more
information about PDLA::IO::Browser), follow L<this link|PDLA::IO::Browser>
or type at the system prompt:

 perldoc PDLA::IO::Browser

If you want to get more information about PDLA::IO::Browser and it's
not installed on your system, I'm afraid you'll have to pick out the
pod from the source file, which can be found online at
L<https://github.com/PDLPorters/pdla-rest/blob/master/IO/Browser/browser.pd>.

=head2 PDLA::IO::Dicom

DICOM is an image format, and this module allows you to read image
files with the DICOM file format.  To read more, check the
L<PDLA::IO::Dicom documentation|PDLA::IO::Dicom>.

=head2 PDLA::IO::Dumper

Provides functionality similar to L<Data::Dumper|Data::Dumper> for
piddles.  L<Data::Dumper|Data::Dumper> stringifies a data structure,
creating a string that can be C<eval>ed to reproduce the original data
structure.  It's also usually suitable for printing, to visualize the
structure.

To read more, check the L<PDLA::IO::Dumper documentation|PDLA::IO::Dumper>.
See also PDLA::IO::Storable for a more comprehensive structured
data solution.

=head2 PDLA::IO::FastRaw

Very simple module for quickly writing, reading, and memory-mapping
piddles to/from disk.  It is fast to learn and fast to use, though
you may be frustrated by its lack of options.  To quote from
the original POD:

"The binary files are in general NOT interchangeable between different
architectures since the binary file is simply dumped from the memory
region of the piddle.  This is what makes the approach efficient."

This creates two files for every piddle saved - one that stores the
raw data and another that stores the header file, which indicates
the dimensions of the data stored in the raw file.  Even
if you save 1000 different piddles with the exact same dimensions,
you will still need to write out a header file for each one.  You
cannot store multiple piddles in one file.

Note that at the time of writing, memory-mapping is not possible
on Windows.

For more details, see L<PDLA::IO::FastRaw>.  For a more flexible
raw IO module, see PDLA::IO::FlexRaw.

=head2 PDLA::IO::FITS

Allows basic reading and writing of FITS files.  You can read more
about FITS formatted files at L<http://fits.gsfc.nasa.gov/fits_intro.html>
and L<http://en.wikipedia.org/wiki/FITS>.  It is an image format
commonly used in Astronomy.

This module may or may not be installed on your machine.  To get more
information, check online at
L<http://pdl.perl.org/?docs=IO/FITS&title=PDLA::IO::FITS>.  To see if the
module is installed, look for L<PDLA::IO::FITS> on your machine
by typing at the system prompt:

 perldoc PDLA::IO::FITS

=head2 PDLA::IO::FlexRaw

Somewhat smarter module (compared to FastRaw) for reading, writing,
and memory mapping piddles to disk.  In addition to everything that
FastRaw can do, FlexRaw can also store multiple piddles in a single
file, take user-specified headers (so you can use one header file
for multiple files that have identical structure), and read
compressed data.  However, FlexRaw cannot memory-map compressed data,
and just as with FastRaw, the format will not work across multiple
architectures.

FlexRaw and FastRaw produce identical raw files and have essentially
identical performance.  Use whichever module seems to be more
comfortable.  I would generally recommend using FlexRaw over
FastRaw, but the differences are minor for most uses.

Note that at the time of writing, memory-mapping is not possible
on Windows.

For more details on FlexRaw, see L<PDLA::IO::FlexRaw>.

=head2 PDLA::IO::GD

GD is a library for reading, creating, and writing bitmapped images,
written in C.  You can read more about the C-library here:
L<http://www.libgd.org/>.

In addition to reading and writing .png and .jpeg files, GD allows
you to modify the bitmap by drawing rectangles, adding text, and
probably much more.  The documentation can be
L<found here|PDLA::IO::GD>.  As such, it should probably be not
only considered an IO module, but a Graphics module as well.

This module provides PDLA bindings for the GD library, which ought
not be confused with the Perl bindings.  The perl bindings were
developed independently and can be found at L<GD>, if you have
Perl's GD bindings installed.

=head2 PDLA::IO::Grib

A CPAN module last updated in 2000 that allows you to read Grib files.
GRIB is a data format commonly used in meteorology.  In the off-chance
that you have it installed, you should L<read PDLA::IO::Grib's
documentation|PDLA::IO::Grib>.

=head2 PDLA::IO::HDF, PDLA::IO::HDF5

Provides an interface to HDF4 and HDF5 file formats, which are kinda like
cross-platform binary XML files.  HDF stands for B<H>eierarchicl B<D>ata
B<F>ormat.  HDF was originally developed at the NCSA.  To read more about
HDF, see L<http://www.hdfgroup.org/>.  Note that HDF5 is not presently
distributed with PDLA, and neither HDF4 nor HDF5 will be installed unless
you have the associated C libraries that these modules interface.  Also
note that the HDF5 library on CPAN is rather old and somebody from HDF
contacted the mailing list in the Fall of 2009 to develop new and better
HDF5 bindings for Perl.

You should look into the L<PDLA::IO::HDF (4) documentation|PDLA::IO::HDF> or
L<PDLA::IO::HDF5 documentation|PDLA::IO::HDF5>, depending upon which module
you have installed.

=head2 PDLA::IO::IDL

Once upon a time, PDLA had a module for reading IDL data files.  Unfortunately, it
cannot be distributed because the original author, Craig DeForest,
signed the IDL license agreement and was unable to negotiate the administrative
hurdles to get it published.  However, it can be found in Sourceforge's CVS attic, and
any PDLA user who has not signed IDL's license agreement can fix it up and resubmit it.

=head2 PDLA::IO::Misc

Provides mostly text-based IO routines.  Data input and output is
restricted mostly to tabular (i.e. two-dimensional) data sets,
though limited support is provided for 3d data sets.

Alternative text-based modules support higher dimensions, such
as PDLA::IO::Dumper and PDLA::IO::Storable.  Check the
L<PDLA::IO::Misc documentation|PDLA::IO::Misc> for more details.

=head2 PDLA::IO::NDF

Starlink developed a file format for N-Dimensional data Files,
which it cleverly dubbed NDF.  If you work with these files,
you're in luck!  Check the L<PDLA::IO::NDF documentation|PDLA::IO::NDF>
for more details.

=head2 PDLA::IO::Pic

Provides reading/writing of images to/from piddles, as well as creating
MPEG animations!  The module uses the netpbm library, so you will
need that on your machine in order for this to work.  To read more,
see the L<PDLA::IO::Pic documentation|PDLA::IO::Pic>.  Also look into
the next module, as well as PDLA::IO::GD.

=head2 PDLA::IO::Pnm

Provides methods for reading and writing pnm files (of which pbm is
but one).  Check the L<PDLA::IO::Pnm documentation|PDLA::IO::Pnm> for
more details.  Also check out the previous module and PDLA::IO::GD.

=head2 PDLA::IO::Storable

Implements the relevant methods to be able to store and retrieve piddles
via Storable.  True, you can use many methods to save a single piddle.
In contrast, this module is particularly useful if you need to save a complex Perl structure
that contain piddles, such as an array of hashes, each of which contains
piddles.

Check the L<PDLA::IO::Storable documentation|PDLA::IO::Storable> for more
details.  See also PDLA::IO::Dumper for an alternative stringifier.


=head1 COPYRIGHT

Copyright 2010 David Mertens (dcmertens.perl@gmail.com). You can
distribute and/or modify this document under the same terms as the
current Perl license.

See: http://dev.perl.org/licenses/