<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/bin/csh -f
setenv NCS_SHUTUP
source ~panorama/panorama/config/setup
unsetenv NCS_SETUP

umask 002

set buoys = (L4 E1)
set buoys = L4
set RAME = "82.71.13.178"
set CLONE = "192.171.162.92"
set user = root
set web = "www.npm.ac.uk"
set webuser = rsgadmin

set datestamp = `date --utc`

set test = `ssh -l $user $RAME ls`
set alive = $status
set bindir = /users/rsg/observatory/buoy/pml/bin

foreach buoy($buoys)
   echo "Processing: $buoy"
   set files = `ls /users/rsg/observatory/buoy/pml/download/{$buoy}/2009/*/*F.txt`

   foreach file($files)
      set year = `echo $file:t:r | cut -c1-4`
      set julian = `echo $file:t:r | cut -c5-7`
      # met data
      cat $file | grep MPB | sed -e 's/MPB/'$julian'/g' | gawk '/\./{print $1+$2/24,$3,$4,$5,$6,$7}' &gt;&gt; /tmp/buoy_met_{$buoy}_all.txt
      # WQM data
      cat $file | grep WQM | sed -e 's/WQM/'$julian'/g' | gawk '/\./{print $1+$2/24,$3,$4,$5,$6,$7}' &gt;&gt; /tmp/buoy_wqm_{$buoy}.txt
      # CDM data
      cat $file | grep CDM | sed -e 's/CDM/'$julian'/g' | gawk '/\./{print $1+$2/24,$3}' &gt;&gt; /tmp/buoy_cdm_{$buoy}.txt
      # Nitrate data
      # correction only holds for 2009 data
      cat $file | grep NLF | sed -e 's/NLF/'$julian'/g' | gawk '/\./{print $1+$2/24,$3+($1+$2/24)*0.053828 + 3.873}' &gt;&gt; /tmp/buoy_nlf_{$buoy}.txt
      #cat $file | grep NLF | sed -e 's/NLF/'$julian'/g' | gawk '/\./{print $1+$2/24,$3}' &gt;&gt; /tmp/buoy_nlf_{$buoy}.txt
   end

   /usr/bin/gnuplot ${bindir}/gnuplot/plot_nitrate_{$buoy}
   /usr/bin/gnuplot ${bindir}/gnuplot/plot_oxygen_fluor_{$buoy}
   /usr/bin/gnuplot ${bindir}/gnuplot/plot_temp_sal_{$buoy}

   # only need to distinguish beteen oxygen sensors for 2009 data
   if ($buoy == "E1") then 
      set oxy_fl_turb = `cat $latest_file | grep WQM | gawk '/\./{print $5/100.,$6,$7}' | tail -1`
   else
      set oxy_fl_turb = `cat $latest_file | grep WQM | gawk '/\./{print $5/2.23916,$6,$7}' | tail -1`
   endif

end

exit(0)

</pre></body></html>