#!/usr/bin/perl -w # ## Copyright (c) 2007 University of Miami # my $pkgdoc = <<'EOD'; #/**-------------------------------------------------------------------------------- # @ file radiosondeparcer.pl # This scirpt parces the fetched radiosonde data from # the plymoth website. # # @ussage radiosondeparcer.pl ddd.hh.yyyy.index.txt # date: Jan 18, 2007 #----------------------------------------------------------------------------------*/ EOD # $Log$ use strict; use warnings; use Getopt::Long; if (@ARGV <1) { print $pkgdoc; exit -1; } my $txtfile = shift; open (IN, $txtfile)||die "cannot open $txtfile for reading"; #/**--------------------------------------------------------------------------------- # Read important info on txtfile and add it to the hash # structurepassed in. # # # txtfiles look like this: # # # Plymouth State RAOB Thermodynamic Diagram/Data #
# Miami Intl Airp FL US KMIA 1 25.82 -80.28 4 72202
#
# Date: 0000Z 24 AUG 05
# Station: KMIA
# WMO ident:  72202
# Latitude:   25.82
# Longitude: -80.28
# Elevation:   4.00
# -------------------------------------------------------------------------------
# LEV PRES  HGHT  TEMP  DEWP  RH  DD   WETB DIR SPD THETA THE-V THE-W THE-E   W
#      mb     m     C     C    %   C     C  deg knt   K     K     K     K    g/kg
# -------------------------------------------------------------------------------
# SFC 1012     4  29.8  23.8  70  6.0  25.3 100  10 301.9 305.3 298.1 357.0 18.65
#   1 1000   113  28.8  23.8  74  5.0  25.1  95  12 302.0 305.4 298.2 357.7 18.88
#   2  961   466  25.4  22.3  83  3.1  23.2  93  15 302.0 305.3 297.7 354.9 17.91
#   3  925   802  23.2  19.4  79  3.8  20.5  95  15 303.0 305.9 296.4 349.0 15.51
#   4  850  1536  19.0  14.0  73  5.0  15.7  95  14 306.0 308.3 294.7 341.8 11.91
#   5  769  2390  14.2   8.2  67  6.0  10.5  96  11 309.8 311.4 293.6 337.0  8.91
#   6  753  2568  12.4  10.5  88  1.9  11.2  97  11 309.7 311.7 294.8 342.2 10.65
#   7  737  2748  11.8   6.8  71  5.0   8.8 100  11 310.9 312.5 293.6 336.9  8.44
#   8  700  3178   9.4   4.4  71  5.0   6.5 110  11 312.9 314.3 293.4 336.3  7.51
#   ...
#
# 
#-----------------------------------------------------------------------------------*/


LINE:
while (my $line = ) {
	next LINE if ($line =~ //);
	next LINE if ($line =~ /</center>/);
	my my ($LAT, $LON) = (split(' ', $line)[-4,-3]);
	next LINE if ($line =~ /Date\:/);
	next LINE if ($line =~ /Station\:/);
	next LINE if ($line =~ /WMO/);
	next LINE if ($line =~ /Latitude\:/);
	next LINE if ($line =~ /Longitude\:/);
	next LINE if ($line =~ /-------------------------------------------------------------------------------/);
	next LINE if ($line =~ /LEV/);
	next LINE if ($line =~ /mb/);
	my ($LEV, $PRES, $HGHT,  $TEMP, $DEWP, $RH, $DD, $WETB, $DIR, $SPD, $THETA, $THE-V, $THE-W, $THE-E, $W) = split (' ", $line);
	
}

open (OUT, ">$txtfile.reduced);
print OUT "$LAT, $LON, $PRES, $HGHT, $TEMP, $DEWP, $DIR, $SPD\n";

close (IN);
close (OUT);