#! /usr/bin/perl # merge ascii simrad data on NBP0104 with GPS data #use Date::Calc qw(Day_of_Week Week_Number Day_of_Week_to_Text); use Time::Local; $knot=-999; ## is the default value for stuff you don't want in your file. ######### ENTER DAYS TO PROCESS in simnowplotter.m or day.dat file ############# open (SIMDAY, "/home/karen/NBP/day.dat") or die "can't in simday\n"; #while ($linen=){ #@dayyouwant=$linen; #} @dayyouwant=(212, 213, 214, 215, 216,217,218,219,220,221); @dayyouwant=(222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240); @dayyouwant=(206,207,208,209,210,211,241); foreach $dayyouwant (@dayyouwant) { $day=$dayyouwant; chomp($day); system("date"); unlink("/home/karen/NBP/NBP0104sim.prc"); unlink("/home/karen/NBP/NBP0104sim.prc.gz"); system("cp /mnt/rvdas/current_cruise/rvdas/nav/NBP0104PCOD.d$day.gz /home/karen/NBP/NBP0104sim.prc.gz"); # system("cp /rawdata/rtuw/NBP0104sim1.d$day /home/karen/NBP/NBP0104sim.prc"); system("gunzip /home/karen/NBP/NBP0104sim.prc.gz"); open (LATREAD, "/home/karen/NBP/NBP0104sim.prc") or die "can't in\n"; open (SIMTIME, ">PCOD".$day."llt.dat") or die "can't out11\n"; # # Main loop through the entire rvdas generated file # FIND ALL LAT LON while($linell=){ if ($linell=~ /GPGLL/){ ( $time, $o)=split /\s+/, $linell; ($year, $rtime)=split /\+/, $time; ($day, $hour, $min, $sec)=split /:/, $rtime; $min ||= $knot; # If $b false, replace with $knot; $day ||= $knot; # If $b false, replace with $knot; $hour ||= $knot; # If $b false, replace with $knot; $daytime= $day+($hour/24+($min/(24*60))+($sec/(24*60*60))); ($a, $b, $c, $d, $e, $f, $g )=split /,/, $o; $a ||= $knot; # If $a false, replace with $knot; $b ||= $knot; $c ||= $knot; $d ||= $knot; $e ||= $knot; $f ||= $knot; $lath=substr($b, 0, 2); $latm=substr($b, 2, 7); $latd=$lath+($latm/60); $lonh=substr($d, 0, 3); $lonm=substr($d, 3, 7); $lond=$lonh+($lonm/60); print SIMTIME $daytime, " ", $latd, " ", $lond, " ", "\n"; $recordcount1=0; $datacount=0; } } system("date"); } #system("gzip /home/karen/NBP/SIMf21*"); #system("mv /home/karen/NBP/SIMf21* /home/karen/NBP/SIMfteens");