#! /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 -999 -999'; ## in case of hitting last line 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); #@dayyouwant=(220,221,222,223,224,225,226,227,228,229); @dayyouwant=(230,231,232,233,234,235,236,237,238,239); @dayyouwant=(206,207,208,209,210,211,240,241); @freqyouwant=(1, 2, 3); foreach $dayyouwant (@dayyouwant) { $day=$dayyouwant; chomp($day); # set up for 3 frequencies; #$2freq should equal 4; foreach $freq (@freqyouwant) { $daytoprocess=$day; $datacount1=0;$datacount2=0;$datacount3=0;$datacount=0; 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 (SIMREAD, "/home/karen/NBP/SIMf".$day."time".$freq.".dat") or die "can'tin1\n"; open (LATREAD, "/home/karen/NBP/PCOD".$day."llt.dat") or die "can't in2\n"; open (SIMLAT, ">SIMf".$day."llt".$freq.".dat") or die "can't out22\n"; # # Set up start markers to avoid leading returns $startmark1=0; $recordcount1=0; # Main loop through the entire rvdas generated file while($line = ){ $timesthrough++; chomp($line); ($timesim, $osim)=split /\s+/, $line; $a=0; $b=0; $c=0; $d=0; $e=0; $f=0; $g=0; $h=0; $i=0; $j=0; $k=0; # FIND RIGHT LAT LON COMPARE: while($linell=){ chomp($linell); ($timellt, $ollt, $olln )=split /\s+/, $linell; last COMPARE if($timellt>=$timesim); } $linell ||=$knot; print SIMLAT $linell, " ", $line, "\n"; } system("date"); } } #system("gzip /home/karen/NBP/SIMf21*"); #system("mv /home/karen/NBP/SIMf21* /home/karen/NBP/SIMfteens");