[Swift-commit] r6264 - SwiftApps/modis/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Wed Feb 13 11:31:31 CST 2013


Author: davidk
Date: 2013-02-13 11:31:30 -0600 (Wed, 13 Feb 2013)
New Revision: 6264

Added:
   SwiftApps/modis/bin/draw_rectangle.pl
   SwiftApps/modis/bin/getlanduse.pl
   SwiftApps/modis/bin/grid.ppm.gz
Removed:
   SwiftApps/modis/bin/analyzelanduse.sh.orig
   SwiftApps/modis/bin/analyzelanduse2.sh
   SwiftApps/modis/bin/analyzelandusep1.sh
   SwiftApps/modis/bin/imagehist.sh
   SwiftApps/modis/bin/ppmhist.pl
   SwiftApps/modis/bin/setglobushost.sh
Modified:
   SwiftApps/modis/bin/analyzelanduse.sh
   SwiftApps/modis/bin/getlanduse.sh
   SwiftApps/modis/bin/markmap.sh
Log:
The first three steps of the workflow (generating histograms from satellite data, finding areas of interest, and creating a map) are now done without imagemagick


Modified: SwiftApps/modis/bin/analyzelanduse.sh
===================================================================
--- SwiftApps/modis/bin/analyzelanduse.sh	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/analyzelanduse.sh	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,45 +1,43 @@
-#
-# Return (simple) stats and filenames for the tiles with the $num highest values of $field
-#
+#!/bin/bash
 
-stats=$1
-tilelist=$2
-field=$3
-num=$4
-shift 4
+# topselected.txt
+topselected=$1
 
-grep " $field"  $* |
-sed -e 's/:/ /' |
-sort -n -k +2 |
-tail -${num} >$stats
+# selectedtiles.txt
+selectedtiles=$2
 
-( awk '{print $1}' |
-  sed -e 's/landuse.//' -e 's/\..*/.tif/' -e 's,^,/home/wilde/bigdata/data/modis/2002/,' \
-) <$stats >$tilelist
+# Replace usetype name with number
+usetype=$( echo $3 | sed            \
+           -e s/water/0/g           \
+           -e s/evergreenneedle/1/g \
+           -e s/evergreenlead/2/g   \
+           -e s/deciduousneedle/3/g \
+           -e s/deciduousleaf/4/g   \
+           -e s/mixedforest/5/g     \
+           -e s/closedshrub/6/g     \
+           -e s/openshrub/7/g       \
+           -e s/woody/8/g           \
+           -e s/savanna/9/g         \
+           -e s/grassland/10/g      \
+           -e s/wetland/11/g        \
+           -e s/cropland/12/g       \
+           -e s/urban/13/g          \
+           -e s/vegetartion/14/g    \
+           -e s/ice/15/g            \
+           -e s/barren/16/g         \
+           -e s/unclassified/17/g
+         )
 
-exit
+# Max limit to analyze
+maxnum=$4
 
-login1$ cat topurban.txt 
-landuse/h20v04.landuse.byfreq 67312 13 0d
-landuse/h28v06.landuse.byfreq 82267 13 0d
-landuse/h08v05.landuse.byfreq 92674 13 0d
-landuse/h11v04.landuse.byfreq 93702 13 0d
-landuse/h13v11.landuse.byfreq 104302 13 0d
-landuse/h12v04.landuse.byfreq 110772 13 0d
-landuse/h19v04.landuse.byfreq 120908 13 0d
-landuse/h27v05.landuse.byfreq 128794 13 0d
-landuse/h18v03.landuse.byfreq 142756 13 0d
-landuse/h18v04.landuse.byfreq 146486 13 0d
-
-login1$ cat urbantiles.txt 
-/home/wilde/bigdata/data/modis/2002landuse/h20v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h28v06.tif
-/home/wilde/bigdata/data/modis/2002landuse/h08v05.tif
-/home/wilde/bigdata/data/modis/2002landuse/h11v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h13v11.tif
-/home/wilde/bigdata/data/modis/2002landuse/h12v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h19v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h27v05.tif
-/home/wilde/bigdata/data/modis/2002landuse/h18v03.tif
-/home/wilde/bigdata/data/modis/2002landuse/h18v04.tif
-login1$ fg
+# Write topselected.txt
+result=$( grep " $usetype " $( eval echo $5 ) | sed s/':'/' '/g | sort -rnk2 | awk '{print $1 " " $2}' | head -$maxnum )
+echo "$result" > $topselected
+   
+# Write selectedtiles.txt
+for r in $( echo "$result" | awk '{print $1}' )
+do
+   echo $( basename $r ).ppm.gz |sed s/\.landuse\.byfreq//g >> $selectedtiles
+done
+exit 0

