The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Weather::NWS::NDFDgen - Object interface to the NWS NDFDgen Web Service.

VERSION

Version 0.02

SYNOPSIS

    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();
        

NDFDgen

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.

Latitude

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.

Longitude

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.

Product

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.

Start Time

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.

End Time

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.

Weather Parameters

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

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

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

3 Hourly temperature is the expected temperature valid for the indicated hour.

Dewpoint Temperature

Dewpoint temperature is the expected dew point temperature for the indicated hour.

Apparent Temperature

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

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

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

Cloud cover amount is the expected amount of all opaque clouds (in percent) covering the sky for the indicated hour.

Snowfall Amount

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

Wind speed is the expected sustained 10 meter wind speed for the indicated hour.

Wind Direction

Wind direction is the expected sustained 10 meter wind direction for the indicated hour, using 36 points of a compass.

Weather

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

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

Weather icons are links to images from the NWS that illustrate weather conditions at specific time points.

Relative Humidity

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.

METHODS

BUILD (new)

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'.

set_latitude

Sets the latitude for the object. This is a decimal value.

get_latitude

Returns the latitude stored in the object.

set_longitude

Sets the longitude for the object. This is a decimal value.

get_longitude

Returns the longitude stored in the object.

set_product

Sets the product for the object. This is either 'Time-Series' or 'Glance'.

get_product

Returns the product stored in the object.

set_start_time

Sets the start time for the object.

get_start_time

Gets the start time stored in the object.

set_end_time

Sets the end time for the object.

get_end_time

Gets the end time stored in the object.

set_weather_parameters

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.

get_weather_parameters

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.

get_available_products

Return a list of all products available through this service.

get_available_weather_parameters

Return a list of all weather parameters that can be requested through this service.

get_forecast_xml

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.

AUTHOR

Josh McAdams, <josh dot mcadams at gmail dot com>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Weather::NWS::NDFDgen

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

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:

Around line 172:

Non-ASCII character seen before =encoding in '°F'. Assuming UTF-8