#! /bin/bash -f
# Last edited on 2009-12-11 23:39:37 by stolfi

echo "RESAMPLING THE SIZE DATA FILES" 1>&2 

#   Converting to the format "{TIME} {YEAR} {MONTH} {DAY}  {SZ} {SU}  {DZ} {DU} "
#   where {TIME} is spaced a fixed number {sper} of days apart starting with {sper-1}, {SZ} is size
#   interpolated at {TIME}, {DZ} is the increment in {SZ} during the last {sper} days.
#   The flag {SU} is as as before. The flag {DU} is 1 (OK), 0 (suspicious) or 9 (don't use).
  
# Only the irr-2009-11 dataset is worth processing:
datasets=( irr-2009-11 )
# datasets=( irr-2009-11 emo-2009-06 )

for ff in ${datasets[@]} ; do
  cat rslt/wp-size-${ff}-rar.txt \
    | compute-wp-size-gr-rate.gawk \
        -f lib_date_time.gawk \
        -f lib_functions.gawk \
    > rslt/wp-size-${ff}-int.txt

  for pha in 0 1 ; do
    plot-wp-growth-rate.sh \
        ${pha} \
        rslt/wp-size-${ff}-int.txt \
      > rslt/wp-size-${ff}-int-p${pha}.eps
    plot-raw-and-fixed-size.sh \
        ${pha} \
        rslt/wp-size-${ff}-rar.txt \
        rslt/wp-size-${ff}-int.txt \
      > rslt/wp-size-${ff}-rar-int-p${pha}.eps
  done
done