Deleted: SwiftApps/modis/bin/analyzelanduse.sh.orig
===================================================================
--- SwiftApps/modis/bin/analyzelanduse.sh.orig	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/analyzelanduse.sh.orig	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,17 +0,0 @@
-#
-# Return (simple) stats and filenames for the tiles with the $num highest values of $field
-#
-
-stats=$1
-tilelist=$2
-field=$3
-num=$4
-shift 4
-
-grep " $field"  $* |
-sed -e 's/:/ /' |
-sort -n -k +2 |
-tail -${num} >$stats
-
-awk '{print $1}' |
-sed -e 's/\..*/.tif/' -e 's,^,/home/wilde/bigdata/data/modis/,' <$stats >$tilelist

Deleted: SwiftApps/modis/bin/analyzelanduse2.sh
===================================================================
--- SwiftApps/modis/bin/analyzelanduse2.sh	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/analyzelanduse2.sh	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,173 +0,0 @@
-#
-# Return (simple) stats and filenames for the tiles with the $num highest values of $wanteduses
-#
-
-stats=$1
-tilelist=$2
-wanteduses=$3
-num=$4
-shift 4
-
-awk -v wanteduses="$wanteduses" '
-  BEGIN {
-    sum = 0;
-    filename = "";
-
-    use["water"]=0
-    use["evergreen needleleaf forest"]=1
-    use["evergreen broadleaf forest"]=2
-    use["deciduous needleleaf forest"]=3
-    use["deciduous broadleaf forest"]=4
-    use["mixed forests"]=5
-    use["closed shrubland"]=6
-    use["open shrublands"]=7
-    use["woody savannas"]=8
-    use["savannas"]=9
-    use["grasslands"]=10
-    use["permanent wetlands"]=11
-    use["croplands"]=12
-    use["urban and built-up"]=13
-    use["cropland/natural vegetation mosaic"]=14
-    use["snow and ice"]=15
-    use["barren or sparsely vegetated"]=16
-    use["unclassified"]=254
-
-    split(wanteduses,wants,"[ ,]+")
-    for (w in wants) {
-      for (u in use) {
-        if (index(u, wants[w])) {
-          wantuse[use[u]] = 1
-        } 
-      }
-    }
-  }
-  {
-    if (FNR==1) {
-      if(filename != "") { print filename, sum}
-      filename = FILENAME
-      sum = 0
-    }
-  }
-  
-  wantuse[$2] { 
-    sum += $1
-  }
-  END { print filename, sum} ' $* |
-sort -n -k +2 |
-tail -${num} >$stats
-
-( awk '{print $1}' |
-  sed -e 's,^.*/,/,' -e 's/\..*/.tif/' -e 's,^,/home/wilde/bigdata/data/modis/2002/,' \
-# FIXME: dont hardcode dir path above
-# sed -e 's/landuse.//' -e 's/\..*/.tif/' -e 's,^,/home/wilde/bigdata/data/modis/2002/,' \
-) <$stats >$tilelist
-
-exit
-
-login1$ cat topselected.txt 
-modis-2011.0102.1636-urban-50-9/h09v07.landuse.byfreq 5312
-modis-2011.0102.1636-urban-50-9/h08v07.landuse.byfreq 12555
-modis-2011.0102.1636-urban-50-9/h08v06.landuse.byfreq 14824
-modis-2011.0102.1636-urban-50-9/h10v04.landuse.byfreq 14852
-modis-2011.0102.1636-urban-50-9/h09v06.landuse.byfreq 21432
-modis-2011.0102.1636-urban-50-9/h09v04.landuse.byfreq 32954
-modis-2011.0102.1636-urban-50-9/h09v05.landuse.byfreq 38591
-modis-2011.0102.1636-urban-50-9/h10v05.landuse.byfreq 66613
-modis-2011.0102.1636-urban-50-9/h08v05.landuse.byfreq 92674
-
-login1$ cat selectedtiles.txt 
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-/home/wilde/bigdata/data/modis/2002/modis-2011.tif
-login1$ 
-
----
-
-login1$ cat topurban.txt 
-landuse/h20v04.landuse.byfreq 67312 13 0d
-landuse/h28v06.landuse.byfreq 82267 13 0d
-landuse/h08v05.landuse.byfreq 92674 13 0d
-landuse/h11v04.landuse.byfreq 93702 13 0d
-landuse/h13v11.landuse.byfreq 104302 13 0d
-landuse/h12v04.landuse.byfreq 110772 13 0d
-landuse/h19v04.landuse.byfreq 120908 13 0d
-landuse/h27v05.landuse.byfreq 128794 13 0d
-landuse/h18v03.landuse.byfreq 142756 13 0d
-landuse/h18v04.landuse.byfreq 146486 13 0d
-
-login1$ cat urbantiles.txt 
-/home/wilde/bigdata/data/modis/2002landuse/h20v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h28v06.tif
-/home/wilde/bigdata/data/modis/2002landuse/h08v05.tif
-/home/wilde/bigdata/data/modis/2002landuse/h11v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h13v11.tif
-/home/wilde/bigdata/data/modis/2002landuse/h12v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h19v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h27v05.tif
-/home/wilde/bigdata/data/modis/2002landuse/h18v03.tif
-/home/wilde/bigdata/data/modis/2002landuse/h18v04.tif
-login1$ 
-
-   0  water
-   1  evergreen needleleaf forest
-   2  evergreen broadleaf forest
-   3  deciduous needleleaf forest
-   4  deciduous broadleaf forest
-   5  mixed forests
-   6  closed shrubland
-   7  open shrublands
-   8  woody savannas
-   9  savannas
-   10 grasslands
-   11 permanent wetlands
-   12 croplands
-   13 urban and built-up
-   14 cropland/natural vegetation mosaic
-   15 snow and ice
-   16 barren or sparsely vegetated
-   254 unclassified
-
-  use["water"]=0
-  use["evergreen needleleaf forest"]=1
-  use["evergreen broadleaf forest"]=2
-  use["deciduous needleleaf forest"]=3
-  use["deciduous broadleaf forest"]=4
-  use["mixed forests"]=5
-  use["closed shrubland"]=6
-  use["open shrublands"]=7
-  use["woody savannas"]=8
-  use["savannas"]=9
-  use["grasslands"]=10
-  use["permanent wetlands"]=11
-  use["croplands"]=12
-  use["urban and built-up"]=13
-  use["cropland/natural vegetation mosaic"]=14
-  use["snow and ice"]=15
-  use["barren or sparsely vegetated"]=16
-  use["unclassified"]=254
-
-
-use["water"]=0
-use["evergreenneedle"]=1
-use["evergreenleaf"]=2
-use["deciduousneedle"]=3
-use["deciduousleaf"]=4
-use["mixedforest"]=5
-use["closedshrub"]=6
-use["openshrub"]=7
-use["woody"]=8
-use["savanna"]=9
-use["grassland"]=10
-use["wetland"]=11
-use["cropland"]=12
-use["urban"]=13
-use["vegetation"]=14
-use["ice"]=15
-use["barren"]=16
-use["unclassified"]=17

