#! /bin/csh -f # # script to process the rigwatch data setenv TZ UTC # use awk to extract the values from the file and convert times into Unix timestamp awk -F, -f read_rigwatch.awk U1480_1.ASC >! /tmp/U1480_1.txt set start = `head -1 /tmp/U1480_1.txt | awk '{print 60*(1+int($1/60.0))}'` set end = `tail -1 /tmp/U1480_1.txt | awk '{print 60*(int($1/60.0))}'` echo $start,$end head -1 /tmp/U1480_1.txt tail -1 /tmp/U1480_1.txt # use GMT package filter1d to filter and resample the data # # -Fm60 is a median filter over a 60s window for each column, could alternatively # use -Fg120 for a Gaussian filter - these usually need a longer window to be effective # # start and end times are the full minutes just inside the file filter1d -Fm60 -T${start}/${end}/60 -N70/0 -L60 /tmp/U1480_1.txt -I-999.999 >! /tmp/U1480_1_resamp.txt # glue file back together in original format # first the header (untouched) cat header >! U1480_1_FILTERED.ASC # now each of the resampled lines awk -f write_rigwatch.awk /tmp/U1480_1_resamp.txt >> U1480_1_FILTERED.ASC