[Swift-commit] r8066 - in SwiftApps/modis: . bin tutorial

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Fri Jul 25 20:24:33 CDT 2014


Author: davidk
Date: 2014-07-25 20:24:33 -0500 (Fri, 25 Jul 2014)
New Revision: 8066

Added:
   SwiftApps/modis/swift.properties
Removed:
   SwiftApps/modis/conf/
Modified:
   SwiftApps/modis/README
   SwiftApps/modis/bin/assemble.sh
   SwiftApps/modis/clean.sh
   SwiftApps/modis/tutorial/hello.swift
   SwiftApps/modis/tutorial/modis01.swift
   SwiftApps/modis/tutorial/modis02.swift
   SwiftApps/modis/tutorial/modis03.swift
   SwiftApps/modis/tutorial/modis04.swift
   SwiftApps/modis/tutorial/modis05.swift
   SwiftApps/modis/tutorial/modis06.swift
Log:
Changes to work with 0.95, and updates docs


Modified: SwiftApps/modis/README
===================================================================
--- SwiftApps/modis/README	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/README	2014-07-26 01:24:33 UTC (rev 8066)
@@ -8,8 +8,8 @@
 To download the image data, run:
 
 $ cd modis/data/modis/2002
-$ wget http://www.ci.uchicago.edu/swift/modis/modis-2002.tar.gz
-$ tar -zxf modis-2002.tar.gz 
+$ wget http://www.ci.uchicago.edu/swift/modis/europe.tar.gz
+$ tar -zxf europe.tar.gz 
 
 Hello world
 -----------
@@ -20,7 +20,7 @@
 
 To run the application, the command is:
 
-$ swiftrun -site local tutorial/hello.swift
+$ swift -site local tutorial/hello.swift
 
 modis01.swift
 -------------
@@ -31,7 +31,7 @@
 
 To run modis01.swift:
 
-$ swiftrun -site local tutorial/modis01.swift
+$ swift -site local tutorial/modis01.swift
 
 modis02.swift
 -------------
@@ -40,7 +40,7 @@
 
 To run modis02.swift:
 
-$ swiftrun -site local tutorial/modis02.swift 
+$ swift -site local tutorial/modis02.swift 
 
 modis03.swift
 -------------
@@ -56,7 +56,7 @@
 
 To run modis03.swift:
 
-$ swiftrun -site midway tutorial/modis03.swift
+$ swift -site midway tutorial/modis03.swift
 
 modis04.swift
 -------------
@@ -66,4 +66,6 @@
 
 To run modis04.swift:
 
-$ swiftrun -site midway tutorial/modis04.swift
+$ swift -site midway tutorial/modis04.swift
+
+

Modified: SwiftApps/modis/bin/assemble.sh
===================================================================
--- SwiftApps/modis/bin/assemble.sh	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/bin/assemble.sh	2014-07-26 01:24:33 UTC (rev 8066)
@@ -19,7 +19,7 @@
 done
 
 cd $tmpdir
-$bindir/montage.pl 5 5 200 200 v*
-$bindir/rgb_to_png.py map.rgb 1000 1000 ../map.png
+$bindir/montage.pl 5 4 200 200 v*
+$bindir/rgb_to_png.py map.rgb 1000 800 ../map.png
 
 exit 0

Modified: SwiftApps/modis/clean.sh
===================================================================
--- SwiftApps/modis/clean.sh	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/clean.sh	2014-07-26 01:24:33 UTC (rev 8066)
@@ -1,4 +1,4 @@
 #!/bin/bash
 
-rm -rf run*
-rm -rf swift.work
+rm -rf run* landuse colorImages 2>/dev/null
+rm selectedtiles.txt topselected.txt gridmap.png map.png 2>/dev/null

Added: SwiftApps/modis/swift.properties
===================================================================
--- SwiftApps/modis/swift.properties	                        (rev 0)
+++ SwiftApps/modis/swift.properties	2014-07-26 01:24:33 UTC (rev 8066)
@@ -0,0 +1,5 @@
+app.*.getlanduse=$PWD/bin/getlanduse.sh
+app.*.analyzelanduse=$PWD/bin/analyzelanduse.sh
+app.*.markmap=$PWD/bin/markmap.sh
+app.*.colormodis=$PWD/bin/colormodis.sh
+app.*.assemble=$PWD/bin/assemble.sh

Modified: SwiftApps/modis/tutorial/hello.swift
===================================================================
--- SwiftApps/modis/tutorial/hello.swift	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/tutorial/hello.swift	2014-07-26 01:24:33 UTC (rev 8066)
@@ -1,7 +1,7 @@
 type file;
 
 app (file f) greeting() { 
-    echo "Hello, world!" stdout=@filename(f);
+    echo "Hello, world!" stdout=filename(f);
 }
 
 file outfile <"hello.txt">;