Deleted: SwiftApps/modis/bin/analyzelandusep1.sh
===================================================================
--- SwiftApps/modis/bin/analyzelandusep1.sh	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/analyzelandusep1.sh	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,146 +0,0 @@
-#
-# Return (simple) stats and filenames for the tiles with the $num highest values of $wanteduses
-#
-
-stats=$1
-tilelist=$2
-wanteduses=$3
-num=$4
-shift 4
-
-awk -v wanteduses="$wanteduses" '
-  BEGIN {
-    sum = 0;
-    filename = "";
-
-    use["water"]=0
-    use["evergreen needleleaf forest"]=1
-    use["evergreen broadleaf forest"]=2
-    use["deciduous needleleaf forest"]=3
-    use["deciduous broadleaf forest"]=4
-    use["mixed forests"]=5
-    use["closed shrubland"]=6
-    use["open shrublands"]=7
-    use["woody savannas"]=8
-    use["savannas"]=9
-    use["grasslands"]=10
-    use["permanent wetlands"]=11
-    use["croplands"]=12
-    use["urban and built-up"]=13
-    use["cropland/natural vegetation mosaic"]=14
-    use["snow and ice"]=15
-    use["barren or sparsely vegetated"]=16
-    use["unclassified"]=254
-
-    split(wanteduses,wants,"[ ,]+")
-    for (w in wants) {
-      for (u in use) {
-        if (index(u, wants[w])) {
-          wantuse[use[u]] = 1
-        } 
-      }
-    }
-  }
-  {
-    if (FNR==1) {
-      if(filename != "") { print filename, sum}
-      filename = FILENAME
-      sum = 0
-    }
-  }
-  
-  wantuse[$2] { 
-    sum += $1
-  }
-  END { print filename, sum} ' $* |
-sort -n -k +2 |
-tail -${num} >$stats
-
-( awk '{print $1}' |
-  sed -e 's/landuse.//' -e 's/\..*/.tif/' -e 's,^,/home/wilde/bigdata/data/modis/2002/,' \
-) <$stats >$tilelist
-
-exit
-
-login1$ cat topurban.txt 
-landuse/h20v04.landuse.byfreq 67312 13 0d
-landuse/h28v06.landuse.byfreq 82267 13 0d
-landuse/h08v05.landuse.byfreq 92674 13 0d
-landuse/h11v04.landuse.byfreq 93702 13 0d
-landuse/h13v11.landuse.byfreq 104302 13 0d
-landuse/h12v04.landuse.byfreq 110772 13 0d
-landuse/h19v04.landuse.byfreq 120908 13 0d
-landuse/h27v05.landuse.byfreq 128794 13 0d
-landuse/h18v03.landuse.byfreq 142756 13 0d
-landuse/h18v04.landuse.byfreq 146486 13 0d
-
-login1$ cat urbantiles.txt 
-/home/wilde/bigdata/data/modis/2002landuse/h20v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h28v06.tif
-/home/wilde/bigdata/data/modis/2002landuse/h08v05.tif
-/home/wilde/bigdata/data/modis/2002landuse/h11v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h13v11.tif
-/home/wilde/bigdata/data/modis/2002landuse/h12v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h19v04.tif
-/home/wilde/bigdata/data/modis/2002landuse/h27v05.tif
-/home/wilde/bigdata/data/modis/2002landuse/h18v03.tif
-/home/wilde/bigdata/data/modis/2002landuse/h18v04.tif
-login1$ 
-
-   0  water
-   1  evergreen needleleaf forest
-   2  evergreen broadleaf forest
-   3  deciduous needleleaf forest
-   4  deciduous broadleaf forest
-   5  mixed forests
-   6  closed shrubland
-   7  open shrublands
-   8  woody savannas
-   9  savannas
-   10 grasslands
-   11 permanent wetlands
-   12 croplands
-   13 urban and built-up
-   14 cropland/natural vegetation mosaic
-   15 snow and ice
-   16 barren or sparsely vegetated
-   254 unclassified
-
-  use["water"]=0
-  use["evergreen needleleaf forest"]=1
-  use["evergreen broadleaf forest"]=2
-  use["deciduous needleleaf forest"]=3
-  use["deciduous broadleaf forest"]=4
-  use["mixed forests"]=5
-  use["closed shrubland"]=6
-  use["open shrublands"]=7
-  use["woody savannas"]=8
-  use["savannas"]=9
-  use["grasslands"]=10
-  use["permanent wetlands"]=11
-  use["croplands"]=12
-  use["urban and built-up"]=13
-  use["cropland/natural vegetation mosaic"]=14
-  use["snow and ice"]=15
-  use["barren or sparsely vegetated"]=16
-  use["unclassified"]=254
-
-
-use["water"]=0
-use["evergreenneedle"]=1
-use["evergreenleaf"]=2
-use["deciduousneedle"]=3
-use["deciduousleaf"]=4
-use["mixedforest"]=5
-use["closedshrub"]=6
-use["openshrub"]=7
-use["woody"]=8
-use["savanna"]=9
-use["grassland"]=10
-use["wetland"]=11
-use["cropland"]=12
-use["urban"]=13
-use["vegetation"]=14
-use["ice"]=15
-use["barren"]=16
-use["unclassified"]=17

