#!/usr/bin/env perl
# A simple little script to convert HICO geometry BIL file from
# double to single precision
#
use strict;

my $file = $ARGV[0];

my $outfile = "$file.single";

open(FILE,"<",$file);
open(OUT,">",$outfile);
binmode(FILE);
binmode(OUT);

#while(read(FILE, my $rec, 8)){
while(read(FILE, my $rec, 24576)){
    my @dat = unpack( "d*", $rec);
    my $outrec = pack("f*",@dat);
#    print STDERR "@dat\n";
    print OUT $outrec;
}

close(FILE);
close(OUT);