Modified: SwiftApps/modis/tutorial/modis01.swift
===================================================================
--- SwiftApps/modis/tutorial/modis01.swift	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/tutorial/modis01.swift	2014-07-26 01:24:33 UTC (rev 8066)
@@ -3,7 +3,7 @@
 
 app (landuse output) getLandUse (imagefile input)
 {
-  getlanduse @filename(input) stdout=@filename(output);
+  getlanduse filename(input) stdout=filename(output);
 }
 
 imagefile modisImage <"data/europe/h18v05.rgb">;

Modified: SwiftApps/modis/tutorial/modis02.swift
===================================================================
--- SwiftApps/modis/tutorial/modis02.swift	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/tutorial/modis02.swift	2014-07-26 01:24:33 UTC (rev 8066)
@@ -3,18 +3,18 @@
 
 app (landuse output) getLandUse (imagefile input)
 {
-  getlanduse @filename(input) stdout=@filename(output);
+  getlanduse filename(input) stdout=filename(output);
 }
 
 # Constants and command line arguments
-int nFiles       = @toInt(@arg("nfiles", "1000"));
-string MODISdir  = @arg("modisdir", "data/europe");
+int nFiles       = toInt(arg("nfiles", "1000"));
+string MODISdir  = arg("modisdir", "data/europe");
 
 # Input Dataset
-imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
+imagefile geos[] <ext; exec="bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
 
 # Compute the land use summary of each MODIS tile
-landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=@strcat("landuse/\\1.landuse.byfreq")>;
+landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=strcat("landuse/\\1.landuse.byfreq")>;
 
 foreach g,i in geos {
     land[i] = getLandUse(g);

Modified: SwiftApps/modis/tutorial/modis03.swift
===================================================================
--- SwiftApps/modis/tutorial/modis03.swift	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/tutorial/modis03.swift	2014-07-26 01:24:33 UTC (rev 8066)
@@ -4,7 +4,7 @@
 
 app (landuse output) getLandUse (imagefile input)
 {
-  getlanduse @filename(input) stdout=@filename(output);
+  getlanduse filename(input) stdout=filename(output);
 }
 
 app (file output, file tilelist) analyzeLandUse (landuse input[], string usetype, int maxnum)
@@ -13,16 +13,16 @@
 }
 
 # Constants and command line arguments
-int nFiles       = @toInt(@arg("nfiles", "1000"));
-int nSelect      = @toInt(@arg("nselect", "10"));
-string landType  = @arg("landtype", "urban");
-string MODISdir  = @arg("modisdir", "data/europe");
+int nFiles       = toInt(arg("nfiles", "1000"));
+int nSelect      = toInt(arg("nselect", "10"));
+string landType  = arg("landtype", "urban");
+string MODISdir  = arg("modisdir", "data/europe");
 
 # Input Dataset
-imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
+imagefile geos[] <ext; exec="bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
 
 # Compute the land use summary of each MODIS tile
-landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=@strcat("landuse/\\1.landuse.byfreq")>;
+landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=strcat("landuse/\\1.landuse.byfreq")>;
 
 foreach g,i in geos {
     land[i] = getLandUse(g);

Modified: SwiftApps/modis/tutorial/modis04.swift
===================================================================
--- SwiftApps/modis/tutorial/modis04.swift	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/tutorial/modis04.swift	2014-07-26 01:24:33 UTC (rev 8066)
@@ -4,7 +4,7 @@
 
 app (landuse output) getLandUse (imagefile input)
 {
-  getlanduse @filename(input) stdout=@filename(output);
+  getlanduse filename(input) stdout=filename(output);
 }
 
 app (file output, file tilelist) analyzeLandUse (landuse input[], string usetype, int maxnum)
@@ -18,16 +18,16 @@
 }
 
 # Constants and command line arguments
-int nFiles       = @toInt(@arg("nfiles", "1000"));
-int nSelect      = @toInt(@arg("nselect", "10"));
-string landType  = @arg("landtype", "urban");
-string MODISdir  = @arg("modisdir", "data/europe");
+int nFiles       = toInt(arg("nfiles", "1000"));
+int nSelect      = toInt(arg("nselect", "10"));
+string landType  = arg("landtype", "urban");
+string MODISdir  = arg("modisdir", "data/modis/2002");
 
 # Input Dataset
-imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
+imagefile geos[] <ext; exec="bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
 
 # Compute the land use summary of each MODIS tile
