Commit d70f8533 authored by Yvonne Firing's avatar Yvonne Firing
Browse files

starting exec on gitlab

parents
#/bin/csh -f
set stream = $1
set infile = "../scs_raw/${stream}.ACO"
set otfile = "./${stream}.ACO"
echo infile $infile
echo otfile $otfile
echo $MACHTYPE
if ($MACHTYPE == 'x86_64-suse-linux') then
set sedcom = "sed -u"
else if ($MACHTYPE == 'x86_64') then
set sedcom = "sed -u"
else if ($MACHTYPE == 'i386') then
set sedcom = "sed -l"
else
set sedcom = "sed"
endif
echo $sedcom
ps -ef | grep tail | grep ${stream} | sed 's/ /Q/' | sed 's/^.*Q//' | sed 's/^ *//' | sed 's/ .*$//' >! wk$$
foreach i (`cat wk$$`)
kill -9 ${i}
end
/bin/rm wk$$
if (-e ${otfile}) then
/bin/rm ${otfile}
endif
tail -c 10000000000 -f ${infile} | ${sedcom} 's/, *,/,NaN,/g' | ${sedcom} 's/://g' | ${sedcom} 's/,/ /g' >! ${otfile} &
#
foreach i (`cat /local/users/pstar/cruise/data/exec/jcr/list`)
sedexec $i
end
#
pushd scs_sed
foreach i (`cat /local/users/pstar/cruise/data/exec/jcr/list`)
ps -ef | grep tail | grep ${i} | sed 's/ /Q/' | sed 's/^.*Q//' | sed 's/^ *//' | sed 's/ .*$//' >! wk$$
foreach i (`cat wk$$`)
kill -9 ${i}
end
/bin/rm wk$$
end
popd
s/\x0D//g
s/$/,/
s/,A,/,NaN,/g
s/,V,/,NaN,/g
s/,A...,/,NaN,/g
s/GJ00,$/NaN,/
s/, *,/,NaN,/g
s/, *,/,NaN,/g
s/,M,/,NaN,/g
s/,U,/,NaN,/g
s/://g
s/,/ /g
s/;/ /g
s/</ /g
s/>/ /g
s/=/ /g
s/\?/ /g
s/@/ /g
s/B/ /g
#!/bin/csh
# copy the raw .000 ladcp data into cruise/data/ladcp/raw/
# then make links to those files using the filename format expected by IX processing
cd /local/users/pstar/cruise/data/ladcp/rawdata
rsync -av /mnt/data/jcr/current/ladcp/* .
#make links for IX
foreach i (`ls JR18002_*.000`)
set num = `awk -v nm="$i" 'BEGIN {print substr(nm,index(nm,".000")-3,3)}'`
set linkfile = ${num}DL000.000
if(! -e ../ix/raw/$num) then
echo Making directory $num for raw file $i
mkdir -p ../ix/raw/$num
endif
cd ../ix/raw/$num
if (! -e $linkfile) then
echo Making link $linkfile for raw file $i
ln -s ../../../rawdata/$i $linkfile
endif
cd ../../../rawdata
end
cd ../..
# backup mexec cruise directory from workstation to external hard drive using rsync
# usage: > mexec_cruise_backup drivename
# e.g. > mexec_cruise_backup jr16002a
# the external hard drives must be named/mounted as $cruise$letter
# e.g. for cruise jr16002: jr16002a, jr16002b, etc.
# setup
set target = $1
set thiscruise = `echo $target | sed s'/.$//'`
set target1 = /run/media/pstar/${target}/this_is_${target}
set root = /local/users/pstar/cruise
set now = `date +%Y%m%d%H%M%S`
set backuplog = $root/data/other_backups/backup_log_${now}
if (-e ${target1}) then
set backupdir = /run/media/pstar/${target}/${thiscruise}/backup_${now}
set location = /run/media/pstar/${target}
else
echo "disk ${target} not found"
exit
endif
if (-e $backuplog) then
echo " "
exit
else
touch $backuplog
endif
if (-e $backupdir) then
echo " "
exit
else
mkdir $backupdir
endif
pushd $root
echo "disk ${target} found at ${location}" >> $backuplog
# dot login and cshrc
echo ------------- >> $backuplog
echo Date `date` >> $backuplog
echo copying login and cshrc >> $backuplog
echo ------ >> $backuplog
#/bin/cp -p ~/.login $root/data/other_backups/dot_login
#/bin/cp -p ~/.cshrc $root/data/other_backups/dot_cshrc
echo ------------- >> $backuplog
echo Date `date` >> $backuplog
echo done login and cshrc >> $backuplog
echo ------ >> $backuplog
# software
echo ------------- >> $backuplog
echo Date `date` >> $backuplog
echo start copying mexec software >> $backuplog
echo ------ >> $backuplog
cd $root
rsync -a sw/mexec/ ${backupdir}/
echo ------------- >> $backuplog
echo Date `date` >> $backuplog
echo done copying mexec software >> $backuplog
echo ------ >> $backuplog
# backup everything in data
echo ------------- >> $backuplog
echo Date `date` >> $backuplog
echo start copy to disk of data >> $backuplog
echo ------ >> $backuplog
cd $root
rsync -aL --exclude legwork --exclude scs_raw --exclude jcrfs --exclude netcdf_files_rawdir_ship data ${backupdir}
echo ------------- >> $backuplog
echo Date `date` >> $backuplog
echo done copy to disk of data >> $backuplog
echo ------ >> $backuplog
echo general_sw, legdata and legwork not backed up
popd
#!/bin/csh
#
#Script by DADES on cruise jr302 to make mac files readable in unix.
#cd data
#cd ctd
cd ctd
cd BOTTLE_SAL
foreach i (`ls /local/users/pstar/cruise/data/ctd/BOTTLE_SAL/sal_jr302_???.csv`)
mac2unix -n $i ${i}_linux
echo " " >> ${i}_linux
end
foreach i (`ls /local/users/pstar/cruise/data/ctd/BOTTLE_SAL/sal_jr302_????.csv`)
mac2unix -n $i ${i}_linux
echo " " >> ${i}_linux
end
rm sal_jr302_01.csv
cat *linux >>! sal_jr302_01.csv
#!/bin/csh -f
#
#Script by BAK on cruise jc032 to create symbolic links.
#Modified by CPA on di346 for nutrient data
#Set to import all files from Drobo each time script is run to ensure
#most up to date files are kept on nosea1
#The assumption is that the raw files are named
#in a way that identifies the instrument, eg
# ctd_jc032_001_ctm.cnv
#
#
# The initial foreach command will need to be modified for each cruise.
# modded bak jr302 8 jun 2014 to use rsync
cd
cd cruise/data
cd ctd
cd BOTTLE_NUT
rsync -av jcrfs_nut/J*csv .
foreach i (`ls JR302nut???.csv`)
#echo $i
set num = `echo $i | awk '{print substr($1,9,3)}'`
#echo $num
#set cruise = `echo $i | awk '{print substr($1,9,5)}'`
set cruise = 'jr302'
#echo $cruise
set linkfile = nut_${cruise}_${num}.csv
#echo $linkfile
if (! -e $linkfile) then
echo Making link $linkfile for raw file $i
ln -s $i $linkfile
endif
end
#!/bin/csh -f
#
#Script by BAK on cruise jc032 to create symbolic links.
#Modified by BGW for cruise di346
#Modified by CPA to import oxygen files from /Drobo
#The assumption is that the raw files are named
#in a way that identifies the instrument, eg
# ctd_jc032_001_ctm.cnv
#
#
# The initial foreach command will need to be modified for each cruise.
#cd data
#cd ctd
# modded bak di368
# modded bak jr302 8 jun 2014 to use rsync
cd ~/cruise/data
cd ctd
cd BOTTLE_OXY
rsync -av legwork/oxygen/oxygen calculation_JR18002_*.xls .
foreach i (`ls oxygen_calculation_JR18002_*.csv`)
#echo $i
set num = `echo $i | awk '{print substr($1,9,3)}'`
set cruise = 'jr16002'
#echo $num
set linkfile = oxy_${cruise}_${num}.csv
#echo $linkfile
if (! -e $linkfile) then
echo Making link $linkfile for raw file $i
ln -s $i $linkfile
endif
end
#!/bin/csh -f
#
#Script by BAK on cruise jc032 to create symbolic links.
#Modified by BGW for cruise di346
#Modified by CPA to import oxygen files from /Drobo
#The assumption is that the raw files are named
#in a way that identifies the instrument, eg
# ctd_jc032_001_ctm.cnv
#
#
# The initial foreach command will need to be modified for each cruise.
#cd data
#cd ctd
# modded bak di368
# modded bak jr302 8 jun 2014 to use rsync
cd
cd cruise/data
cd ctd
cd BOTTLE_OXY
rsync -av jcrfs_oxy/* .
foreach i (`ls JR302OXY???.csv`)
#echo $i
set num = `echo $i | awk '{print substr($1,9,3)}'`
set cruise = 'jr302'
#echo $num
set linkfile = oxy_${cruise}_${num}.csv
#echo $linkfile
if (! -e $linkfile) then
echo Making link $linkfile for raw file $i
ln -s $i $linkfile
endif
end
#!/bin/csh -f
#
#Script by BAK on cruise jc032 to create symbolic links.
#Modified by BGW for cruise di346
#Modified by CPA to import oxygen files from /Drobo
#The assumption is that the raw files are named
#in a way that identifies the instrument, eg
# ctd_jc032_001_ctm.cnv
#
#
# The initial foreach command will need to be modified for each cruise.
#cd data
#cd ctd
# modded bak di368
# modded bak jr302 8 jun 2014 to use rsync
cd
cd cruise/data
cd ctd
cd BOTTLE_OXY
#rsync -av jcrfs_oxy/* .
foreach i (`ls unc/JR302OXY???.csv`)
#echo $i
set num = `echo $i | awk '{print substr($1,13,3)}'`
set cruise = 'jr302'
#echo $num
set linkfile = oxy_${cruise}_${num}_unc.csv
#echo $linkfile
if (! -e $linkfile) then
echo Making link $linkfile for raw file $i
ln -s $i $linkfile
endif
end
#!/bin/csh -f
#
#Script by BAK on cruise jc032 to create symbolic links.
#Modified by BGW for cruise di346
#Modified by CPA to import oxygen files from /Drobo
#modified by YLF jr18002 to sync and link various sample data files
#
#The assumption is that the raw files are named
#in a way that identifies the instrument, eg
# ctd_jc032_001_ctm.cnv
#
#
# The initial foreach command will need to be modified for each cruise.
#cd data
#cd ctd
# modded bak di368
# modded bak jr302 8 jun 2014 to use rsync
cd ~/cruise/data/ctd
set lpre = '../../legwork/scientific_work_areas'
set cruise = 'jr18002'
set CRUISE = 'JR18002'
cd BOTTLE_OXY
rsync -av legoxy/Cast*.csv .
cd ..
#nuts, cfcs, co2
cd ..
#!/bin/csh
# jr302 bak
cd
cd data
cd ctd
#rsync -av samlist_jr302_???_co2.csv ../legwork/jr302_co2
#rsync -av samlist_jr302_???_ch4.csv ../legwork/jr302_ch4
#rsync -av samlist_jr302_???_nuts.csv ../legwork/jr302_nut
#rsync -av startend_jr302_??? ../legwork/jr302_surfactant
# jr302 at end of crusie when legwork is no longer available
rsync -av samlist_jr302_???_co2.csv ../from_legwork/jr302_co2
rsync -av samlist_jr302_???_ch4.csv ../from_legwork/jr302_ch4
rsync -av samlist_jr302_???_nuts.csv ../from_legwork/jr302_nut
rsync -av startend_jr302_??? ../from_legwork/jr302_surfactant
#!/bin/csh -f
#
# script by bak 3 dec 2014 for cook to allow for techsas files to be sorted into a directory
#
# modded by bak at nocs on eriu for dy031 15 may 2015, modded to run as a crontab task
#* * * * 1,2,3,4,5,6,7 /local/users/pstar/cruise/data/exec/techsas_linkscript >> & /dev/null
cd /local/users/pstar #~/h # cludge on eriu when pstar home directory is wrong
cd cruise
cd data
cd techsas
cd netcdf_files_links
set now = `date +%Y%m%d%H%M%S`
set link_log = /local/users/pstar/cruise/data/techsas/techsas_link_logs/techsas_link_log_${now}
echo " " >>! $link_log
echo `date` >>! $link_log
foreach techfile (`/bin/ls ../netcdf_files_rawdir/*/*`)
set i1 = `echo $techfile | awk '{print index($1,"/")}'`
set i2 = `echo $techfile $i1| awk '{print substr($1,$2+1)}'`
set i3 = `echo $i2 | awk '{print index($1,"/")}'`
set i4 = `echo $i2 $i3| awk '{print substr($1,$2+1)}'`
set i5 = `echo $i4 | awk '{print index($1,"/")}'`
set linkfile = `echo $i4 $i5| awk '{print substr($1,$2+1)}'`
if (! -e $linkfile) then
if ( -s $techfile) then
set sss = ` /bin/ls -l $techfile`
set ss2 = `echo $sss | awk '{print $5}'`
if ($ss2 > 10000) then
echo " making link $linkfile for raw file $techfile " >>! $link_log
ln -s $techfile $linkfile
else
echo " ignoring $linkfile length $ss2 is less than 10k bytes " >>! $link_log
endif
else
echo " ignoring $linkfile has zero length " >>! $link_log
endif
endif
end
#!/bin/csh -f
#
# script by bak 3 dec 2014 for cook to allow for techsas files to be sorted into a directory
#
# modded by bak at nocs on eriu for dy031 15 may 2015, modded to run as a crontab task
#* * * * 1,2,3,4,5,6,7 /local/users/pstar/cruise/data/exec/techsas_linkscript >> & /dev/null
cd /local/users/pstar #~/h # cludge on eriu when pstar home directory is wrong
cd cruise/data/techsas
cd netcdf_files_links_mac
set now = `date +%Y%m%d%H%M%S`
set link_log = /local/users/pstar/cruise/data/techsas/techsas_link_logs/techsas_link_log_mac_${now}
echo " " >>! $link_log
echo `date` >>! $link_log
foreach i (`/bin/ls ../netcdf_files_rawdir_mac/*/*`)
set i1 = `echo $i | awk '{print index($1,"/")}'`
set i2 = `echo $i $i1| awk '{print substr($1,$2+1)}'`
set i3 = `echo $i2 | awk '{print index($1,"/")}'`
set i4 = `echo $i2 $i3| awk '{print substr($1,$2+1)}'`
set i5 = `echo $i4 | awk '{print index($1,"/")}'`
set i6 = `echo $i4 $i5| awk '{print substr($1,$2+1)}'`
set i7 = `echo $i | awk '{print substr($1,1,22)}'`
set i8 = `echo $i | awk '{print substr($1,23,length($1))}'`
set i9 = `echo $i7$i8`
set linkfile = $i6
set techfile = $i9
if (! -e $linkfile) then
if ( -s $i) then
set sss = ` /bin/ls -l $i`
set ss2 = `echo $sss | awk '{print $5}'`
echo $sss
echo $ss2
if ($ss2 > 10000) then
echo " making link $linkfile for raw file $i " >>! $link_log
ln -s $techfile $linkfile
else
echo " ignoring $linkfile length $ss2 is less than 10k bytes " >>! $link_log
endif
else
echo " ignoring $linkfile has zero length " >>! $link_log
endif
endif
end
#!/bin/csh -f
#
#foreach i (`ls rawdata/*JC32*`)
# overhaul on jr302 may 2014, to fit with new python codas
# may need modification on cook/discovery to handle os75 and os150
cd /local/users/pstar/cruise/data/vmadcp/
echo "synchronising raw data"
rsync -av ../jcrfs/current/adcp/ jr17001_os75/vmdas_data/
# jcrfs is link to raw data on jrlb
echo "making links to individual sequence directories"
cd jr17001_os75/vmdas_data
foreach i (`ls *.*`) # list all *.* to avoid collecting N1R directory
set num = `echo $i | awk -F'.' '{print substr($1,length($1)-9,3)}'`
set linkdir = rawdata{$num}
if (! -e $linkdir) then
echo making $linkdir
mkdir $linkdir
endif
set rfile = $i
set lfile = $i
cd $linkdir
if (! -e $lfile) then
echo linking ${lfile} to ${rfile}
ln -s ../${rfile} ${lfile}
endif
cd ..
end
#!/bin/csh -f
#
# This script assumes that a mount to adcp data has been setup and files are named like
# /local/users/pstar/cruise/data/vmadcp/jc145_os75/rawraw/OS075_JC145004_000000.ENR
# or mostly
# /local/users/pstar/cruise/data/vmadcp/jc145_os75/rawraw/ADCP75_BTon_nosync010_000000.ENR
# note unfortunately on this cruise the names didn't change for BToff files,
# however BT status is determined separately
#
# Go through loop once for each adcp
set cruise = jc145
set CRUISE = JC145
foreach adp ('75' '150')
echo $adp
cd /local/users/pstar/cruise/data/vmadcp
cd ${cruise}_os${adp}
echo "Synchronising raw data for the $adp"
rsync -av /mnt/adcp${adp}/${CRUISE}/raw_data/ rawraw
# --------------------------------------------------
# These next steps were needed as naming of files was not correct
cd rawdata
foreach fl (`ls ../rawraw/ADCP${adp}_BT*`)
set bb = `echo $fl | awk '{print substr($1,length($1)-13,length($1))}'`
set fl2 = OS${adp}_JC145_${bb}
if (! -e $fl2) then
ln -s $fl $fl2
endif
end
cd ..
# --------------------------------------------------
end
#JC145 only: now deal with the initial (transit) files, one sequence at a time because
#the sequences will have to be renumbered
cd /local/users/pstar/cruise/data/vmadcp/jc145_os75/rawdata
foreach fl (`ls ../rawraw/OS75_JC145001*`)
set bb = `echo $fl | awk '{print substr($1,length($1)-9,length($1))}'`
set fl2 = OS75_JC145_901_${bb}
if (! -e $fl2) then
ln -s $fl $fl2
endif
end
foreach fl (`ls ../rawraw/OS75_JC145002*`)
set bb = `echo $fl | awk '{print substr($1,length($1)-9,length($1))}'`
set fl2 = OS75_JC145_902_${bb}
if (! -e $fl2) then
ln -s $fl $fl2
endif
end
cd /local/users/pstar/cruise/data/vmadcp/jc145_os150/rawdata
foreach fl (`ls ../rawraw/OS150_JC145001*`)
set bb = `echo $fl | awk '{print substr($1,length($1)-9,length($1))}'`
set fl2 = OS150_JC145_901_${bb}
if (! -e $fl2) then
ln -s $fl $fl2
endif
end
foreach fl (`ls ../rawraw/OS150_JC145002*`)
set bb = `echo $fl | awk '{print substr($1,length($1)-9,length($1))}'`
set fl2 = OS150_JC145_902_${bb}
if (! -e $fl2) then
ln -s $fl $fl2
endif
end
#!/bin/csh -f
#
# This script assumes that a mount to adcp data has been setup and files are named like
# /local/users/pstar/Acoustics/OS75kHz/raw_data/OS075_DY039004_000000.ENR
# /local/users/pstar/Acoustics/OS150kHz/raw_data/OS150_DY039002_000000.LOG
# Works on dy039 might may need to modify on next cruise
#
# Go through loop once for each adcp
foreach adp ('75' '150')
cd /local/users/pstar/cruise/data
cd va$adp
if ($adp == '75') then
set adpx = '075'
echo $adpx
else if ($adp == '150') then
set adpx = '150'
echo $adpx
endif
echo "Synchronising raw data for the v$adp"
# rsync -av /local/users/pstar/Acoustics/OS${adp}kHz/raw_data/OS${adpx}* rawdata
rsync -av /mnt/adcp${adp}/JC145/raw_data/OS* rawraw
# --------------------------------------------------
# These next steps were needed as nameing of files was not correct and need to add an extra underscore
cd rawdata
foreach fl (`ls ../rawraw/*`)
#set aa = `echo $fl | awk '{print substr($1,11,11)}'`
set aa = `echo $fl | awk '{print substr($1,11,length($1)-24)}'`
#set bb = `echo $fl | awk '{print substr($1,22,14)}'`
set bb = `echo $fl | awk '{print substr($1,length($1)-13,length($1))}'`
set fl2 = ${aa}_${bb}
echo $fl
echo $fl2
if (! -e $fl2) then
ln -s $fl $fl2
endif
end
cd ..
# --------------------------------------------------
echo "Creating directories for OS$adp"
foreach i (`ls rawdata/*`)
set num = `echo $i | awk -F'_' '{print substr($3,length($3)-2,3)}'`
# Extract file extension, e.g. for i = rawdata/OS150_DY039005_000000.ENX, num = 'ENR'
set fname = `echo $i | awk '{print substr($1,9,26)}'`
set movedir = rawdata{$num}
# Create new directory like 'rawdataENX' if does nto already exist
if (! -e $movedir) then
echo making $movedir
mkdir $movedir
endif
# Now create links from new directories to original files in rawdata with corresponding suffix
set rfile = ../${i}
set lfile = ${movedir}/${fname}
if (! -e ${lfile}) then
echo linking ${lfile} to ${rfile}
ln -s ${rfile} ${lfile}
endif
end
end
#!/bin/csh -f
#
#foreach i (`ls rawdata/*JC32*`)
# overhaul on jr302 may 2014, to fit with new python codas
# may need modification on cook/discovery to handle os75 and os150
cd /local/users/pstar/cruise/data/vmadcp
echo "synchronising raw data"
rsync -av jcrfs_adcp75/* raw_os75
# jcrfs_adcp75 is link to raw data on jrlb
# raw_os75 is link to directory in codas_shared available in virtual box.
# raw_os75 -> codas_shared/vmdas_data/jr281_os75 so raw directory must already be configured in codas_shared
echo "making links in old codas directory"
foreach i (`ls raw_os75/*.*`) # list all *.* to avoid collecting N1R directory
#set num = `echo $i | awk -F'_' '{print substr($2,length($2)-2,3)}'`
# this extracts the file extension, e.g. for i = rawdata/D344os150001_000000.ENR, num is then set as ENR, ZBS 19.10.2009
set num = `echo $i | awk -F'.' '{print substr($1,length($1)-9,3)}'`
set fname = `echo $i | awk '{print substr($1,10,19)}'` # start at char 10 allows for removing raw_os75/
cd /local/users/pstar/cruise/data/vmadcp/v75
set linkdir = rawdata{$num}
if (! -e $linkdir) then
echo making $linkdir
mkdir $linkdir
endif
set rfile = ../../${i}
set lfile = ${linkdir}/${fname}
if (! -e ${lfile}) then
echo linking ${lfile} to ${rfile}
ln -s ${rfile} ${lfile}
endif
end
#!/bin/csh -f
#
#foreach i (`ls rawdata/*JC32*`)
foreach i (`ls rawdata/*`)
#set num = `echo $i | awk -F'_' '{print substr($2,length($2)-2,3)}'`
# this extracts the file extension, e.g. for i = rawdata/D344os150001_000000.ENR, num is then set as ENR, ZBS 19.10.2009
set num = `echo $i | awk -F'.' '{print substr($1,length($1)-9,3)}'`
set movedir = rawdata{$num}
if (! -e $movedir) then
echo making $movedir
mkdir $movedir
endif
echo moving $i to $movedir
mv {$i} {$movedir}
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment