Geo-WeatherNWS
view release on metacpan or search on metacpan
lib/Geo/WeatherNWS.pm view on Meta::CPAN
if ($Report->{error})
{
print "$Report->{errortext}";
}
If you have the report in a string, you can now just decode it
my $Obs="2002/02/25 12:00 NSFA 251200Z 00000KT 50KM FEW024 SCT150 27/25 Q1010";
$Report->decodeobs($Obs);
Assuming there was no error, you can now use the $Report hashref
to display the information. Some of the returned info is about
the report itself, such as:
$Report->{day} # Report day of month
$Report->{time} # Report Time
$Report->{station_type} # Station Type (auto or manual)
$Report->{obs} # The Observation Text (encoded)
$Report->{code} # The Station Code
These values might also be available.
(The values {day} and {time} above should always be available.)
$Report->{report_date} # Report Date
$Report->{report_time} # Report Time
This is the template output:
$Report->{templateout}
These are the returned values specific to the conditions:
$Report->{conditionstext} # Conditions text
$Report->{conditions1} # First Part
$Report->{conditions2} # Second Part
These are the returned values specific to wind:
$Report->{windspeedmph} # Wind Speed (in mph)
$Report->{windspeedkts} # Wind Speed (in knots)
$Report->{windspeedkmh} # Wind Speed (in km/h)
$Report->{winddir} # Wind Direction (in degrees)
$Report->{winddirtext} # Wind Direction (text version)
$Report->{windgustmph} # Wind Gusts (mph)
$Report->{windgustkts} # Wind Gusts (knots)
$Report->{windgustkmh} # Wind Gusts (km/h)
These are the returned values specific to temperature and
humidity:
$Report->{temperature_f} # Temperature (degrees f)
$Report->{temperature_c} # Temperature (degrees c)
$Report->{dewpoint_f} # Dewpoint (degrees f)
$Report->{dewpoint_c} # Dewpoint (degrees c)
$Report->{relative_humidity} # Relative Humidity (in percent)
$Report->{windchill_f} # Wind Chill (degrees f)
$Report->{windchill_c} # Wind Chill (degrees c)
$Report->{heat_index_f} # Heat Index (degrees f)
$Report->{heat_index_c} # Heat Index (degrees c)
Note: Due to the formulas used to get the heat index and windchill,
sometimes these values are a little strange. A check to see if the
heat index is above the temperature before displaying it would be
a good thing for you to do. You probably don't want to display
the windchill unless its cold either.
These are the return values for clouds and visibility:
$Report->{cloudcover} # Cloudcover (text)
$Report->{cloudlevel_arrayref} # Arrayref holding all cloud levels
$Report->{visibility_mi} # Visibility (miles)
$Report->{visibility_km} # Visibility (kilometers)
These are the return values for air pressure:
$Report->{pressure_inhg} # Air Pressure (in mercury)
$Report->{pressure_mmhg} # Air Pressure (in mm mercury)
$Report->{pressure_kgcm} # Air Pressure (kg per cm)
$Report->{pressure_mb} # Air Pressure (mb)
$Report->{pressure_lbin} # Air Pressure (psi)
Other values MAY be returned, but only if there are remarks
appended to the observations. This section of the code is more
experimental, and these names could change in future releases.
$Report->{remark_arrayref} # Arrayref holding all remarks
$Report->{ptemperature} # Precise Temperature Reading
$Report->{storm} # Thunderstorm stats
$Report->{slp_inhg} # Air Pressure at Sea Level (in mercury)
$Report->{slp_mmhg} # Air Pressure at Sea Level (mm mercury)
$Report->{slp_kgcm} # Air Pressure at Sea Level (kg per cm)
$Report->{slp_lbin} # Air Pressure at Sea Level (psi)
$Report->{slp_mb} # Air Pressure at Sea Level (mb)
Another note: Do not be surprised if sometimes the values come
back empty. The weather stations are not required to place all of
the information in the reports.
=head1 CONSTRUCTOR
=over
=item new ( )
Creates an object for the NWS METAR weather report.
=back
=head1 METHODS
=over
=item setservername( $Servername )
Set the server name for FTP access.
=item setusername( $User )
Set the username for FTP access.
=item setpassword( $Pass )
( run in 0.519 second using v1.01-cache-2.11-cpan-39bf76dae61 )