-landuse land[]    <structured_regexp_mapper; source=geos, match="(h..v..)", transform=@strcat("landuse/\\1.landuse.byfreq")>;
+landuse land[]    <structured_regexp_mapper; source=geos, match="(h..v..)", transform=strcat("landuse/\\1.landuse.byfreq")>;
 
 foreach g,i in geos {
     land[i] = getLandUse(g);

Modified: SwiftApps/modis/tutorial/modis05.swift
===================================================================
--- SwiftApps/modis/tutorial/modis05.swift	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/tutorial/modis05.swift	2014-07-26 01:24:33 UTC (rev 8066)
@@ -4,7 +4,7 @@
 
 app (landuse output) getLandUse (imagefile input)
 {
-  getlanduse @filename(input) stdout=@filename(output);
+  getlanduse filename(input) stdout=filename(output);
 }
 
 app (file output, file tilelist) analyzeLandUse (landuse input[], string usetype, int maxnum)
@@ -23,19 +23,23 @@
 }
 
 # Constants and command line arguments
-int nFiles       = @toInt(@arg("nfiles", "1000"));
-int nSelect      = @toInt(@arg("nselect", "10"));
-string landType  = @arg("landtype", "urban");
-string MODISdir  = @arg("modisdir", "data/europe");
+int nFiles       = toInt(arg("nfiles", "1000"));
+int nSelect      = toInt(arg("nselect", "10"));
+string landType  = arg("landtype", "urban");
+string MODISdir  = arg("modisdir", "data/modis/2002");
 
 # Input Dataset
-imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
+imagefile geos[] <ext; exec="bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
 
 # Compute the land use summary of each MODIS tile
-landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=@strcat("landuse/\\1.landuse.byfreq")>;
+landuse land[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=strcat("landuse/\\1.landuse.byfreq")>;
 
+# Create multi-color images for all tiles
+imagefile colorImage[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=strcat("colorImages/\\1.color.rgb")>;
+
 foreach g,i in geos {
     land[i] = getLandUse(g);
+    colorImage[i] = colorModis(g);
 }
 
 # Find the top N tiles (by total area of selected landuse types)
@@ -47,9 +51,3 @@
 imagefile gridmap <"gridmap.png">;
 gridmap = markMap(topSelected);
 
-# Create multi-color images for all tiles
-imagefile colorImage[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=@strcat("colorImages/\\1.color.rgb")>;
-
-foreach g, i in geos {
-  colorImage[i] = colorModis(g);
-}

Modified: SwiftApps/modis/tutorial/modis06.swift
===================================================================
--- SwiftApps/modis/tutorial/modis06.swift	2014-07-24 20:59:41 UTC (rev 8065)
+++ SwiftApps/modis/tutorial/modis06.swift	2014-07-26 01:24:33 UTC (rev 8066)
@@ -4,7 +4,7 @@
 
 app (landuse output) getLandUse (imagefile input)
 {
-  getlanduse @filename(input) stdout=@filename(output);
+  getlanduse filename(input) stdout=filename(output);
 }
 
 app (file output, file tilelist) analyzeLandUse (landuse input[], string usetype, int maxnum)
@@ -24,23 +24,27 @@
 
 app (imagefile mon) assemble (imagefile images[])
 {
-   assemble @filename(mon) @filenames(images);
+   assemble filename(mon) filenames(images);
 }
 
 # Constants and command line arguments
-int nFiles       = @toInt(@arg("nfiles", "1000"));
-int nSelect      = @toInt(@arg("nselect", "10"));
-string landType  = @arg("landtype", "urban");
-string MODISdir  = @arg("modisdir", "data/europe");
+int nFiles       = toInt(arg("nfiles", "1000"));
+int nSelect      = toInt(arg("nselect", "10"));
+string landType  = arg("landtype", "urban");
+string MODISdir  = arg("modisdir", "data/europe");
 
 # Input Dataset
-imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
+imagefile geos[] <ext; exec="bin/modis.mapper", location=MODISdir, suffix=".rgb", n=nFiles>;
 
 # Compute the land use summary of each MODIS tile
-landuse land[]    <structured_regexp_mapper; source=geos, match="(h..v..)", transform=@strcat("landuse/\\1.landuse.byfreq")>;
+landuse land[]    <structured_regexp_mapper; source=geos, match="(h..v..)", transform=strcat("landuse/\\1.landuse.byfreq")>;
 
+# Create multi-color images for all tiles
+imagefile colorImage[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=strcat("colorImages/\\1.color.rgb")>;
+
 foreach g,i in geos {
     land[i] = getLandUse(g);
+    colorImage[i] = colorModis(g);
 }
 
 # Find the top N tiles (by total area of selected landuse types)
@@ -52,13 +56,6 @@
 imagefile gridmap <"gridmap.png">;
 gridmap = markMap(topSelected);
 
-# Create multi-color images for all tiles
-imagefile colorImage[] <structured_regexp_mapper; source=geos, match="(h..v..)", transform=@strcat("colorImages/\\1.color.rgb")>;
-
-foreach g, i in geos {
-  colorImage[i] = colorModis(g);
-}
-
 # Assemble a montage of the top selected areas
 imagefile montage<"map.png">; # @arg
 montage = assemble(colorImage);




More information about the Swift-commit mailing list