Added: SwiftApps/modis/bin/draw_rectangle.pl
===================================================================
--- SwiftApps/modis/bin/draw_rectangle.pl	                        (rev 0)
+++ SwiftApps/modis/bin/draw_rectangle.pl	2013-02-13 17:31:30 UTC (rev 6264)
@@ -0,0 +1,45 @@
+#!/usr/bin/perl 
+
+# Draw a rectangle on a gzipped PPM 
+# Usage: draw_rectangle.pl infile.ppm.gz xmin ymin xmax ymax outfile.ppm.gz
+
+my ($pgm_input_filename, $xmin, $ymin, $xmax, $ymax, $pgm_output_filename) = @ARGV;
+open(PGMFILE_INPUT, "gunzip -c $pgm_input_filename |") || die "Unable to open $pgm_input_filename!";
+open(PGMFILE_OUTPUT, "| gzip -c > $pgm_output_filename") || die "Unable to create $pgm_output_filename";
+
+# Read header
+my $magic = <PGMFILE_INPUT>; 
+my $resolution = <PGMFILE_INPUT>;
+my $maxvalue = <PGMFILE_INPUT>;
+(my $xres, my $yres) = split(' ', $resolution);
+
+# Write new header
+print PGMFILE_OUTPUT "$magic" . "$resolution" . "$maxvalue";
+
+# Read data three bytes at a time (RGB)
+$/ = \3;
+my $x=0, $y=0;
+while(<PGMFILE_INPUT>) {
+   (my $red, my $green, my $blue) = unpack('C3', $_);
+
+   # Left and right of rectangle, 2 pixels wide
+   if ( $x == $xmin || $x == $xmin+1 || $x == $xmax || $x == $xmax-1 ) {
+      if ( $y <= $ymax && $y >= $ymin ) { 
+         $red="255"; $blue="0"; $green="0"; }
+   } 
+
+   # Top and bottom, 2 pixels high
+   if ( $y == $ymin || $y == $ymin-1 || $y == $ymax || $y == $ymax-1 ) {
+      if ( $x <= $xmax && $x >= $xmin ) { 
+         $red="255"; $blue="0"; $green="0";
+      }
+   }
+   
+   print PGMFILE_OUTPUT pack('C3', $red, $green, $blue);
+
+   if($x == $xres-1) { $x = 0; $y++; } 
+   else { $x++; }
+}
+
+close(PGMFILE_INPUT);
+close(PGMFILE_OUTPUT);


