#!/bin/sh #------------------------------------------------------------- # Revised (version 3) clustering program for faster results # Creates fewer intermediate files, direct output of Cmean.tdump # script to cluster trajectories for one year where # the endpoint files are named T{YYYY}{MM}{DD}{HH} #------------------------------------------------------------- # set default directory structure CWD=$PWD # starting directory for script MDL="$HOME/Hysplit/exec" # executables directory MAP="$HOME/Hysplit/graphics" # location of hysplit map background OUT="$HOME/Temp" # parent directory for results SUB="S001" # subdirectory with endpoint files SYR="1990" # start year to cluster nc=6 # final number of clusters echo "Clustering start: `date`" cd ${OUT}/${SUB} # add all trajectory file names rm -f INFILE ls T${SYR}?????? >INFILE # set trajectory color scheme for trajplot let ii=1 kol="" while [ $ii -le $nc ]; do kol="$kol$ii" ii=`expr $ii + 1` done # Faster Version 2 of clustering program $MDL/cluster3 -iINFILE -oCLUSLIST -n${nc} echo "Clustering stop: `date`" # compute/plot mean traj for each cluster tmout="Cmean.tdump" if [ -s $tmout ]; then rm -f LABELS.CFG echo "'TITLE&','Cluster Mean Trajectories for $SYR&'" >LABELS.CFG $MDL/trajplot +g1 -j${MAP}/arlmap -i$tmout -z80 -k${nc}:$kol -v4 \ 1>/dev/null 2>/dev/null if [ -s trajplot.html ]; then mv trajplot.html meantraj3.html open meantraj3.html else echo "ERROR - trajplot" exit fi fi # cleanup rm -f INFILE rm -f Cmean.tdump rm -f LABELS.CFG rm -f CLUSLIST_${nc}