Weather::NWS::NDFDgen - Object interface to the NWS NDFDgen Web Service.
Version 0.02
use Weather::NWS::NDFDgen; my $NDFDgen = Weather::NWS::NDFDgen->new(); my $NDFDgen = Weather::NWS::NDFDgen->new( 'Product' => 'Time-Series', 'Latitude' => 42, 'Longitude' => -88, 'Weather Parameters' => { 'Maximum Temperature' => 1, 'Minimum Temperature' => 0, }, ); my $latitude = 42; $NDFDgen->set_latitude($latitude); $latitude = $NDFDgen->get_latitude(); my $longitude = -88; $NDFDgen->set_longitude($longitude); $longitude = $NDFDgen->get_longitude(); my $product = 'Time-Series'; $NDFDgen->set_product($product); $product = $NDFDgen->get_product(); my $start_time = scalar localtime; $NDFDgen->set_start_time($start_time); $start_time = $NDFDgen->get_start_time(); my $end_time = scalar localtime; $NDFDgen->set_end_time($end_time); $end_time = $NDFDgen->get_end_time(); $NDFDgen->set_weather_parameters( 'Maximum Temperature' => 1, 'Minimum Temperature' => 0, ); my @weather_parameters = $NDFDgen->get_weather_parameters( 'Maximum Temperature', 'Minimum Temperature', ); my $xml = $NDFDgen->get_forecast_xml(); my $xml = $NDFDgen->get_forecast_xml( 'Product' => 'Time-Series', 'Latitude' => 42, 'Longitude' => -88, 'Weather Parameters' => { 'Maximum Temperature' => 1, 'Minimum Temperature' => 0, }, ); my @products = $NDFDgen->get_available_products(); my @weather_parameters = $NDFDgen->get_available_weather_parameters();
The NDFDgen web service is provided by the National Weather Service as part of their National Digital Forecast Database. Official NWS documentation for the XML web service can be found at http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php.
The service allows for users to request custom weather forecasts based on the following parameters.
The latitude of the point for which you want NDFD data. For Northern latituded, this will be a positive decimal value, such as 42.011.
The longitude of the point for which you want NDFD data. For Western longitudes, this will be a negative decimal value, such as -88.81.
There are two products presented by NDFDgen. These are the time-series and glance products. The time-series product returns all data between the start and end times for the selected weather parameters. The glance product returns all data between the start and end times for maximum temperature, minimum temperature, cloud cover, weather and weather icons elements.
For this object, 'Time-Series' and 'Glance' are used to identify the products.
The beginning time for which you want NDFD data. The format for this date is and XSD DateTime, which is represented like '2004-01-01T00:00:00'. You can really pass almost any date format in as the start time though because the date is passed through SOAP::DateTime before use.
The ending time for which you want NDFD data. The format for this date is and XSD DateTime, which is represented like '2004-01-01T00:00:00'. You can really pass almost any date format in as the end time though because the date is passed through SOAP::DateTime before use.
You can request any set of multiple weather parameters. These parameters are listed below. The definitions are taken from the NWS at http://www.nws.noaa.gov/ndfd/definitions.htm.
Maximum temperature is the daytime max or the overnight min temperature. Verifying observations are deduced via a comprehensive algorithm that examines reported max/min and hourly temperatures. Daytime is defined as 0700-1900 Local Standard Time, and overnight as 1900-0800 Local Standard Time.
Minimum temperature is the daytime max or the overnight min temperature. Verifying observations are deduced via a comprehensive algorithm that examines reported max/min and hourly temperatures. Daytime is defined as 0700-1900 Local Standard Time, and overnight as 1900-0800 Local Standard Time.
3 Hourly temperature is the expected temperature valid for the indicated hour.
Dewpoint temperature is the expected dew point temperature for the indicated hour.
Apparent temperature is the perceived temperature derived from either a combination of temperature and wind (Wind Chill), or temperature and humidity (Heat Index) for the indicated hour. Apparent temperature grids will signify the Wind Chill when temperatures fall to 50 °F or less, and the Heat Index when temperatures rise above 80 °F. Between 51 and 80 °F the Apparent Temperature grids will be populated by the ambient air temperature.
12 hour probability of precipitation is defined as the likelihood, expressed as a percent, of a measurable precipitation event (1/100th of an inch or more ) during the 12-hour valid period. The 12-hour periods begin and end at 0000 and 1200 UTC.
Liquid precipitation amount is the total amount of expected liquid precipitation during a 6-hour period. The 6-hour periods begin and end at 0600, 1200, 1800, and 0000 UTC.
Cloud cover amount is the expected amount of all opaque clouds (in percent) covering the sky for the indicated hour.
Snowfall amount is the expected total accumulation of new snow during a 6-hour period. The 6-hour periods begin and end at 0600, 1200, 1800, and 0000 UTC.
Wind speed is the expected sustained 10 meter wind speed for the indicated hour.
Wind direction is the expected sustained 10 meter wind direction for the indicated hour, using 36 points of a compass.
Weather is the expected weather (precipitating or non-precipitating) valid at the indicated hour. Precipitating weather includes type, probability, and intensity information. In cases of convective weather, coverage may be substituted for probability.
Wave height (significant) is the average height (trough to crest) of the one-third highest waves for the indicated 12-hour period. The 12-hour periods begin and end at 0000 and 1200 UTC.
Weather icons are links to images from the NWS that illustrate weather conditions at specific time points.
Relative humidity is the expected Relative Humidity (RH) for the indicated hour. RH is derived from the associated Temperature and Dew Point grids for the indicated hour.
Constructor for new NDFDgen objects. If called with no parameters, it will return a new object initialized with the 'Time-Series' product and the current time as the start time. All other parameters are left unintialized. Values can be provided for 'Latitude', 'Longitude', 'Product', 'Start Time', 'End Time', and 'Weather Parameters'.
Sets the latitude for the object. This is a decimal value.
Returns the latitude stored in the object.
Sets the longitude for the object. This is a decimal value.
Returns the longitude stored in the object.
Sets the product for the object. This is either 'Time-Series' or 'Glance'.
Returns the product stored in the object.
Sets the start time for the object.
Gets the start time stored in the object.
Sets the end time for the object.
Gets the end time stored in the object.
Sets the weather parameters for the object. These parameters are passed in as a list of key-value pairs where the key is the weather parameter and the value is a 1 or 0 indicating wether or not the parameter is going to be requested or not.
Returns the requested weather parameters stored in the object as key-value pairs where the key is the weather parameter and the value is a 1 or 0 indicating wether or not the parameter is going to be requested or not.
A list of parameter names can be passed to this method so that only those parameters are returned. If no arguments are passed to this method, all parameters will be returned.
Return a list of all products available through this service.
Return a list of all weather parameters that can be requested through this service.
Return the NWS NDFD XML as described in http://products.weather.gov/PDD/Extensible_Markup_Language.pdf. The data returned depends on the state of the NDFDgen object at the time of the call to this method. Any parameters can be overridden by being passed in as arguments to this method.
Josh McAdams, <josh dot mcadams at gmail dot com>
<josh dot mcadams at gmail dot com>
Please report any bugs or feature requests to bug-weather-nws-ndfdgen at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Weather-NWS-NDFDgen. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-weather-nws-ndfdgen at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Weather::NWS::NDFDgen
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Weather-NWS-NDFDgen
CPAN Ratings
http://cpanratings.perl.org/d/Weather-NWS-NDFDgen
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Weather-NWS-NDFDgen
Search CPAN
http://search.cpan.org/dist/Weather-NWS-NDFDgen
Copyright 2006 Josh McAdams, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '°F'. Assuming UTF-8
To install Weather::NWS::NDFDgen, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Weather::NWS::NDFDgen
CPAN shell
perl -MCPAN -e shell install Weather::NWS::NDFDgen
For more information on module installation, please visit the detailed CPAN module installation guide.