sal_linkscript_incomplete 1.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#!/bin/csh -f
#
#run this after editing the .xls files to add a sampnum column and saving as .csv on 
#the ship machine
#
#copies salinometer logs from the ship machine, makes links, and converts to unix format
#then concatenates all the .csv_linux files into sal_jc159_01.csv
#
#if run with three input arguments: crate number, day, month (of analysis), it
#will copy and convert only the files with name JC159*CTDnn*dd*mmm*.*
#if run with no input arguments, it will copy and convert everything, clobbering
#the existing .csv_linux files, which means that if you are going to make edits 
#you should make them in the original .xls or .csv files i
#(or introduce them in cruise_options/opt_jc159.m)

cd /local/users/pstar/cruise/data/ctd/BOTTLE_SAL

set cpre = JC159*CTD
set cruise = jc159
set rloc = /local/users/pstar/mounts/mnt_cruise_data/Specific_Equipment/CTD/Autosal

if (-e $1) #do all files
   rsync -av ${rloc}/*.csv ./
   rsync -av ${rloc}/*.xls ./
   foreach i (`ls ${cpre}*.csv`)
      set n

foreach i (`ls ${cpre}_???_Align_CTM.cnv`)
   set num = `awk -v nm="$i" 'BEGIN {print substr(nm,index(nm,"_Align")-3,3)}'`
   set linkfile = ctd_${cruise}_${num}_ctm.cnv 
   echo $linkfile
   if (! -e $linkfile) then
      echo Making link $linkfile for raw file $i
     ln -s $i $linkfile
   endif
end

foreach i (`ls ${cpre}_???.bl`)
   set num = `awk -v nm="$i" 'BEGIN {print substr(nm,index(nm,".bl")-3,3)}'`
   set linkfile = ctd_${cruise}_${num}.bl
   if (! -e $linkfile) then
      echo Making link $linkfile for raw file $i
      ln -s $i $linkfile
   endif
end

cd ../..