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

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Fri Aug 2 13:35:38 CDT 2013


Author: davidk
Date: 2013-08-02 13:35:38 -0500 (Fri, 02 Aug 2013)
New Revision: 6714

Added:
   SwiftApps/modis/bin/montage.pl
Log:
Perl montage script


Added: SwiftApps/modis/bin/montage.pl
===================================================================
--- SwiftApps/modis/bin/montage.pl	                        (rev 0)
+++ SwiftApps/modis/bin/montage.pl	2013-08-02 18:35:38 UTC (rev 6714)
@@ -0,0 +1,35 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+if ( $#ARGV < 5 ) {
+   die "Usage: montage.pl <columns> <rows> <xres> <yres> <input_files>\n";
+}
+
+my $cols=shift;
+my $rows=shift;
+my $xres=shift;
+my $yres=shift;
+
+open(OUTFILE, ">output.rgb") || die "Unable to open output.rgb";
+
+while(@ARGV) {
+
+   my @filehandles;
+
+   foreach(1..$cols) {
+      local *FILE;
+      my $filename = shift;
+      open(FILE, "$filename") || die "Unable to open $filename";
+      binmode FILE;
+      push(@filehandles, *FILE);
+   }
+
+   foreach my $y (1..$yres) {      
+      foreach my $colnum (1..$cols) {
+         my $bytedata;
+         my $result = read($filehandles[$colnum-1], $bytedata, (3*$xres));
+         print OUTFILE $bytedata;
+      }
+   }
+}


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




More information about the Swift-commit mailing list