Added frames_to_ppm Octave script, use ImageMagick to convert to png
authorJohnathan Corgan <jcorgan@corganenterprises.com>
Mon, 2 Nov 2009 14:45:21 +0000 (06:45 -0800)
committerJohnathan Corgan <jcorgan@corganenterprises.com>
Mon, 2 Nov 2009 14:51:23 +0000 (06:51 -0800)
config/grc_gr_noaa.m4
gr-noaa/Makefile.am
gr-noaa/oct/.gitignore [new file with mode: 0644]
gr-noaa/oct/Makefile.am [new file with mode: 0644]
gr-noaa/oct/frames-to-png.sh [new file with mode: 0755]
gr-noaa/oct/frames_to_ppm.m [new file with mode: 0644]

index b00579ff589b5fc10c311312b81cef4464e7b3d9..69d0aad556b7374e464df8e9f7c7680ca45b4180 100644 (file)
@@ -30,6 +30,7 @@ AC_DEFUN([GRC_GR_NOAA],[
        gr-noaa/apps/Makefile \
        gr-noaa/grc/Makefile \
        gr-noaa/lib/Makefile \
+       gr-noaa/oct/Makefile \
        gr-noaa/python/Makefile \
        gr-noaa/swig/Makefile \
     ])
index f3f4f6a38fcbe7dc61a2face1d4d6f3384616184..854ce147663fe5d1f8e8ebb2af71a800e4fb0792 100644 (file)
@@ -21,7 +21,7 @@
 
 include $(top_srcdir)/Makefile.common
 
-SUBDIRS = lib grc
+SUBDIRS = lib grc oct
 
 if PYTHON
 SUBDIRS += swig python apps
diff --git a/gr-noaa/oct/.gitignore b/gr-noaa/oct/.gitignore
new file mode 100644 (file)
index 0000000..b336cc7
--- /dev/null
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gr-noaa/oct/Makefile.am b/gr-noaa/oct/Makefile.am
new file mode 100644 (file)
index 0000000..2f6e4e5
--- /dev/null
@@ -0,0 +1,26 @@
+#
+# Copyright 2009 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
+include $(top_srcdir)/Makefile.common
+
+EXTRA_DIST = \
+       frames_to_ppm.m \
+       frames-to-png.sh
diff --git a/gr-noaa/oct/frames-to-png.sh b/gr-noaa/oct/frames-to-png.sh
new file mode 100755 (executable)
index 0000000..cb3e3fb
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+octave --eval frames_to_ppm
+
+convert chan1.ppm chan1.png && rm chan1.ppm
+convert chan2.ppm chan2.png && rm chan2.ppm
+convert chan3.ppm chan3.png && rm chan3.ppm
+convert chan4.ppm chan4.png && rm chan4.ppm
+convert chan5.ppm chan5.png && rm chan5.ppm
diff --git a/gr-noaa/oct/frames_to_ppm.m b/gr-noaa/oct/frames_to_ppm.m
new file mode 100644 (file)
index 0000000..aeb22fa
--- /dev/null
@@ -0,0 +1,85 @@
+% -*- octave -*-
+%
+% Copyright 2009 Free Software Foundation, Inc.
+% 
+% This file is part of GNU Radio
+% 
+% GNU Radio is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 3, or (at your option)
+% any later version.
+% 
+% GNU Radio is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+% 
+% You should have received a copy of the GNU General Public License
+% along with GNU Radio; see the file COPYING.  If not, write to
+% the Free Software Foundation, Inc., 51 Franklin Street,
+% Boston, MA 02110-1301, USA.
+% 
+
+% Extract AVHRR images from HRPT frames.dat
+clear
+
+fid = fopen('frames.dat');
+dat = fread(fid, 'uint16');
+
+frame_len = 11090;
+
+len = floor(length(dat) / frame_len);
+
+chan1 = zeros(len, 2048);
+
+start = 751;
+stop = 10986;
+
+for line = 1:len
+  chan1(line, 1:2048) = dat(start:5:stop)';
+  start = start + frame_len;
+  stop = stop + frame_len;
+end
+start = 752;
+stop = 10987;
+
+for line = 1:len
+  chan2(line, 1:2048) = dat(start:5:stop)';
+start = start + frame_len;
+stop = stop + frame_len;
+end
+start = 753;
+stop = 10988;
+
+for line = 1:len
+  chan3(line, 1:2048) = dat(start:5:stop)';
+  start = start + frame_len;
+  stop = stop + frame_len;
+end
+start = 754;
+stop = 10989;
+
+for line = 1:len
+  chan4(line, 1:2048) = dat(start:5:stop)';
+start = start + frame_len;
+stop = stop + frame_len;
+end
+start = 755;
+stop = 10990;
+
+for line = 1:len
+  chan5(line, 1:2048) = dat(start:5:stop)';
+  start = start + frame_len;
+  stop = stop + frame_len;
+end
+
+colormap(gray) 
+saveimage("chan1.ppm", chan1/4, 'ppm')
+saveimage("chan2.ppm", chan2/4, 'ppm')
+saveimage("chan3.ppm", chan3/4, 'ppm')
+saveimage("chan4.ppm", chan4/4, 'ppm')
+saveimage("chan5.ppm", chan5/4, 'ppm')