# # 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/sy4j" set dsk_basename = "ROBLE.timegcm1.2.sy4j" set ncks_basename = "sy4j" # # Set first and last file numbers to acquire: # File names will be $basename with the file number (3 digits) # and the string ".nc" appended. # #@ i0 = 1 #@ i1 = 16 #@ i0 = 17 #@ i1 = 33 #@ i0 = 34 #@ i1 = 48 # For days 91-150: # histvols = 'sy4j048.nc','to','sy4j080.nc','by','1' #@ i0 = 48 #@ i1 = 80 # For days 151-210: #histvols = 'sy4j080.nc','to','sy4j112.nc','by','1' #@ i0 = 81 #@ i1 = 112 # For days 211-270: #histvols = 'sy4j112.nc','to','sy4j145.nc','by','1' #@ i0 = 113 #@ i1 = 145 # For days 271-330: #histvols = 'sy4j145.nc','to','sy4j177.nc','by','1' #@ i0 = 146 #@ i1 = 177 # For days 331-365,0,0: #histvols = 'sy4j177.nc','to','sy4j193.nc','by','1' @ i0 = 178 @ 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