12.07.2015 Views

Transfer of Data from Terabyte Disk to BMRC Archives

Transfer of Data from Terabyte Disk to BMRC Archives

Transfer of Data from Terabyte Disk to BMRC Archives

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

y using the NCO command: ‘ncks’, and the output is saved in files named with an ‘ OZ’ suffix beforethe ‘.nc’:1 #!/bin/sh2 #3 # Program:4 # cut-<strong>to</strong>-oz5 #6 # RCS-Strings:7 # $Source: /bm/gkeep/lih/src/sh/RCS/cut-<strong>to</strong>-oz,v $8 # $Revision: 1.1 $9 #10 # Author:11 # Lawson Hanson, 20050211.12 #13 # Purpose:14 # Read a list <strong>of</strong> "direc<strong>to</strong>ry:" and "file.nc" entries15 # <strong>from</strong> the "ls -R" file list specified on the command-line,16 # and use the "ncks" netCDF file utility <strong>to</strong> extract17 # a region <strong>of</strong> interest <strong>to</strong> Australian researchers,18 # which was determined by Dr.Aurel Moise <strong>to</strong> be:19 #20 # -d lat,-60.,20. -d lon,90.,270.21 #22 # and name the new file "${baseFile}_OZ.nc".23 #24 # Note:25 # Janice Sisson requested that I should use the "qsub" batch system26 # <strong>to</strong> run the "ncks" processes which form a part <strong>of</strong> "cut-<strong>to</strong>-oz", this27 # in an attempt <strong>to</strong> reduce the load on the "gale" computer system.28 # Janice suggests that I should just "qsub" the whole script.29 #30 # Send mail at beginning and end <strong>of</strong> request execution:31 # QSUB -mb -me32 # Specify the batch queue:33 # QSUB -q large34 #35 Prog=‘basename $0 .sh‘3637 usage ( )38 {39 echo40 echo "Usage: ${Prog} [-h] [-n] data-list-file"41 echo "Where: -h = Display this help/usage message and exit."42 echo " -n = Do NOT remove the original netCDF file."43 echo44 echo " e.g.: ${Prog} data1.txt"45 echo46 }4748 part=149 removeFlag=15051 case $1 in52 -h)53 usage54 exit 055 ;;56 -n)57 removeFlag=058 shift59 ;;60 *)61 ;;62 esac6364 if [ $# -ne 1 ]65 then66 usage67 exit 168 fi6970 dataFile="$1"7172 if [ ! -f ${dataFile} ]73 then74 echo75 echo "${Prog}: ERROR: ${dataFile}: file does not exist."76 echo77 exit 278 fi7980 fNum=08182 <strong>to</strong>pDir=‘pwd‘8384 cat $dataFile | while read line85 do86 gotComment=‘echo $line | grep ’^#’‘87 cSts=$?8889 if [ $cSts -eq 0 ]90 then91 continue92 fi9394 gotDir=‘echo $line | grep ’:$’‘95 sts=$?9697 if [ $sts -eq 0 ]98 then99 dir=‘echo $line | tr -d ’:’‘100101 if [ ! -d ${<strong>to</strong>pDir}/$dir ]102 then103 echo104 echo "${Prog}: Error: ${<strong>to</strong>pDir}/${dir}: Direc<strong>to</strong>ry not found"105 echo106 exit 3107 fi108109 cd ${<strong>to</strong>pDir}/$dir110 pwd111 fi112113 gotNcFile=‘echo $line | grep ’\.nc$’‘114 sts=$?115116 if [ $sts -eq 0 ]117 then118 baseFile=‘basename $line .nc‘119 nice ncks -Oha -d lat,-60.,20. -d lon,90.,270. $line ${baseFile}_OZ.nc120 cmdSts=$?121122 if [ $cmdSts -ne 0 ]123 then124 echo "${Prog}: ERROR: ncks process failure:"125 echo " direc<strong>to</strong>ry: ‘pwd‘"126 echo " with file: $line"127 else128 fNum=‘expr $fNum + 1‘129 echo "Created file(${fNum}): ${baseFile}_OZ.nc"130131 if [ $removeFlag -gt 0 ]132 then133 /bin/rm -f $line134 fi135 fi136 fi137 done138139 exit 0140B.13 Program: ‘dir2sam’The ‘dir2sam’ script uses ‘rcp’ <strong>to</strong> transfer direc<strong>to</strong>ry structures with sub-files <strong>from</strong> the current direc<strong>to</strong>ryon say ‘gale’ <strong>to</strong> the associated direc<strong>to</strong>ry on ‘sam’ using ‘samsrv2jf’ (i.e., the jumbo frame). After the‘rcp’ process has completed, the script calls the ‘setPerms’ script <strong>to</strong> set direc<strong>to</strong>ries <strong>to</strong> 775 and files <strong>to</strong> 664so that several people can be working on the same areas, i.e., perhaps the same direc<strong>to</strong>ries, but hopefullydifferent files:1 #!/bin/sh2 #3 # Program:4 # dir2sam5 #6 # RCS-Strings:7 # $Source: /bm/gkeep/lih/src/sh/RCS/dir2sam,v $8 # $Revision: 1.3 $9 #10 # Author:11 # Lawson Hanson, 20050127.12 #13 # Purpose:14 # Use "rcp" <strong>to</strong> transfer direc<strong>to</strong>ry structures with sub-files15 # <strong>from</strong> the current direc<strong>to</strong>ry on say "gale" <strong>to</strong> the associated16 # direc<strong>to</strong>ry on "sam" using "samsrv2jf" (the jumbo frame).17 # After the "rcp" process has completed, the script calls the18 # "setPerms" script <strong>to</strong> set direc<strong>to</strong>ries <strong>to</strong> 775 and files <strong>to</strong> 66419 # so that several people can be working on the same areas, i.e.,20 # perhaps the same direc<strong>to</strong>ries, but hopefully different files.21 #22 Prog=‘basename $0 .sh‘2324 usage ( )25 {26 echo27 echo "Usage: ${Prog} direc<strong>to</strong>ry"28 echo29 }3031 if [ $# -ne 1 ]32 then33 usage34 exit 135 fi3637 copyDir="$1"3839 if [ ! -d "${copyDir}" ]40 then41 usage42 echo "${Prog}: Error: ${copyDir}: direc<strong>to</strong>ry not found"43 echo44 exit 226

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!