[Swift-commit] r6205 - in SwiftApps/modis: bin conf

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Thu Jan 31 11:03:11 CST 2013


Author: davidk
Date: 2013-01-31 11:03:11 -0600 (Thu, 31 Jan 2013)
New Revision: 6205

Modified:
   SwiftApps/modis/bin/assemble2.sh
   SwiftApps/modis/bin/colormodis.sh
   SwiftApps/modis/bin/ppmhist.pl
   SwiftApps/modis/conf/local.cf
Log:
A few steps closer.. completes successfully on mac


Modified: SwiftApps/modis/bin/assemble2.sh
===================================================================
--- SwiftApps/modis/bin/assemble2.sh	2013-01-31 13:51:49 UTC (rev 6204)
+++ SwiftApps/modis/bin/assemble2.sh	2013-01-31 17:03:11 UTC (rev 6205)
@@ -1,11 +1,21 @@
-#! /bin/bash
+#!/bin/bash
 
 output=$(cd $(dirname $1); echo $(pwd)/$(basename $1))     # get full pathname of output file
 selected=$(cd $(dirname $2); echo $(pwd)/$(basename $2))   # get full pathname of input file "selected"
 indir=$(cd $(dirname $3); pwd)                             # get full pathname of input dir "geos"
 webdir=$4
 
-tmp=$(mktemp -d modis.assemble.XXXX)
+if [ ! -d $webdir ]; then
+   mkdir -p $webdir
+   if [ $? -ne 0 ]; then
+      echo Unable to create $webdir, quitting
+      exit 1
+   fi
+fi
+
+tmpdir=$PWD/$( basename $( mktemp -d modis.assemble.XXXX ) )
+ls -ld $tmpdir
+
 bindir=$(cd $(dirname $0); pwd)
 graytile=$bindir/gray.png
 
@@ -15,21 +25,23 @@
 cd $indir
 
 for h in {0..35}; do
-  h=$( printf %02d $h );
-  for v in {0..17}; do
-    v=$( printf %02d $v );
-    hv=h${h}v${v}
-    vh=v${v}h${h}
-    if [ ! -f $hv*png ]; then
-      cp $graytile $tmp/$vh.png
-    elif grep $hv $selected >&/dev/null; then
-echo "adding border to $hv"
-      # add red border
-      convert $hv*png -resize 290x290 $tmp/t.png
-      convert $tmp/t.png -bordercolor red -border 5x5 $tmp/$vh.png
-    else
-      cp $hv*png $tmp/$vh.png
-    fi
+   h=$( printf %02d $h );
+   
+   for v in {0..17}; do
+      v=$( printf %02d $v );
+      hv=h${h}v${v}
+      vh=v${v}h${h}
+
+      if [ ! -f $hv*png ]; then
+         cp $graytile $tmpdir/$vh.png
+      elif grep $hv $selected >&/dev/null; then
+         echo "adding border to $hv"
+         # add red border
+         convert $hv*png -resize 290x290 $tmp/t.png
+         convert $tmp/t.png -bordercolor red -border 5x5 $tmp/$vh.png
+      else
+         cp $hv*png $tmp/$vh.png
+      fi
   done
 done
 

Modified: SwiftApps/modis/bin/colormodis.sh
===================================================================
--- SwiftApps/modis/bin/colormodis.sh	2013-01-31 13:51:49 UTC (rev 6204)
+++ SwiftApps/modis/bin/colormodis.sh	2013-01-31 17:03:11 UTC (rev 6205)
@@ -2,16 +2,14 @@
 # Return a new modis files with the 0-16 pixel values changed to
 # colors that reflect the land use of that region. (See legend)
 #
-# usage: colormodis.sh modis.tif recolored.tif
+# usage: colormodis.sh modis.ppm.gz recolored.tif
 #
 
 infile=$1
 outfile=$2
 
 # Create temp files in current directory since /tmp may not be available
-tmp=`mktemp modis.$USER.XXXXXX`
-mv $tmp $tmp.tif
-tmp=$tmp.tif
+tmp=`mktemp modis.$USER.XXXXXX.ppn.gz`
 map=`mktemp colormap.$USER.XXXXXX`
 
 # Create color set
@@ -40,6 +38,8 @@
 EOF
 
 cp $infile $tmp
+gunzip $tmp
+tmp=$( basename $tmp .gz )
 
 # output logged to stdout/error is ignored by swift for this app()
 

Modified: SwiftApps/modis/bin/ppmhist.pl
===================================================================
--- SwiftApps/modis/bin/ppmhist.pl	2013-01-31 13:51:49 UTC (rev 6204)
+++ SwiftApps/modis/bin/ppmhist.pl	2013-01-31 17:03:11 UTC (rev 6205)
@@ -4,7 +4,7 @@
 
 # Read file
 my $ppm_filename = shift;
-open(PPMFILE, "zcat $ppm_filename|") || die "Unable to open $ppm_filename!\n";
+open(PPMFILE, "gunzip -c $ppm_filename |") || die "Unable to open $ppm_filename!\n";
 my @ppm_data = <PPMFILE>;
 close(PPMFILE);
 

Modified: SwiftApps/modis/conf/local.cf
===================================================================
--- SwiftApps/modis/conf/local.cf	2013-01-31 13:51:49 UTC (rev 6204)
+++ SwiftApps/modis/conf/local.cf	2013-01-31 17:03:11 UTC (rev 6205)
@@ -5,8 +5,7 @@
 status.mode=provider
 use.provider.staging=false
 provider.staging.pin.swiftfiles=false
-#throttle.transfers=16
-#throttle.file.operations=16
+#site local JOBTHROTTLE=0.038
 
 #app getlanduse=$PWD/../bin/getlanduse.sh
 #app analyzelanduse=$PWD/../bin/analyzelanduse2.sh




More information about the Swift-commit mailing list