#!/bin/bash

elegant run.ele

nw=`ls run-*.w1 | wc -l`
echo "Processing $nw data files..."

sddscombine run-00*.w1 -pipe=out -merge \
    | sddsprocess -pipe -process=?,min,%sMin -process=?,max,%sMax \
    | sddscollapse -pipe=in stats.sdds

xmin=`sdds2stream -column=xMin stats.sdds`
ymin=`sdds2stream -column=yMin stats.sdds`
xmax=`sdds2stream -column=xMax stats.sdds`
ymax=`sdds2stream -column=yMax stats.sdds`

sddscombine run-00*.w1 -pipe=out \
    | sddshist -pipe=in run.xhis -bins=100 -lower=$xmin -upper=$xmax -data=x

sddscombine run-00*.w1 -pipe=out \
    | sddshist -pipe=in run.yhis -bins=100 -lower=$ymin -upper=$ymax -data=y

sddscontour -shade -waterfall=parameter=s,indep=x,color=frequency run.xhis
sddscontour -shade -waterfall=parameter=s,indep=y,color=frequency run.yhis

