diff --git a/bin/get_weather b/bin/get_weather index 83fda2bb1..6549707af 100755 --- a/bin/get_weather +++ b/bin/get_weather @@ -39,7 +39,7 @@ my %parms; if ( !&GetOptions( \%parms, "h", "help", "v", "city:s", "zone:s", - "state:s", "data=s", "no_log" + "state:s", "data=s", "no_log", "nws_rwr_zone:s" ) or @ARGV or ( $parms{h} or $parms{help} ) @@ -102,7 +102,7 @@ $Geo::WeatherNOAA::proxy_from_env = 1; if ( $data{conditions} ) { print "\nGetting the current weather for $parms{city}, $parms{state}\n"; $conditions = - print_current( $parms{city}, $parms{state}, undef, undef, undef, 1 ); + print_current( $parms{city}, $parms{state}, undef, undef, undef, $parms{nws_rwr_zone} ); $conditions =~ s/°F/ degrees /; $conditions =~ s/ in\./ inches. /g; } diff --git a/code/common/internet_weather.pl b/code/common/internet_weather.pl index 3c8afde7b..858303352 100644 --- a/code/common/internet_weather.pl +++ b/code/common/internet_weather.pl @@ -80,7 +80,7 @@ sub normalize_conditions { if ( said $v_get_internet_weather_data) { if (&net_connect_check) { set $p_weather_data - qq|get_weather -state $config_parms{state} -city "$config_parms{city}"|; + qq|get_weather -state $config_parms{state} -city "$config_parms{city}" -nws_rwr_zone $config_parms{nws_rwr_zone}|; start $p_weather_data; $v_get_internet_weather_data->respond( "app=weather Weather data requested for $config_parms{city}, $config_parms{state}" @@ -97,7 +97,7 @@ sub normalize_conditions { if ( said $v_get_internet_weather_conditions) { if (&net_connect_check) { set $p_weather_conditions - qq|get_weather -state $config_parms{state} -city "$config_parms{city}" -data conditions|; + qq|get_weather -state $config_parms{state} -city "$config_parms{city}" -data conditions -nws_rwr_zone $config_parms{nws_rwr_zone}|; start $p_weather_conditions; $v_get_internet_weather_conditions->respond( "app=weather Weather conditions requested for $config_parms{city}, $config_parms{state}" diff --git a/lib/site/Geo/WeatherNOAA.pm b/lib/site/Geo/WeatherNOAA.pm index 57d29170f..caf4f9fb6 100644 --- a/lib/site/Geo/WeatherNOAA.pm +++ b/lib/site/Geo/WeatherNOAA.pm @@ -480,8 +480,7 @@ sub ucfirst_words { ######################################################################### sub get_city_hourly { - my ( $city, $state, $filename, $fileopt, $UA ) = @_; - + my ( $city, $state, $filename, $fileopt, $UA, $rwrzone ) = @_; # City and state in all caps please # $city = uc $city; @@ -493,11 +492,12 @@ sub get_city_hourly { # Get data # my $zone = &get_zone( $ZONE_SEARCH_URL, "$city, $state" ); + $rwrzone = $zone unless length($rwrzone); my $URL = $URL_BASE . $zone . '&issuedby=' - . $zone + . $rwrzone . '&product=RWR&format=txt&version=1&glossary=0'; #print STDERR "Getting data from $URL\n"; @@ -514,7 +514,14 @@ sub get_city_hourly { $data = get_data( $URL, $filename, $fileopt, $UA ); $datalength = length($data); } - + if ( $data =~ /None issued/ ) { + print " + NWS is not returing any information, please configure the 2 or 3 letter zone + in the mh.private.ini with the nws_rwr_zone option. IE: nws_rwr_zone=LIX + The zone can be found at the following site: + http://forecast.weather.gov/product_sites.php?site=$zone&product=RWR\n + "; + } #print STDERR "Got data ($datalength)\n"; # Return error if there's an error @@ -598,14 +605,14 @@ sub get_city_hourly { } # get_city_hourly() sub print_current { - my ( $city, $state, $filename, $fileopt, $UA ) = @_; - my $in = process_city_hourly( $city, $state, $filename, $fileopt, $UA ); + my ( $city, $state, $filename, $fileopt, $UA, $rwrzone ) = @_; + my $in = process_city_hourly( $city, $state, $filename, $fileopt, $UA, $rwrzone ); return wrap( '', ' ', $in ); } sub process_city_hourly { - my ( $city, $state, $filename, $fileopt, $UA ) = @_; - my $in = get_city_hourly( $city, $state, $filename, $fileopt, $UA ); + my ( $city, $state, $filename, $fileopt, $UA, $rwrzone ) = @_; + my $in = get_city_hourly( $city, $state, $filename, $fileopt, $UA, $rwrzone ); $state = uc($state);