#! /bin/csh -f
# Last edited on 1999-11-14 05:36:50 by hcgl

# Runs PZDraw on all filtered contours at all scales

set usage = "$0 RUN MINBAND MAXBAND MINCURVE MAXCURVE"

echo "$0 $*"

set run = "$1"; shift;
set minBand = "$1"; shift;
set maxBand = "$1"; shift;
set minCurve = "$1"; shift;
set maxCurve = "$1"; shift;

if ( $#argv != 0 ) then
  echo "usage: ${usage}"; exit 1
endif

set nums = ( `list-fragment-numbers` )

echo 'nums = '${nums}

set bands = ( 000 `cat bands-filter.txt` )

foreach band ( ${bands} )
 
  if ( ( ${band} < ${minBand} ) || ( ${band} > ${maxBand} ) ) continue

  if ( ${band} == 000 ) then
    set plotStep = 0
  else
    set plotStep = 2.0
  endif

  foreach num ( ${nums} )
     
    if ( ( ${num} < ${minCurve} ) || ( ${num} > ${maxCurve} ) ) continue
    
    set flname = "${num}/f${band}"
    set psname = "${num}/f${band}"
  
    echo '=== '${psname}' ==============================='
  
    echo "plotStep = ${plotStep}"

    /bin/rm -f ${psname}.ps
  
    if ( -r ${flname}.flc ) then
      nice PZDraw \
        -window filtered \
        -output ${psname} \
        -axes -grid 50 -ticks \
        -plotStep ${plotStep} \
        < ${flname}.flc
      if ( $status ) exit $status
    else
      echo "${flname}.flc not found"
    endif

    # ghostview -openwindows ${psname}.ps
    # cat ${psname}.ps | rsh escher "/usr/bin/lp"
  end
end


