#! /usr/bin/perl

use Data::Dumper;
use LWP::Simple;
use strict;

my $contents;
# https://www.cnrfc.noaa.gov/metar.php
my $station = "KGRB";
my $station = "KIPT";
my $station = "KPOU";
my $station = "KDTO";
my $metar_url_base = " https://tgftp.nws.noaa.gov/data/observations/metar/stations";
my $metar;
my $metar_url;

$metar_url = sprintf "%s/%s.TXT", $metar_url_base, $station;

printf "metar url: %s\n", $metar_url;

$contents = get($metar_url);
chomp $contents;

printf "\n";
printf "\n";
printf "\n";
printf "\n";
print Dumper $contents;

printf "\n";
printf "- = slight         + = Heavy\n";

printf "BC = Patches     BL = Blowing         BR = Mist          DR = Low Drifting\n";
printf "DS = Dust Storm  DU = Widespread Dust DZ = Drizzle       FC = Funnel Cloud (e.g. Tornado)\n";
printf "FG = Fog         FU = Smoke           FZ = Freezing      GR = Hail\n";
printf "GS = Small Hail  HZ = Haze            IC = Ice Crystals  MI = Shallow\n";
printf "PL = Ice Pellets PO = Dust Devils     RA = Rain          SA = Sand\n";
printf "SG = Snow Grains SH = Shower          SN = Snow          SQ = Squall\n";
printf "SS = Sandstorm   TS = Thunderstorm\n";



printf "VA = Volcanic Ash  VC = In the vicinity (nearby)  UP = Unidentified Precipitation    RE = Recent\n";
printf "\n";
printf "FEW = few (1-2 oktas), SCT = scattered (3-4 oktas), BKN = broken (5-7 oktas) or OVC = overcast (8 oktas),\n";
printf "\n";
printf "    The lowest Layer;\n";
printf "    The next lowest layer of SCT or more;\n";
printf "    The next higher layer of BKN or more;\n";
printf "    Significant convective cloud (CB or TCU) if not already reported.\n";

