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

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Thu Feb 14 13:55:19 CST 2013


Author: davidk
Date: 2013-02-14 13:55:19 -0600 (Thu, 14 Feb 2013)
New Revision: 6270

Added:
   SwiftApps/modis/tutorial/
   SwiftApps/modis/tutorial/modis01.swift
   SwiftApps/modis/tutorial/modis02.swift
   SwiftApps/modis/tutorial/modis03.swift
   SwiftApps/modis/tutorial/modis04.swift
Log:


Added: SwiftApps/modis/tutorial/modis01.swift
===================================================================
--- SwiftApps/modis/tutorial/modis01.swift	                        (rev 0)
+++ SwiftApps/modis/tutorial/modis01.swift	2013-02-14 19:55:19 UTC (rev 6270)
@@ -0,0 +1,14 @@
+type imagefile;
+type landuse;
+
+app (landuse output) getLandUse (imagefile input, int sortfield, string mpath)
+{
+  getlanduse @input sortfield mpath stdout=@output;
+}
+
+# Command line arguments
+string MODISdir  = @arg("modisdir");
+
+imagefile modisImage <"../data/modis/2002/h00v09.pgm.gz">;
+landuse result <"landuse/h00v08.landuse.byfreq">;
+result = getLandUse(modisImage, 1, MODISdir);

Added: SwiftApps/modis/tutorial/modis02.swift
===================================================================
--- SwiftApps/modis/tutorial/modis02.swift	                        (rev 0)
+++ SwiftApps/modis/tutorial/modis02.swift	2013-02-14 19:55:19 UTC (rev 6270)
@@ -0,0 +1,22 @@
+type imagefile;
+type landuse;
+
+app (landuse output) getLandUse (imagefile input, int sortfield, string mpath)
+{
+  getlanduse @input sortfield mpath stdout=@output;
+}
+
+# Constants and command line arguments
+int nFiles       = @toInt(@arg("nfiles"));
+string MODISdir  = @arg("modisdir");
+
+# Input Dataset
+imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".pgm.gz", 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")>;
+
+foreach g,i in geos {
+    land[i] = getLandUse(g,1,MODISdir);
+}
+

Added: SwiftApps/modis/tutorial/modis03.swift
===================================================================
--- SwiftApps/modis/tutorial/modis03.swift	                        (rev 0)
+++ SwiftApps/modis/tutorial/modis03.swift	2013-02-14 19:55:19 UTC (rev 6270)
@@ -0,0 +1,35 @@
+type file;
+type imagefile;
+type landuse;
+
+app (landuse output) getLandUse (imagefile input, int sortfield, string mpath)
+{
+  getlanduse @input sortfield mpath stdout=@output;
+}
+
+app (file output, file tilelist) analyzeLandUse (landuse input[], string usetype, int maxnum)
+{
+  analyzelanduse @output @tilelist usetype maxnum @input;
+}
+
+# Constants and command line arguments
+int nFiles       = @toInt(@arg("nfiles"));
+int nSelect      = @toInt(@arg("nselect"));
+string landType  = @arg("landtype");
+string MODISdir  = @arg("modisdir");
+string webDir    = @arg("webdir");
+
+# Input Dataset
+imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".pgm.gz", 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")>;
+
+foreach g,i in geos {
+    land[i] = getLandUse(g,1,MODISdir);
+}
+
+# Find the top N tiles (by total area of selected landuse types)
+file topSelected <"topselected.txt">;
+file selectedTiles <"selectedtiles.txt">;
+(topSelected, selectedTiles) = analyzeLandUse(land, landType, nSelect);

Added: SwiftApps/modis/tutorial/modis04.swift
===================================================================
--- SwiftApps/modis/tutorial/modis04.swift	                        (rev 0)
+++ SwiftApps/modis/tutorial/modis04.swift	2013-02-14 19:55:19 UTC (rev 6270)
@@ -0,0 +1,45 @@
+type file;
+type imagefile;
+type landuse;
+
+app (landuse output) getLandUse (imagefile input, int sortfield, string mpath)
+{
+  getlanduse @input sortfield mpath stdout=@output;
+}
+
+app (file output, file tilelist) analyzeLandUse (landuse input[], string usetype, int maxnum)
+{
+  analyzelanduse @output @tilelist usetype maxnum @input;
+}
+
+app (imagefile grid) markMap (file tilelist) 
+{
+  markmap @tilelist @grid;
+}
+
+# Constants and command line arguments
+int nFiles       = @toInt(@arg("nfiles"));
+int nSelect      = @toInt(@arg("nselect"));
+string landType  = @arg("landtype");
+string MODISdir  = @arg("modisdir");
+string webDir    = @arg("webdir");
+
+# Input Dataset
+imagefile geos[] <ext; exec="../bin/modis.mapper", location=MODISdir, suffix=".pgm.gz", 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")>;
+
+foreach g,i in geos {
+    land[i] = getLandUse(g,1,MODISdir);
+}
+
+# Find the top N tiles (by total area of selected landuse types)
+file topSelected <"topselected.txt">;
+file selectedTiles <"selectedtiles.txt">;
+(topSelected, selectedTiles) = analyzeLandUse(land, landType, nSelect);
+
+# Mark the top N tiles on a sinusoidal gridded map
+imagefile gridMap<"markedGrid.ppm">;
+gridMap = markMap(topSelected);
+




More information about the Swift-commit mailing list