Property changes on: SwiftApps/modis/bin/draw_rectangle.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/modis/bin/getlanduse.pl
===================================================================
--- SwiftApps/modis/bin/getlanduse.pl	                        (rev 0)
+++ SwiftApps/modis/bin/getlanduse.pl	2013-02-13 17:31:30 UTC (rev 6264)
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+
+# Input to this program should be a gzipped PGM file
+# Usage: pgmhist.pl myfile.pgm.gz
+
+my $pgm_filename = shift;
+open(PGMFILE, "gunzip -c $pgm_filename |") || die "Unable to open $pgm_filename!\n";
+
+# Header
+my $magic = <PGMFILE>;
+my $resolution = <PGMFILE>;
+my $maxvalue = <PGMFILE>;
+
+# Use arrays to count frequencies
+my @pixelcount;
+foreach my $count(0..$maxvalue) {
+  $pixelcount[$count] = 0;
+}
+
+# Read values
+foreach(<PGMFILE>) {
+   foreach $word(split) {
+      $pixelcount[$word]++;
+   }
+}
+close(PGMFILE);
+
+foreach my $count(0..$maxvalue) {
+   if($pixelcount[$count] == 0){ next; }
+   printf("%d %d %02x\n", $pixelcount[$count], $count, $count);
+}
+


Property changes on: SwiftApps/modis/bin/getlanduse.pl
___________________________________________________________________
Added: svn:executable
   + *

Modified: SwiftApps/modis/bin/getlanduse.sh
===================================================================
--- SwiftApps/modis/bin/getlanduse.sh	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/getlanduse.sh	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,10 +1,4 @@
 #!/bin/bash
 
-#
-# Read a MODIS .tif file and return a histogram of pixel values.
-# The pixel values signify land use for that region (see legend in notes)
-#
-# Usage: getlanduse.sh modisFile histogramFile
-#
-
-$3/../../../bin/ppmhist.pl $1 | sort -n -k $2
+BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+$BINDIR/getlanduse.pl $1 | sort -rn

Added: SwiftApps/modis/bin/grid.ppm.gz
===================================================================
(Binary files differ)


