#!/bin/csh
alias julian /users/rsg/panorama/panorama.svn/bin/julian

set execdir = /users/rsg/observatory/buoy/pml/bin
set finaldir = /users/rsg/observatory/buoy/pml/download/E1
set year = 2015
    
# In water files
echo "Creating time-series in-water files"
cat $finaldir/{$year}/????????/*S*.txt | awk 'BEGIN {FS = ","; RS = "\n"} {if (NF >= 33 && $6 == 0){printf "%06d,%06d,0.00,%f,0.00,%f,%f,%f,%f,%f\n",$2,$3,$8,$12,$21,$24,$27,$30}} \
                                            {if (NF >= 33 && $6 == 120){printf "%06d,%06d,%f,%f,0.00,%f,%f,%f,%f,%f\n",$2,$3,$7,$10,$14,$23,$26,$29,$32}}' \
      > $finaldir/buoy_water_E1_all_{$year}.txt


exit(0)
