# # Acquire a series of mss files to the disk. # # Set base names for mss and disk files: # # Jan, 2007: For Yue Deng (ydeng), for gw comparison w/ waccm, esp difkk. # This script obtains sy3j files from mss, and uses ncks to extract even # day histories (see -d option), and desired fields. # After each series is obtained, the files are catted together using ncrcat. # A catted file of 59 days is about 448 MB. # This was done in /hao/tgcm/timegcm1.2_yr03/sy3j/ydeng # set mss_basename = "/ROBLE/timegcm1.2/sy3j" set dsk_basename = "/hao/tgcm/timegcm1.2_yr03/sy3j/ROBLE.timegcm1.2.sy3j" set ncks_basename = "ydeng_sy3j" # # Set first and last file numbers to acquire (num0,num1): # File names will be $basename with the 3-digit file number # and the string ".nc" appended. # # Days 120 to 179: num0=64, num1=94 (but skip 079) # Days 180 to 239: num0=96, num1=126 (but skip 111) # Days 240 to 299: num0=128, num1=158 (but skip 143) # Days 300 to 365: num0=160, num1=193 (but skip 175) # @ num0 = 160 @ num1 = 193 # @ nfiles = ($num1 - $num0) + 1 echo "Will acquire $nfiles files (${num0} to ${num1}):" @ ifile = $num0 @ n = 1 while ($ifile <= $num1) if ($ifile <= 9) then set filenum = "00${ifile}" else if ($ifile <= 99) then set filenum = "0${ifile}" else set filenum = "${ifile}" endif # if ($filenum == '047') then # file 047 has only one time, 90,0,0 # if ($filenum == '079') then # file 079 has only one time, 150,0,0 # if ($filenum == '111') then # file 111 has only one time, 210,0,0 # if ($filenum == '143') then # file 143 has only one time, 270,0,0 if ($filenum == '175') then # file 175 has only one time, 330,0,0 echo "Skipping file $ifile.." @ ifile++ @ n++ continue endif set mssfile = "${mss_basename}${filenum}.nc" set dskfile = "${dsk_basename}${filenum}.nc" # # Execute msrcp command if dskfile does not exist: # if (! -e $dskfile) then set msrcp = "msrcp mss:${mssfile} $dskfile" echo "n=$n of ${nfiles}: command = $msrcp" $msrcp || echo ">>> Error executing $msrcp" else echo "Disk file $dskfile exists: did *not* do msrcp" endif # # Set up ncks command. Use -d to extract only even day histories: # -d dim,[ min][,[ max]][,[ stride]] Add stride argument to # hyperslabber. # set ncksfile = "${ncks_basename}${filenum}.nc" set ncks = "ncks -h -a -O -d time,0,24,24 -v mtime,time,ut,year,day,TN,O1,O2,W,DIFKK,TTNDCY,UTNDCY,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