Property changes on: SwiftApps/modis/bin/grid.ppm.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: SwiftApps/modis/bin/imagehist.sh
===================================================================
--- SwiftApps/modis/bin/imagehist.sh	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/imagehist.sh	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1 +0,0 @@
-convert $1  -format %c histogram:info:- 2>/dev/null | grep : | sort -nr

Modified: SwiftApps/modis/bin/markmap.sh
===================================================================
--- SwiftApps/modis/bin/markmap.sh	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/markmap.sh	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,25 +1,18 @@
+#!/bin/bash
+
 # markmap selectedTileFile outputMap
+BINDIR=$(cd $(dirname $0); pwd)
 
-bin=$(cd $(dirname $0); pwd)
-
 tilefile=$1
 outmap=$2
 
-cp $bin/grid.gif $outmap
+cp $BINDIR/grid.ppm.gz $outmap
+
 cat $tilefile | while read f ; do
   hv=$(echo $f | sed -e 's,^.*/,,' -e 's/\..*//')
   h=$(echo $hv | sed -e 's/h//' -e 's/v..//' -e 's/^0//')
   v=$(echo $hv | sed -e 's/h..//' -e 's/v//' -e 's/^0//')
   echo hv=$hv h=$h v=$v
-  convert $outmap -stroke red -linewidth 2 -fill transparent \
-                -draw "rectangle $((34+$h*16)),$((51+$v*16)) $((34+14+$h*16)),$((51+14+$v*16))" $outmap
+  $BINDIR/draw_rectangle.pl $outmap $((34+$h*16)) $((51+$v*16)) $((34+14+$h*16)) $((51+14+$v*16)) $outmap.tmp
+  mv $outmap.tmp $outmap
 done
-
-exit
-
-# example:
-
-h=18
-v=8
-cp grid.gif g.gif
-convert g.gif -stroke red -linewidth 2 -fill transparent -draw "rectangle $((34+$h*16)),$((51+$v*16)) $((34+14+$h*16)),$((51+14+$v*16))" g.gif

Deleted: SwiftApps/modis/bin/ppmhist.pl
===================================================================
--- SwiftApps/modis/bin/ppmhist.pl	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/ppmhist.pl	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,42 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-# Read file
-my $ppm_filename = shift;
-open(PPMFILE, "gunzip -c $ppm_filename |") || die "Unable to open $ppm_filename!\n";
-my @ppm_data = <PPMFILE>;
-close(PPMFILE);
-
-my %rgbcount = ();
-my $count=0;
-my $ppmformat="", my $resolution="", my $maxval="";
-
-foreach my $line(@ppm_data) {
-   chomp($line);
-   if ($count == 0){ $ppmformat=$line; $count++; next; }
-   if ($count == 1){ $resolution=$line; $count++; next; }
-   if ($count == 2){ $maxval=$line; $count++; next; }
-
-   my $wordcount=0, my $red="", my $green="", my $blue="";
-   foreach my $rgb(split(/\s+/, $line)) {
-      if($wordcount == 0) { $red=$rgb; $wordcount++; next; }
-      if($wordcount == 1) { $green=$rgb; $wordcount++; next; }
-      if($wordcount == 2) { 
-         $blue=$rgb; 
-         if(!defined($rgbcount{"$red $green $blue"})) { 
-            $rgbcount{"$red $green $blue"}=1;
-         } else {
-            $rgbcount{"$red $green $blue"}++;
-         }
-         $wordcount=0;
-      }
-   }
-   $count++;
-}
-
-while ( my ($key, $value) = each(%rgbcount) ) {
-   (my $red, my $green, my $blue) = split(/ /, $key);
-   my $hex = sprintf("%02x",$red);
-   print "$value $red $hex\n";
-}

Deleted: SwiftApps/modis/bin/setglobushost.sh
===================================================================
--- SwiftApps/modis/bin/setglobushost.sh	2013-02-13 03:56:56 UTC (rev 6263)
+++ SwiftApps/modis/bin/setglobushost.sh	2013-02-13 17:31:30 UTC (rev 6264)
@@ -1,2 +0,0 @@
-ipaddr=`/sbin/ifconfig | grep inet | head -1 | cut -d ':' -f 2 |awk '{print $1}'`
-export GLOBUS_HOSTNAME=$ipaddr




More information about the Swift-commit mailing list