<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/bin/csh -f
set execdir = /users/rsg/observatory/buoy/pml/bin
#set execdir = /users/rsg/tjsm/src/buoy/iridium
#set downloaddir = /users/rsg/observatory/buoy/pml/download/E1/ODAS51
set downloaddir = /data/datasets/Buoys/E1/download/ODAS51/
#set wavedir = /users/rsg/observatory/buoy/pml/download/E1/waves
set wavedir = /data/datasets/Buoys/E1/download/waves/
#set finaldir = /users/rsg/observatory/buoy/pml/download/E1
set finaldir = /data/datasets/Buoys/E1/download/
set wavecodedir = /users/rsg/observatory/buoy/pml/bin/AMOS2XBinaryCoder-1.0
# 2023 - two units for redundancy
set UnitID_atm1 = '300025010712790'
set UnitID_atm2 = '300025010534820'



# From 2022 the wave files are encoded in binary
pushd $wavecodedir
#set waveheader = `cat $wavecodedir/bf-128.csv | head -1`
#echo $waveheader &gt; /tmp/E1buoy_waves.csv
#foreach infile ( `find $wavedir -name ${UnitID_atm1}\*.sbd -size +300c` )

if (-e $finaldir/E1buoy_waves.csv) then 
   echo $finaldir/E1buoy_waves.csv
   /bin/scp $finaldir/E1buoy_waves.csv /tmp/E1buoy_waves.csv
   foreach infile ( `find $wavedir -name ${UnitID_atm1}\*.sbd -size +300c -mmin -90` )
      echo $infile
      /bin/scp $infile $wavecodedir/dataoutput.sbd
      set outputdata = `$wavecodedir/DataformatDecoder.py`
      echo $outputdata | sed 's/\[//' | sed 's/\]//' &gt;&gt; /tmp/E1buoy_waves.csv
   end
   ## remove any duplicate lines in the waves file
   /bin/awk 'prev!=$0;{prev=$0}' /tmp/E1buoy_waves.csv &gt; /tmp/E1buoy_waves_dedup.csv
endif
popd

/bin/mv /tmp/E1buoy_waves_dedup.csv $finaldir/E1buoy_waves.csv


exit(0)
</pre></body></html>