Version 7 of Enhancing Satellite Weather Images

Updated 2005-08-28 17:55:51

Aug 28 2005 SRIV After noticing that some of the NOAA enhance satellite images were being delayed around 1-2 hours, I decided to try to enhance the higher resolution black & white images.

This script will download and display the latest North America image, then enhance the image with colors. Heres what the output looks like: http://server.linuxsys.net/images/latest_eastir_eh.gif compared to NOAA's image http://server.linuxsys.net/images/satimg.jpg .

RS Here's a snapshot of the Katrina Category 5 Hurricane (between Florida and N.O.) on 2005-08-28:

http://mini.net/files/katrina.gif


        # satenhance.tcl 08-28-2005 Steve Redler IV 
        package require Tk
        package require http

        canvas .c -width 1000 -height 900
        pack .c

        proc colorize {image} {
                # get image sizes
                set width  [image width  $image]
                set height [image height $image]

                for {set y 0} {$y < $height} {incr y} {
                        puts "row=$y"
                        set row {}
                        for {set x 0} {$x < $width} {incr x} {
                                # save transparency
                                lappend trans $x $y [$image transparency get $x $y]
                                # compute the new color
                                foreach {r g b} [$image get $x $y] break
                                if {$r > 254} {
                                        #white
                                        lappend row [format #%02x%02x%02x 255 255 255]
                                        continue
                                } elseif {$r > 240} {
                                        #dkgrey
                                        lappend row [format #%02x%02x%02x 50 50 50]
                                        continue
                                } elseif {$r > 230} {
                                        #ltgreen
                                        lappend row [format #%02x%02x%02x 132 247 128]
                                        continue
                                } elseif {$r > 226} {
                                        #green
                                        lappend row [format #%02x%02x%02x 60 214 18]
                                        continue
                                } elseif {$r > 222} {
                                        #ltpink
                                        lappend row [format #%02x%02x%02x 249 127 124]
                                        continue
                                } elseif {$r > 218} {
                                        #pink
                                        lappend row [format #%02x%02x%02x 255 91 98]
                                        continue
                                } elseif {$r > 214} {
                                        #ltred
                                        lappend row [format #%02x%02x%02x 217 0 0]
                                        continue
                                } elseif {$r > 210} {
                                        #red
                                        lappend row [format #%02x%02x%02x 150 0 0]
                                        continue
                                } elseif {$r > 205} {
                                        #dkred
                                        lappend row [format #%02x%02x%02x 114 0 0]
                                        continue
                                } elseif {$r > 200} {
                                        #ltble
                                        lappend row [format #%02x%02x%02x 0 215 230]
                                        continue
                                } elseif {$r > 195} {
                                        #blue
                                        lappend row [format #%02x%02x%02x 0 100 170]
                                        continue
                                } elseif {$r > 190} {
                                        #dkblue
                                        lappend row [format #%02x%02x%02x 0 11 100]
                                        continue
                                } elseif {$r > 185} {
                                        #ltyellow
                                        lappend row [format #%02x%02x%02x 240 240 0]
                                        continue
                                } elseif {$r > 180} {
                                        #yellow
                                        lappend row [format #%02x%02x%02x 160 160 0]
                                        continue
                                } elseif {$r > 170} {
                                        #dkyellow
                                        lappend row [format #%02x%02x%02x 100 100 0]
                                        continue
                                } else {
                                        lappend row [format #%02x%02x%02x $r $r $r]
                                }

                        }
                        # update the row of the image
                        satimage put \{$row\} -to 0 $y
                        update
                }

                # restore transparency
                foreach {x y t} $trans { $image transparency set $x $y $t }
        }

        set imagedata [http::data [http::geturl http://www.ssec.wisc.edu/data/east/latest_eastir.gif]]


        image create photo satimage -data $imagedata
        .c create image 0 0 -image satimage -tag imgtag -anchor nw

        update
        after 100 [colorize satimage]
        update
        # write the result to disk
        satimage write latest_eastir_eh.gif -format gif