<?php include 'classes/NexradDecoder.php'; // Base Reflectivity is encoded as a Radial Image, so we'll use // the Radial Packet Decoder class. include 'classes/RadialPacketDecoder.php'; $reflectivityDecoder = new RadialPacketDecoder(); $reflectivityDecoder->setFileResource('/tmp/sn.last'); // Now we decode all the available blocks. $headers = $reflectivityDecoder->parseMHB(); $description = $reflectivityDecoder->parsePDB(); $symbology = $reflectivityDecoder->parsePSB(); if ($description['graphicoffset'] != 0) { $graphic = $crDecoder->parseGAB(); } $zoom = 1; $width = 480 * $zoom; $height = 480 * $zoom; $im = @imagecreatetruecolor($width, $height); imageantialias($im, true); imagealphablending($im, true); $background_color = ImageColorAllocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, $width, $height, $background_color); $color[0] = ImageColorAllocate($im, 0, 0, 0); $color[1] = ImageColorAllocate($im, 0, 234, 236); $color[2] = ImageColorAllocate($im, 1, 160, 246); $color[3] = ImageColorAllocate($im, 0, 0, 246); $color[4] = ImageColorAllocate($im, 0, 255, 0); $color[5] = ImageColorAllocate($im, 0, 200, 0); $color[6] = ImageColorAllocate($im, 0, 144, 0); $color[7] = ImageColorAllocate($im, 255, 255, 0);
<?php include 'classes/NexradDecoder.php'; include 'classes/RadialPacketDecoder.php'; $reflectivityDecoder = new RadialPacketDecoder(); $reflectivityDecoder->setFileResource('c:\\nexrad\\sn.last.br'); $headers = $reflectivityDecoder->parseMHB(); $description = $reflectivityDecoder->parsePDB(); $symbology = $reflectivityDecoder->parsePSB(); $width = 600; $height = 600; $im = @imagecreatetruecolor($width, $height); imageantialias($im, true); imagealphablending($im, true); $background_color = ImageColorAllocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $background_color); $color[0] = ImageColorAllocate($im, 0, 0, 0); $color[1] = ImageColorAllocate($im, 153, 255, 255); $color[2] = ImageColorAllocate($im, 102, 153, 255); $color[3] = ImageColorAllocate($im, 0, 0, 204); $color[4] = ImageColorAllocate($im, 153, 255, 0); $color[5] = ImageColorAllocate($im, 51, 204, 0); $color[6] = ImageColorAllocate($im, 51, 102, 0); $color[7] = ImageColorAllocate($im, 255, 255, 51); $color[8] = ImageColorAllocate($im, 255, 204, 0); $color[9] = ImageColorAllocate($im, 255, 153, 0); $color[10] = ImageColorAllocate($im, 255, 0, 0); $color[11] = ImageColorAllocate($im, 204, 0, 0); $color[12] = ImageColorAllocate($im, 153, 0, 0); $color[13] = ImageColorAllocate($im, 255, 0, 204); $color[14] = ImageColorAllocate($im, 204, 0, 255);