<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/bin/csh -f

# will need to re-run this over the reprocessed data for the final dataset
set topdir = /users/rsg/observatory/sunphotometer/skyrad.pack.V4/V4.2
set PARdir = $topdir/Vol
set outfname = size_distrib_Jan2021-Dec2023_PML.txt

set DESCRIPTION = "Aerosol size distribution (dV/dlog(R)) (cm^3/cm^2)"
echo $DESCRIPTION &gt; $outfname 
set HEADER = `echo "YYYY,MM,DD,HH.HH,Zen,0.01um,0.02um,0.03um,0.04um,0.06um,0.08um,0.19um,0.17um,0.25um,0.37um,0.54um,0.79um,1.16um,1.69um,2.47um,3.62um,5.29um,7.73um,11.31um,16.54um"`
echo $HEADER &gt;&gt; $outfname

foreach file(*.vol)
   set filestem = `echo $file:t:r`
   echo $filestem
   set yy = `echo $filestem | cut -c1-2`
   set yyyy = 20${yy}
   
   # split up the VOL file into discrete data chunks: easy as always 21 lines long
   split $file -l 21 -d /tmp/VOL 
     
   set volfiles = `ls /tmp/VOL*`
   set nvolfiles = `ls /tmp/VOL* | wc -l`
   foreach volfile($volfiles)
      # extract the data from the VOL file
      set header = `cat $volfile | head -1  | awk '{print $2,$3,$4,$5,90.-$8}'` 
      set size1  = `cat $volfile | head -2  | tail -1 | awk '{print $2}'` 
      set size2  = `cat $volfile | head -3  | tail -1 | awk '{print $2}'` 
      set size3  = `cat $volfile | head -4  | tail -1 | awk '{print $2}'` 
      set size4  = `cat $volfile | head -5  | tail -1 | awk '{print $2}'` 
      set size5  = `cat $volfile | head -6  | tail -1 | awk '{print $2}'` 
      set size6  = `cat $volfile | head -7  | tail -1 | awk '{print $2}'` 
      set size7  = `cat $volfile | head -8  | tail -1 | awk '{print $2}'` 
      set size8  = `cat $volfile | head -9  | tail -1 | awk '{print $2}'` 
      set size9  = `cat $volfile | head -10 | tail -1 | awk '{print $2}'` 
      set size10 = `cat $volfile | head -11 | tail -1 | awk '{print $2}'` 
      set size11 = `cat $volfile | head -12 | tail -1 | awk '{print $2}'` 
      set size12 = `cat $volfile | head -13 | tail -1 | awk '{print $2}'` 
      set size13 = `cat $volfile | head -14 | tail -1 | awk '{print $2}'` 
      set size14 = `cat $volfile | head -15 | tail -1 | awk '{print $2}'` 
      set size15 = `cat $volfile | head -16 | tail -1 | awk '{print $2}'` 
      set size16 = `cat $volfile | head -17 | tail -1 | awk '{print $2}'` 
      set size17 = `cat $volfile | head -18 | tail -1 | awk '{print $2}'` 
      set size18 = `cat $volfile | head -19 | tail -1 | awk '{print $2}'` 
      set size19 = `cat $volfile | head -20 | tail -1 | awk '{print $2}'` 
      set size20 = `cat $volfile | head -21 | tail -1 | awk '{print $2}'` 

      echo $header $size1 $size2 $size3 $size4 $size5 $size6 $size7 $size8 $size9 $size10 $size11 $size12 $size13 $size14 $size15 $size16 $size17 $size18 $size19 $size20 | tr -d '\r' | tr -s " " "," &gt;&gt; $outfname

   end
   
   # remove the Vol file split data chunks
   /bin/rm /tmp/VOL*

end

exit(0)

</pre></body></html>