BEGIN {
FS = ","
}
{
FS = ","
ARGC = 2
depth = -9999
temp = -9999
if ($1=="$GPRMC")
{
utctime = $2
utcdate = $10
latdeg = substr($4,1,2)
latmin = substr($4,3,6)
declat = latdeg + (latmin/60)
londeg = substr($6,1,3)
lonmin = substr($6,4,6)
declon = -1 * (londeg + (lonmin/60))
if (NR==1) {
holddepth = -9999
holdtemp = -9999
}
else {
printf("%s, %s, %9.6f, %9.6f, %5.1f, %5.1f, %s\n", holdutctime, holdutcdate, holddeclon, holddeclat, holddepth, holdtemp, ARGV[2])
}
holdutctime = utctime
holdutcdate = utcdate
holddeclon = declon
holddeclat = declat
holddepth = -9999
holdtemp = -9999
}
if ($1=="$SDDPT")
{
depthreal = $2
holddepth = depthreal
}
if ($1=="$SDMTW")
{
tempreal = $2
holdtemp = tempreal
}
}
END {
printf("%s, %s, %9.6f, %9.6f, %5.1f, %5.1f, %s\n", holdutctime, holdutcdate, holddeclon, holddeclat, holddepth, holdtemp, ARGV[2])
}
This AWK script was initialized by "dohold" - shell script run under CYGWIN (UNIX like environment that runs under Windows). This shell script reads all the files in a folder with the extension "gps" and processes them. This is the script used for the April 14 data collection:
files=`ls *.gps | cut -d. -f1 | tr "[A-Z"] ["a-z"]` for file in $files do awk -f awkhold $file.gps $file > $file.holds done
cat l6f1_mod.holds \ l6f2.holds \ l6f3.holds \ l6f4.holds \ l6f5.holds \ l6f7_mod.holds \ l6f9.holds \ l6f10.holds \ l6f11.holds \ l6f12.holds \ l7f1.holds \ l7f7_mod.holds \ l7f10.holds \ l7f12.holds \ l7f13.holds \ l7f14.holds \ l7f17.holds \ l7f18.holds \ f7l19.holds \ l8f1.holds \ l9f1.holds \ l9f3.holds \ l10f1.holds \ l11f1.holds \ l11f2.holds \ l12f1.holds \ l13f1.holds \ l14f1.holds \ l15f1.holds \ l16f1.holds \ l17f1.holds \ l18f1.holds \ l19f1.holds \ l19f2.holds \ l19f3.holds > jd104gps_mod.csvThe files with "mod" in the filename have had the original GPS files edited to remove obviously bad points.
gpstime, gpsdate, longitude, latitude, depth_m, temp_c, lineThis text file was then imported to ArcMap 9.2 using Tools - AddXY Data. The X field is longitude; Y field is latitude, and the coordinate system was defined as Geographic, WGs84. This "Event Theme" was converted to a shapefile by right-mouse clicking on the layer - Data - Export Data.
h_corrected_ir=htrack-tidetrack_ir; h_corrected_rd=htrack-tidetrack_rd; use: h_corrected_ir=htrack+tidetrack_ir; h_corrected_rd=htrack+tidetrack_rd;
Query: "timediff" <= -41 AND "timediff" >= -50
These are all within 10 seconds, so set bestdepth = depth_m_1.
Likewise, the opposite situation needed to be handled such as gpstime = 131601 and gpstime_1 = 131554.
Query: "timediff" >= 41 AND "timediff" <= 50
And if there's an hour change:
"timediff" >=4041 AND "timediff" <=4050 (this didn't have any records) "timediff" >=-4050 AND "timediff" <=-4041 (this didn't have any records)
Now any records without a "bestdepth" ("bestdepth" = 0) the values from "addedtide" were copied over.