[Swift-commit] r6763 - SwiftTutorials/ATPESC_2013-08-06

yadunandb at ci.uchicago.edu yadunandb at ci.uchicago.edu
Mon Aug 5 14:51:08 CDT 2013


Author: yadunandb
Date: 2013-08-05 14:51:07 -0500 (Mon, 05 Aug 2013)
New Revision: 6763

Modified:
   SwiftTutorials/ATPESC_2013-08-06/README
Log:

Updated README


Modified: SwiftTutorials/ATPESC_2013-08-06/README
===================================================================
--- SwiftTutorials/ATPESC_2013-08-06/README	2013-08-05 19:41:07 UTC (rev 6762)
+++ SwiftTutorials/ATPESC_2013-08-06/README	2013-08-05 19:51:07 UTC (rev 6763)
@@ -522,21 +522,22 @@
 Modis - Satellite image data processing
 ---------------------------------------
 
-In the section we will use swift to process data from a large dataset of 
+In this section we will use swift to process data from a large dataset of 
 files that categorize the Earth's surface, derived from the MODIS sensor 
 instruments that orbit the Earth on two NASA satellites of the Earth Observing System.
 
-The dataset we use (for 2002, named mcd12q1) files that categorize every
-250-meter square of non-ocean surface of the Earth into one of 17 "land 
-cover" categories (for example, water, ice, forest, barren, urban). Each 
-pixel of these data files has a value of 0 to 16, describing one square 
+The dataset we use (for 2002, named +mcd12q1+) consists of 317 "tile" files 
+that categorize every 250-meter square of non-ocean surface of the Earth into
+one of 17 "land cover" categories (for example, water, ice, forest, barren, urban).
+Each pixel of these data files has a value of 0 to 16, describing one square 
 of the Earth's surface at a specific point in time. Each tile file has 
-approximately 5 million 1-byte pixels (5.7 MB), covering 2400x2400 
-250-meter squares, based on a specific map projection.
+approximately 5 million 1-byte pixels (5.7 MB), covering 2400x2400 250-meter
+squares, based on a specific map projection.
 
+image:sinusoidal_v5.gif[]
 
-modis01 - Process 1 file
-~~~~~~~~~~~~~~~~~~~~~~~~
+modis01 - Process 1 image
+~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The first modis example defines one app function called getLandUse.
 This app takes a satellite image (data/modis/2002/h00v09.pgm.gz) as
@@ -565,8 +566,8 @@
 $ swift modis01.swift
 -----
 
-modis021 - Process multiple files in paralle
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+modis02 - Process multiple images in parallel
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The second modis example expands upon the first example by running getLandUse
 with multiple (317) input files. Ouptut files are stored in the landuse directory.
@@ -608,8 +609,8 @@
 -----
 
 
-modis03 - Multi-level dataflow
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+modis03 - Analyse the processed images
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The third modis example builds on the previous example. It defines a new app function
 called analyzeLandUse. The analyzeLandUse app examines the data generated by getLandUse
@@ -671,12 +672,12 @@
 -----
 
 
-modis04 - More complex Multi-level workflow
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+modis04 - Mark the top N tiles on a map
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The fourth modis example adds another app called markMap that looks at selectedtiles.txt
 and highlights the selected areas on a map. It will create a new image called
-markedGrid.ppm.
+gridmap.png which marks the top N tiles on a sinusoidal gridded map.
 
 .modis04.swift
 -----
@@ -734,3 +735,76 @@
 $ cd modis/modis04/
 $ swift modis04.swift
 -----
+
+modis05 - Create multi-color tile images
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The fifth modis example extends the previous examples by adding the colorModis app 
+to create multi-color images for all tiles.
+
+.modis05.swift
+-----
+type file;
+type imagefile;
+type landuse;
+
+app (landuse output) getLandUse (imagefile input)
+{
+  getlanduse @filename(input) stdout=@filename(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;
+}
+
+app (imagefile output) colorModis (imagefile input)
+{
+  colormodis @input @output;
+}
+
+# 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/global");
+
+# Input Dataset
+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")>;
+
+foreach g,i in geos {
+    land[i] = getLandUse(g);
+}
+
+# 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 <"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);
+}
+
+-----
+
+
+To run modis05.swift:
+-----
+$ cd modis/modis05/
+$ swift modis05.swift
+-----




More information about the Swift-commit mailing list