[Swift-commit] r6181 - in SwiftApps/modis: . conf

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Tue Jan 29 16:04:12 CST 2013


Author: davidk
Date: 2013-01-29 16:04:12 -0600 (Tue, 29 Jan 2013)
New Revision: 6181

Modified:
   SwiftApps/modis/clean.sh
   SwiftApps/modis/conf/midway.cf
   SwiftApps/modis/demo
   SwiftApps/modis/modis.swift
Log:
Demo script and some path fixes


Modified: SwiftApps/modis/clean.sh
===================================================================
--- SwiftApps/modis/clean.sh	2013-01-29 21:31:49 UTC (rev 6180)
+++ SwiftApps/modis/clean.sh	2013-01-29 22:04:12 UTC (rev 6181)
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-rm -rf *.log *.rlog *.d *.kml *.swiftx modis-20*
+rm -rf run0*

Modified: SwiftApps/modis/conf/midway.cf
===================================================================
--- SwiftApps/modis/conf/midway.cf	2013-01-29 21:31:49 UTC (rev 6180)
+++ SwiftApps/modis/conf/midway.cf	2013-01-29 22:04:12 UTC (rev 6181)
@@ -5,3 +5,10 @@
 status.mode=provider
 use.provider.staging=false
 provider.staging.pin.swiftfiles=false
+
+#app getlanduse=$PWD/../bin/getlanduse.sh
+#app analyzelanduse=$PWD/../bin/analyzelanduse2.sh
+#app colormodis=$PWD/../bin/colormodis.sh
+#app assemble=$PWD/../bin/assemble2.sh
+#app markmap=$PWD/../bin/markmap.sh
+

Modified: SwiftApps/modis/demo
===================================================================
--- SwiftApps/modis/demo	2013-01-29 21:31:49 UTC (rev 6180)
+++ SwiftApps/modis/demo	2013-01-29 22:04:12 UTC (rev 6181)
@@ -1,15 +1,43 @@
-# demo4 forest 50 5 pbs
+#!/bin/bash
 
-landtype=${1:-urban}
-nfiles=${2:-999}
-nselect=${3:-10}
-site=${4:-local}
+# Defaults
+LANDTYPE=urban
+NFILES=1000
+NSELECT=12
+SITE=local
+WEBDIR=$HOME/public_html/geo
 
-runid=modis-$(date +%Y.%m%d.%H%M)-$landtype-$nfiles-$nselect
+# Verify an argument is not null
+verify_not_null()
+{
+   argname=$1; shift
+   if [ _$1 != _ ]; then
+      return 0;
+   else
+      echo $0: value for $argname can not be null
+      exit 1
+   fi
+}
 
-echo runid=$runid
+# Parse command line arguments
+while [ $# -gt 0 ]
+do
+   case "$1" in
+      -landtype) LANDTYPE=$2; verify_not_null landtype $LANDTYPE; shift ;;
+      -nfiles) NFILES=$2; verify_not_null nfiles $NFILES; shift ;;
+      -nselect) NSELECT=$2; verify_not_null nselect $NSELECT; shift ;;
+      -site) SITE=$2; verify_not_null site $SITE; shift ;;
+      -webdir) WEBDIR=$2; verify_not_null webdir $WEBDIR; shift ;;
+      *) ;;
+   esac
+   shift
+done
 
-swift -tc.file tc.local \
-      -sites.file sites.local.xml \
-       modis.swift -landtype=$landtype -nfiles=$nfiles -nselect=$nselect -runid=$runid \
-       -modisdir=$PWD/data/modis/2002 -webdir=$HOME/public_html/geo
+echo landtype=$LANDTYPE
+echo nfiles=$NFILES
+echo nselect=$NSELECT
+echo webdir=$WEBDIR
+
+eval swiftrun -site $SITE modis.swift -landtype=$LANDTYPE -nfiles=$NFILES \
+	 -nselect=$NSELECT -modisdir=$PWD/data/modis/2002 \
+         -webdir=$WEBDIR

Modified: SwiftApps/modis/modis.swift
===================================================================
--- SwiftApps/modis/modis.swift	2013-01-29 21:31:49 UTC (rev 6180)
+++ SwiftApps/modis/modis.swift	2013-01-29 22:04:12 UTC (rev 6181)
@@ -36,7 +36,6 @@
 int nFiles =      @toInt(@arg("nfiles","1000"));
 int nSelect =     @toInt(@arg("nselect","12"));
 string landType = @arg("landtype","urban");
-string runID =    @arg("runid","modis-run");
 string MODISdir=  @arg("modisdir","/home/wilde/bigdata/data/modis/2002");
 string webDir =   @arg("webdir","/home/wilde/public_html/geo/");
 
@@ -44,13 +43,14 @@
 
 # Input Dataset
 
-imagefile geos[] <ext; exec="modis.mapper",
+imagefile geos[] <ext; exec="../bin/modis.mapper",
   location=MODISdir, suffix=".tif", n=nFiles >; # site=site
 
+
 # Compute the land use summary of each MODIS tile
 
 landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)",
-  transform=@strcat(runID,"/\\1.landuse.byfreq")>;
+  transform=@strcat("\\1.landuse.byfreq")>;
 
 foreach g,i in geos {
     land[i] = getLandUse(g,1);
@@ -79,7 +79,7 @@
 
 # Assemble a montage of the top selected areas
 
-imagefile montage <single_file_mapper; file=@strcat(runID,"/","map.png") >; # @arg
+imagefile montage <single_file_mapper; file=@strcat("map.png") >; # @arg
 montage = assemble(selectedTiles,colorImage,webDir);
 
 # future args:




More information about the Swift-commit mailing list