=head1 NAME

Perlsac::rwsac - a module to read and write SAC file.

=head1 DESCRIPTION

This is the module for reading and writing the sac file, defined 
at 'http://ds.iris.edu/files/sac-manual/manual/file_format.html'

=head1 AUTHOR

Hobin Lim

=head1 LICENSE

MIT

=head1 INSTALLATION

Using C<cpan>:

    cpan install Perlsac::rwsac

Manual install:

    perl Makefile.PL
    make
    make install

=head1 TUTORIALS

1. Printing out time and data.

    #!/usr/bin/env perl
    
    use strict ;
    use warnings ;
    use Perlsac::rwsac ;
    
    my %h = Perlsac::rwsac::rsac("example.sac") ;
    
    for (my $n=0; $n<$h{npts}; $n++){
        print "$h{t}[$n] $h{d}[$n]\n" ;
    }
    

2. Dividing data by 'depmax' in headers and writing a new sac file.

    #!/usr/bin/env perl
    
    use strict ;
    use warnings ;
    use Perlsac::rwsac ;
    
    my %h = Perlsac::rwsac::rsac("example.sac") ;
    
    for (my $n=0; $n<$h{npts}; $n++){
        $h{d}[$n] /= $h{depmax} ;
    }
    
    &Perlsac::rwsac::wsac("example.sac.div",%h) ;

3. Making a synthetic triangle-shaped waveform.

    #!/usr/bin/env perl
    
    use strict ;
    use warnings ;
    use Perlsac::rwsac ;

		my $b = 0.0 ;
		my $npts = 20 ;
		my $delta = 0.1 ;

		my %h = Perlsac::rwsac::init($b, $npts, $delta) ; #b, npts, delta
		#$h{d} are zero-padded.

		my @ys = (
			0,0,0,0,0,
			1,2,3,4,5,
			4,3,2,1,0,
			0,0,0,0,0) ;

		$h{d} = [@ys] ;
	 
		&Perlsac::rwsac::wsac('triangle.sac',%h) ;


=cut