# # Acquire a series of mss files to the disk. # Optionally perform an ncks command on the disk file $dskfile, # saving a new disk file $ncksfile. Original $dskfile can # then be removed. # # Set base names for mss and disk files: # set mss_basename = "/ROBLE/timegcm1.2/sy3j" set dsk_basename = "ROBLE.timegcm1.2.sy3j" set ncks_basename = "sy3j" # # Set first and last file numbers to acquire: # File names will be $basename with the file number (3 digits) # and the string ".nc" appended. # # For days 1-30: #@ i0 = 1 #@ i1 = 16 # # For days 31-60: #@ i0 = 17 #@ i1 = 31 # # For days 61-90: #@ i0 = 32 #@ i1 = 47 # # For days 91-120: #@ i0 = 48 #@ i1 = 63 # # For days 121-150: #@ i0 = 64 #@ i1 = 80 # # For days 151-180: #@ i0 = 81 #@ i1 = 95 # # For days 181-210: #@ i0 = 96 #@ i1 = 112 # # For days 211-240: #@ i0 = 113 #@ i1 = 129 # # For days 241-270: #@ i0 = 130 #@ i1 = 145 # # For days 271-300: #@ i0 = 146 #@ i1 = 161 # # For days 301-365: @ i0 = 162 @ i1 = 193 # @ nfiles = ($i1 - $i0) + 1 echo "Will acquire $nfiles files (${i0} to ${i1}):" @ ifile = $i0 @ n = 1 while ($ifile <= $i1) if ($ifile <= 9) then set num = "00${ifile}" else if ($ifile <= 99) then set num = "0${ifile}" else set num = "${ifile}" endif set mssfile = "${mss_basename}${num}.nc" # mss file set dskfile = "${dsk_basename}${num}.nc" # disk file set msrcp = "msrcp mss:${mssfile} $dskfile" # # Execute msrcp command (comment out for trial run): # if (! -e $dskfile) then echo "n=$n of ${nfiles}: msrcp command = $msrcp" $msrcp || echo ">>> Error executing $msrcp" && exit 1 else echo "Disk file $dskfile exists: did *not* do msrcp" endif # # Set up ncks command: # set ncksfile = "${ncks_basename}${num}.nc" set ncks = "ncks -O -a -v mtime,time,ut,TN,UN,VN,O1,O2,O3,OH,H,HO2,NO,Z $dskfile $ncksfile" echo " ncks command = $ncks" # # Execute ncks command: # $ncks || echo ">>> Error executing $ncks" && exit 2 # # Remove disk file acquired from mss (ncksfile is saved) # rm $dskfile # @ ifile++ @ n++ end # while $ifile <= $ifile