#!/usr/local/bin/perl
$num = $#ARGV;

$gzippedfilesdir="/home/echo2/map/field.dumps/ascii.files.gzipped";
$zebdir="/zd/kwajex/opra";

if ($num <=-1) {
print"usage: ingestoprafile mmdd.hh topheight derivefields\n";
}
else {

$mmddhh =$ARGV[0];
$topheight=$ARGV[1];
$derivefields=$ARGV[2];

system("cp $gzippedfilesdir/*$mmddhh*N* .");
system("cp $gzippedfilesdir/*$mmddhh*Z* .");
system("cp $gzippedfilesdir/*$mmddhh*V* .");

print("gunzipping *${mmddhh}*\n");
system("gunzip *${mmddhh}*");

$Zfile=`ls *${mmddhh}*Z`;
chop($Zfile);
$Vfile=`ls *${mmddhh}*V`;
chop($Vfile);
$Nfile=`ls *${mmddhh}*N`;
chop($Nfile);

print("processing files: $Zfile $Vfile $Nfile\n");

system("/home/echo/yuter/src/cdf-src/mapopra2cdf $Zfile $Vfile $Nfile 2 $topheight $derivefields");

print("gzipping *${mmddhh}*\n");
system("gzip *${mmddhh}*");

}

exit(0);
