barometer-noaa 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +9 -0
- data/barometer-noaa.gemspec +24 -0
- data/lib/barometer/noaa/current_api.rb +23 -0
- data/lib/barometer/noaa/current_query.rb +28 -0
- data/lib/barometer/noaa/current_response.rb +27 -0
- data/lib/barometer/noaa/forecast_api.rb +23 -0
- data/lib/barometer/noaa/forecast_query.rb +37 -0
- data/lib/barometer/noaa/forecast_response.rb +26 -0
- data/lib/barometer/noaa/response/current_location.rb +40 -0
- data/lib/barometer/noaa/response/current_station.rb +44 -0
- data/lib/barometer/noaa/response/current_weather.rb +80 -0
- data/lib/barometer/noaa/response/forecasted_weather.rb +88 -0
- data/lib/barometer/noaa/response/location.rb +17 -0
- data/lib/barometer/noaa/response/timezone.rb +13 -0
- data/lib/barometer/noaa/version.rb +5 -0
- data/lib/barometer/noaa.rb +33 -0
- data/spec/cassettes/Noaa.json +1 -0
- data/spec/noaa/current_response_spec.rb +22 -0
- data/spec/noaa/forecast_response_spec.rb +33 -0
- data/spec/noaa_spec.rb +83 -0
- data/spec/spec_helper.rb +22 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cbf5f7d9c1a601b96733ee33ee495bb26412eb1a
|
4
|
+
data.tar.gz: bf66b2c989f2be096bb8979f8035d41a0e1c3f21
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 523d62c89429d8d29f34718fb7873f5a6b9e82eec0e363fe3e0bcb260db232df2e6ceca58d1be5a2569672442d148b8a5b86048bf5ceb2c015d24beef3e500ca
|
7
|
+
data.tar.gz: 42e183abba9a9e28a767abbeaacc631679f0171b42d61b21397d5e9234a055ec3dc29496cec9bce15b856f580359b4ab1567477d90a2d12f64d03d3eaf9ee6de
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Mark Gangl
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Barometer::Noaa
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/attack/barometer-noaa.png?branch=master)](https://travis-ci.org/attack/barometer-noaa)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/barometer-noaa.png)](http://badge.fury.io/rb/barometer-noaa)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/attack/barometer-noaa.png)](https://codeclimate.com/github/attack/barometer-noaa)
|
6
|
+
|
7
|
+
A wrapper for the Noaa weather API. This wrapper is
|
8
|
+
barometer compatiable and can be used with or without barometer.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
This wrapper was designed to be used via [Barometer](https://github.com/attack/barometer), or on its own.
|
13
|
+
|
14
|
+
### Directly
|
15
|
+
|
16
|
+
By using this wrapper directly, you lose any Barometer aggregation and
|
17
|
+
failover capabilities. Barometer is still dependency to provide a
|
18
|
+
framework for query conversion, weather service integration and data
|
19
|
+
processing.
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
query = Barometer::Query.new('42.7243,-73.6927')
|
23
|
+
keys = {client_id: 'client_id', client_secret: 'client_secret'}
|
24
|
+
|
25
|
+
result = Barometer::Noaa.call(query, keys: keys)
|
26
|
+
puts result.current.temperature.c
|
27
|
+
```
|
28
|
+
|
29
|
+
### via Barometer
|
30
|
+
|
31
|
+
Barometer is a weather service framework, providing aggregation and failover
|
32
|
+
capabilities. To make Noaa available to Barometer, you must register
|
33
|
+
it as an available weather service.
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Barometer::WeatherService.register(:noaa, Barometer::Noaa)
|
37
|
+
```
|
38
|
+
|
39
|
+
Then follow the instructions provided by [Barometer](https://github.com/attack/barometer).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
48
|
+
|
49
|
+
## Links
|
50
|
+
|
51
|
+
* repo: http://github.com/attack/barometer-noaa
|
52
|
+
* travis ci: https://travis-ci.org/attack/barometer-noaa
|
53
|
+
* code climate: https://codeclimate.com/github/attack/barometer-noaa
|
54
|
+
|
55
|
+
## Copyright
|
56
|
+
|
57
|
+
Copyright (c) 2009-2014 Mark Gangl. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'barometer/noaa/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'barometer-noaa'
|
7
|
+
spec.version = Barometer::Noaa::VERSION
|
8
|
+
spec.authors = ['Mark Gangl']
|
9
|
+
spec.email = ['mark@attackcorp.com']
|
10
|
+
spec.description = 'A barometer adapter for Noaa weather'
|
11
|
+
spec.summary = spec.description
|
12
|
+
spec.homepage = 'https://github.com/attack/barometer-noaa'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.platform = Gem::Platform::RUBY
|
16
|
+
spec.required_ruby_version = '>= 1.9.2'
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
19
|
+
spec.test_files = spec.files.grep(%r{^spec/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'barometer', '~> 0.9.6'
|
23
|
+
spec.add_development_dependency 'bundler'
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'current_query'
|
2
|
+
|
3
|
+
module Barometer
|
4
|
+
class Noaa
|
5
|
+
class CurrentApi < Utils::Api
|
6
|
+
def initialize(query)
|
7
|
+
@query = CurrentQuery.new(query)
|
8
|
+
end
|
9
|
+
|
10
|
+
def url
|
11
|
+
"http://w1.weather.gov/xml/current_obs/#{@query.to_param}.xml"
|
12
|
+
end
|
13
|
+
|
14
|
+
def params
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def unwrap_nodes
|
19
|
+
['current_observation']
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
|
3
|
+
module Barometer
|
4
|
+
class Noaa
|
5
|
+
class CurrentQuery < SimpleDelegator
|
6
|
+
attr_reader :converted_query
|
7
|
+
|
8
|
+
def self.accepted_formats
|
9
|
+
[:noaa_station_id]
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(query)
|
13
|
+
super
|
14
|
+
@converted_query = convert_query
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_param
|
18
|
+
converted_query.q
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def convert_query
|
24
|
+
convert!(*self.class.accepted_formats)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'response/timezone'
|
2
|
+
require_relative 'response/current_location'
|
3
|
+
require_relative 'response/current_station'
|
4
|
+
require_relative 'response/current_weather'
|
5
|
+
|
6
|
+
module Barometer
|
7
|
+
class Noaa
|
8
|
+
class CurrentResponse
|
9
|
+
def initialize(response)
|
10
|
+
@response = response
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse(payload)
|
14
|
+
response.timezone = Noaa::Response::TimeZone.new(payload).parse
|
15
|
+
response.location = Noaa::Response::CurrentLocation.new(payload, response).parse
|
16
|
+
response.station = Noaa::Response::CurrentStation.new(payload, response).parse
|
17
|
+
response.current = Noaa::Response::CurrentWeather.new(payload).parse
|
18
|
+
|
19
|
+
response
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :response
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'forecast_query'
|
2
|
+
|
3
|
+
module Barometer
|
4
|
+
class Noaa
|
5
|
+
class ForecastApi < Utils::Api
|
6
|
+
def initialize(query)
|
7
|
+
@query = ForecastQuery.new(query)
|
8
|
+
end
|
9
|
+
|
10
|
+
def url
|
11
|
+
'http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php'
|
12
|
+
end
|
13
|
+
|
14
|
+
def params
|
15
|
+
{format: '24 hourly', numDays: '7'}.merge(@query.to_param)
|
16
|
+
end
|
17
|
+
|
18
|
+
def unwrap_nodes
|
19
|
+
['dwml', 'data']
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
|
3
|
+
module Barometer
|
4
|
+
class Noaa
|
5
|
+
class ForecastQuery < SimpleDelegator
|
6
|
+
attr_reader :converted_query
|
7
|
+
|
8
|
+
def self.accepted_formats
|
9
|
+
[:zipcode, :coordinates]
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(query)
|
13
|
+
super
|
14
|
+
@converted_query = convert_query
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_param
|
18
|
+
case converted_query.format.to_sym
|
19
|
+
when :short_zipcode
|
20
|
+
{zipCodeList: converted_query.q}
|
21
|
+
when :zipcode
|
22
|
+
{zipCodeList: converted_query.q}
|
23
|
+
when :coordinates
|
24
|
+
{lat: converted_query.q.split(',')[0], lon: converted_query.q.split(',')[1]}
|
25
|
+
else
|
26
|
+
{}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def convert_query
|
33
|
+
convert!(*self.class.accepted_formats)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative 'response/location'
|
2
|
+
require_relative 'response/forecasted_weather'
|
3
|
+
|
4
|
+
module Barometer
|
5
|
+
class Noaa
|
6
|
+
class ForecastResponse
|
7
|
+
def initialize
|
8
|
+
@response = Barometer::Response.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def parse(payload)
|
12
|
+
response.add_query(payload.query)
|
13
|
+
|
14
|
+
response.location = Noaa::Response::Location.new(payload).parse
|
15
|
+
response.station = response.location
|
16
|
+
response.forecast = Noaa::Response::ForecastedWeather.new(payload).parse
|
17
|
+
|
18
|
+
response
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :response
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Barometer
|
2
|
+
class Noaa
|
3
|
+
class Response
|
4
|
+
class CurrentLocation < Barometer::WeatherService::Response::Location
|
5
|
+
def initialize(payload, response)
|
6
|
+
super(payload)
|
7
|
+
@location = response.location
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
attr_reader :location
|
13
|
+
|
14
|
+
def name
|
15
|
+
payload.fetch('location')
|
16
|
+
end
|
17
|
+
|
18
|
+
def city
|
19
|
+
payload.using(/^(.*?),/).fetch('location')
|
20
|
+
end
|
21
|
+
|
22
|
+
def state_code
|
23
|
+
payload.using(/,(.*?)$/).fetch('location')
|
24
|
+
end
|
25
|
+
|
26
|
+
def country_code
|
27
|
+
'US'
|
28
|
+
end
|
29
|
+
|
30
|
+
def latitude
|
31
|
+
location.latitude
|
32
|
+
end
|
33
|
+
|
34
|
+
def longitude
|
35
|
+
location.longitude
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Barometer
|
2
|
+
class Noaa
|
3
|
+
class Response
|
4
|
+
class CurrentStation < Barometer::WeatherService::Response::Location
|
5
|
+
def initialize(payload, response)
|
6
|
+
super(payload)
|
7
|
+
@station = response.station
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
attr_reader :station
|
13
|
+
|
14
|
+
def id
|
15
|
+
payload.fetch('station_id')
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
payload.fetch('location')
|
20
|
+
end
|
21
|
+
|
22
|
+
def city
|
23
|
+
payload.using(/^(.*?),/).fetch('location')
|
24
|
+
end
|
25
|
+
|
26
|
+
def state_code
|
27
|
+
payload.using(/,(.*?)$/).fetch('location')
|
28
|
+
end
|
29
|
+
|
30
|
+
def country_code
|
31
|
+
'US'
|
32
|
+
end
|
33
|
+
|
34
|
+
def latitude
|
35
|
+
station.latitude
|
36
|
+
end
|
37
|
+
|
38
|
+
def longitude
|
39
|
+
station.longitude
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Barometer
|
2
|
+
class Noaa
|
3
|
+
class Response
|
4
|
+
class CurrentWeather
|
5
|
+
def initialize(payload)
|
6
|
+
@payload = payload
|
7
|
+
@current = Barometer::Response::Current.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse
|
11
|
+
current.observed_at = observed_at, '%a, %d %b %Y %H:%M:%S %z'
|
12
|
+
current.stale_at = stale_at
|
13
|
+
current.humidity = humidity
|
14
|
+
current.condition = condition
|
15
|
+
current.icon = icon
|
16
|
+
current.temperature = temperature
|
17
|
+
current.dew_point = dew_point
|
18
|
+
current.wind_chill = wind_chill
|
19
|
+
current.wind = wind
|
20
|
+
current.pressure = pressure
|
21
|
+
current.visibility = visibility
|
22
|
+
|
23
|
+
current
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :payload, :current
|
29
|
+
|
30
|
+
def units
|
31
|
+
payload.units
|
32
|
+
end
|
33
|
+
|
34
|
+
def observed_at
|
35
|
+
payload.fetch('observation_time_rfc822')
|
36
|
+
end
|
37
|
+
|
38
|
+
def stale_at
|
39
|
+
current.observed_at + (60 * 60 * 1) if current.observed_at
|
40
|
+
end
|
41
|
+
|
42
|
+
def humidity
|
43
|
+
payload.fetch('relative_humidity')
|
44
|
+
end
|
45
|
+
|
46
|
+
def condition
|
47
|
+
payload.fetch('weather')
|
48
|
+
end
|
49
|
+
|
50
|
+
def icon
|
51
|
+
payload.using(/(.*).(jpg|png)$/).fetch('icon_url_name')
|
52
|
+
end
|
53
|
+
|
54
|
+
def temperature
|
55
|
+
[units, payload.fetch('temp_c'), payload.fetch('temp_f')]
|
56
|
+
end
|
57
|
+
|
58
|
+
def dew_point
|
59
|
+
[units, payload.fetch('dewpoint_c'), payload.fetch('dewpoint_f')]
|
60
|
+
end
|
61
|
+
|
62
|
+
def wind_chill
|
63
|
+
[units, payload.fetch('windchill_c'), payload.fetch('windchill_f')]
|
64
|
+
end
|
65
|
+
|
66
|
+
def wind
|
67
|
+
[:imperial, payload.fetch('wind_mph').to_f, payload.fetch('wind_degrees').to_i]
|
68
|
+
end
|
69
|
+
|
70
|
+
def pressure
|
71
|
+
[units, payload.fetch('pressure_mb'), payload.fetch('pressure_in')]
|
72
|
+
end
|
73
|
+
|
74
|
+
def visibility
|
75
|
+
[:imperial, payload.fetch('visibility_mi').to_f]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Barometer
|
2
|
+
class Noaa
|
3
|
+
class Response
|
4
|
+
class ForecastedWeather
|
5
|
+
def initialize(payload)
|
6
|
+
@payload = payload
|
7
|
+
@predictions = Barometer::Response::PredictionCollection.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse
|
11
|
+
each_prediction do |prediction, index, shared_index|
|
12
|
+
prediction.starts_at = start_times[index]
|
13
|
+
prediction.ends_at = end_times[index]
|
14
|
+
prediction.icon = icons[shared_index]
|
15
|
+
prediction.condition = summaries[shared_index]
|
16
|
+
prediction.pop = precipitations[index]
|
17
|
+
prediction.high = [:imperial, high_temperatures[shared_index]]
|
18
|
+
prediction.low = [:imperial, low_temperatures[shared_index]]
|
19
|
+
end
|
20
|
+
|
21
|
+
predictions
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :payload, :predictions
|
27
|
+
|
28
|
+
def total_forecasts
|
29
|
+
high_temperatures.count * 2
|
30
|
+
end
|
31
|
+
|
32
|
+
def each_forecast
|
33
|
+
(0...total_forecasts).each do |index|
|
34
|
+
yield index, shared_index(index)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def each_prediction
|
39
|
+
each_forecast do |index, shared_index|
|
40
|
+
predictions.build do |prediction|
|
41
|
+
yield prediction, index, shared_index
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def shared_index(index)
|
47
|
+
(index / 2).floor
|
48
|
+
end
|
49
|
+
|
50
|
+
def times
|
51
|
+
@times ||= payload.fetch('time_layout').detect{|layout| layout['layout_key'] == 'k-p12h-n14-2'}
|
52
|
+
end
|
53
|
+
|
54
|
+
def start_times
|
55
|
+
@start_times ||= times['start_valid_time']
|
56
|
+
end
|
57
|
+
|
58
|
+
def end_times
|
59
|
+
@end_times ||= times['end_valid_time']
|
60
|
+
end
|
61
|
+
|
62
|
+
def temperatures
|
63
|
+
@temperatures ||= payload.fetch('parameters', 'temperature')
|
64
|
+
end
|
65
|
+
|
66
|
+
def high_temperatures
|
67
|
+
@high_temperatures ||= temperatures.detect{|t| t['@type'] == 'maximum'}.fetch('value', [])
|
68
|
+
end
|
69
|
+
|
70
|
+
def low_temperatures
|
71
|
+
@low_temperatures ||= temperatures.detect{|t| t['@type'] == 'minimum'}.fetch('value', [])
|
72
|
+
end
|
73
|
+
|
74
|
+
def precipitations
|
75
|
+
@precipitations ||= payload.fetch('parameters', 'probability_of_precipitation', 'value').map(&:to_i)
|
76
|
+
end
|
77
|
+
|
78
|
+
def summaries
|
79
|
+
@summaries ||= payload.fetch('parameters', 'weather', 'weather_conditions').map{|c| c['@weather_summary'] }
|
80
|
+
end
|
81
|
+
|
82
|
+
def icons
|
83
|
+
@icons ||= payload.fetch('parameters', 'conditions_icon', 'icon_link').map{|l| l.match(/(\w*)\.[a-zA-Z]{3}$/)[1] }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Barometer
|
2
|
+
class Noaa
|
3
|
+
class Response
|
4
|
+
class Location < Barometer::WeatherService::Response::Location
|
5
|
+
private
|
6
|
+
|
7
|
+
def latitude
|
8
|
+
payload.fetch('location', 'point', '@latitude')
|
9
|
+
end
|
10
|
+
|
11
|
+
def longitude
|
12
|
+
payload.fetch('location', 'point', '@longitude')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'barometer'
|
2
|
+
require_relative 'noaa/version'
|
3
|
+
require_relative 'noaa/forecast_api'
|
4
|
+
require_relative 'noaa/forecast_response'
|
5
|
+
require_relative 'noaa/current_api'
|
6
|
+
require_relative 'noaa/current_response'
|
7
|
+
|
8
|
+
module Barometer
|
9
|
+
class Noaa
|
10
|
+
def self.call(query, config={})
|
11
|
+
Noaa.new(query).measure!
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(query)
|
15
|
+
@query = query
|
16
|
+
end
|
17
|
+
|
18
|
+
def measure!
|
19
|
+
forecast_weather_api = ForecastApi.new(query)
|
20
|
+
response = ForecastResponse.new.parse(forecast_weather_api.get)
|
21
|
+
forecast_weather_api.query.add_conversion(:coordinates, response.location.coordinates)
|
22
|
+
|
23
|
+
current_weather_api = CurrentApi.new(forecast_weather_api.query)
|
24
|
+
CurrentResponse.new(response).parse(current_weather_api.get)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_reader :query
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Barometer::WeatherService.register(:noaa, Barometer::Noaa)
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"http://forecast.weather.gov/MapClick.php?textField1=34.10&textField2=-118.41","body":{"encoding":"UTF-8","string":""},"headers":{}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Cache-Control":["max-age=883"],"Transfer-Encoding":["chunked"],"Server":["Apache/2.2.15 (Red Hat)"],"Content-Type":["text/html; charset=UTF-8"],"Connection":["Transfer-Encoding","keep-alive"],"Date":["Sat, 09 Feb 2013 18:43:03 GMT"],"Expires":["Sat, 09 Feb 2013 18:57:46 GMT"]},"body":{"encoding":"UTF-8","string":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<link rel=\"schema.DC\" href=\"http://purl.org/dc/elements/1.1/\" /><title>NOAA National Weather Service</title><meta name=\"DC.title\" content=\"NOAA National Weather Service\" /><meta name=\"DC.description\" content=\"NOAA National Weather Service National Weather Service\" /><meta name=\"DC.creator\" content=\"US Department of Commerce, NOAA, National Weather Service\" /><meta name=\"DC.date.created\" scheme=\"ISO8601\" content=\"\" /><meta name=\"DC.language\" scheme=\"DCTERMS.RFC1766\" content=\"EN-US\" /><meta name=\"DC.keywords\" content=\"weather, National Weather Service\" /><meta name=\"DC.publisher\" content=\"NOAA's National Weather Service\" /><meta name=\"DC.contributor\" content=\"National Weather Service\" /><meta name=\"DC.rights\" content=\"http://www.weather.gov/disclaimer.php\" /><meta name=\"rating\" content=\"General\" /><meta name=\"robots\" content=\"index,follow\" />\r\n\r\n<link href=\"/css/weatherstyle.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n<link href=\"/css/template.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n<link href=\"/css/myfcst.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/ForecastSearch.css\" />\r\n<link href=\"/css/pointforecast.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n<script type=\"text/javascript\" src=\"/js/jquery-1.6.4.min.js\"></script>\r\n<script type=\"text/javascript\" src=\"/js/jquery.hoverIntent.minified.js\"></script>\r\n<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?v=3&client=gme-noaa&channel=NWS...PointClick&sensor=false\"></script>\r\n<script type=\"text/javascript\" src=\"/js/ForecastSearch.js\"></script>\r\n\r\n<script type=\"text/javascript\">\r\nfunction MM_jumpMenu(targ,selObj,restore)\r\n{ \r\n\t//v3.0\r\n\teval(targ+\".location='\"+selObj.options[selObj.selectedIndex].value+\"'\");\r\n\tif (restore) selObj.selectedIndex=0;\r\n}\r\n\r\n</script>\r\n<script type=\"text/javascript\" src=\"/js/topNavMenu.js\"></script>\r\n\r\n</head>\r\n\r\n<body>\r\n\r\n\t\t<div class=\"header\">\r\n\t\t\t<div class=\"header-content\">\r\n\t\t\t<a href=\"http://www.weather.gov\" class=\"header-nws\"><img src=\"/css/images/header.png\" /></a>\r\n\t\t\t<a href=\"http://www.commerce.gov\" class=\"header-doc\"><img src=\"/css/images/header_doc.png\" /></a>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\r\n\t\t<div class=\"header-shadow\">\r\n\t\t\t<div class=\"header-shadow-content\"></div>\r\n\t\t</div>\r\n\t\r\n\r\n<div class=\"center\">\r\n\r\n\t <div class=\"content\">\r\n <div class=\"topnav\">\r\n <ul id=\"topnav\">\r\n <li>\r\n <script type=\"text/javascript\">\r\n function goBack()\r\n {\r\n if (document.referrer.toLowerCase().indexOf(\"weather.gov\") != -1)\r\n {\r\n history.back();\r\n }\r\n else\r\n {\r\n document.location.href = \"http://www.weather.gov\";\r\n }\r\n }\r\n </script>\r\n <div class=\"topMenuNavList home\">\r\n <a href=\"#\" onclick=\"goBack();\">HOME</a>\r\n </div>\r\n </li>\r\n <li>\t\r\n <div class=\"topMenuNavList section-link\">\r\n \t<a href=\"http://www.weather.gov/forecastmaps\">FORECAST</a> </div>\r\n <div style=\"opacity: 0;\" class=\"sub\">\r\n <ul> <li> <a href=\"/\">Local</a> </li> <li> <a href=\"http://graphical.weather.gov\">Graphical</a> </li> <li> <a href=\"http://www.aviationweather.gov/\">Aviation</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/marine/home.htm\">Marine</a> </li> <li> <a href=\"http://water.weather.gov/ahps/\">Rivers and Lakes</a> </li> <li> <a href=\"http://www.nhc.noaa.gov/\">Hurricanes</a> </li> <li> <a href=\"http://www.spc.noaa.gov/\">Severe Weather</a> </li> <li> <a href=\"http://www.srh.noaa.gov/ridge2/fire/\">Fire Weather</a> </li> <li> <a href=\"http://aa.usno.navy.mil/data/docs/RS_OneDay.php\">Sun/Moon</a> </li> <li> <a href=\"http://www.nws.noaa.gov/climate/\">Long Range Forecasts</a> </li> <li> <a href=\"http://www.cpc.ncep.noaa.gov\">Climate Prediction</a> </li></ul> </div>\r\n </li>\r\n <li>\t\r\n <div class=\"topMenuNavList section-link\">\r\n \t<a href=\"http://www.nws.noaa.gov/climate\">PAST WEATHER</a> </div>\r\n <div style=\"opacity: 0;\" class=\"sub\">\r\n <ul> <li> <a href=\"http://www.nws.noaa.gov/climate/\">Past Weather</a> </li> <li> <a href=\"http://www.nws.noaa.gov/climate/\">Heating/Cooling Days</a> </li> <li> <a href=\"http://www.nws.noaa.gov/climate/\">Monthly Temperatures</a> </li> <li> <a href=\"http://www.nws.noaa.gov/climate/\">Records</a> </li> <li> <a href=\"http://aa.usno.navy.mil/\">Astronomical Data</a> </li></ul> </div>\r\n </li>\r\n <li>\t\r\n <div class=\"topMenuNavList section-link\">\r\n \t<a href=\"http://www.weather.gov/safety\">WEATHER SAFETY</a> </div>\r\n <div style=\"opacity: 0;\" class=\"sub\">\r\n <ul> <li> <a href=\"http://www.nws.noaa.gov/com/weatherreadynation\">Weather-Ready Nation</a> </li> <li> <a href=\"http://www.nws.noaa.gov/nwr/\">NOAA Weather Radio</a> </li> <li> <a href=\"http://www.nws.noaa.gov/stormready/\">StormReady</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/heat/index.shtml\">Heat</a> </li> <li> <a href=\"http://www.lightningsafety.noaa.gov/\">Lightning</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/hurricane/index.shtml\">Hurricanes</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/severeweather/index.shtml\">Thunderstorms, Tornadoes, Floods</a> </li> <li> <a href=\"http://www.ripcurrents.noaa.gov/\">Rip Currents</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/winter/index.shtml\">Winter Weather</a> </li> <li> <a href=\"http://www.nws.noaa.gov/os/uv/\">Ultra Violet Radiation</a> </li> <li> <a href=\"http://www.nws.noaa.gov/airquality/\">Air Quality</a> </li> <li> <a href=\"http://www.nws.noaa.gov/os/water/tadd/\">Turn Around, Don't Drown</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/hazstats.shtml\">Damage/Fatality/Injury Statistics</a> </li> <li> <a href=\"http://www.redcross.org/\">Red Cross</a> </li> <li> <a href=\"http://www.fema.gov\">Federal Emergency Management Agency (FEMA)</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/brochures.shtml\">Brochures</a> </li></ul> </div>\r\n </li>\r\n <li>\t\r\n <div class=\"topMenuNavList section-link\">\r\n \t<a href=\"http://www.weather.gov/informationcenter\">INFORMATION CENTER</a> </div>\r\n <div style=\"opacity: 0;\" class=\"sub\">\r\n <ul> <li> <a href=\"http://www.noaawatch.gov/briefing.php\">Daily Briefing </a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/marine/home.htm\">Marine</a> </li> <li> <a href=\"http://www.nws.noaa.gov/climate/\">Climate </a> </li> <li> <a href=\"http://www.spaceweather.gov\">Space Weather</a> </li> <li> <a href=\"http://radar.srh.noaa.gov/fire/\">Fire Weather</a> </li> <li> <a href=\"http://www.aviationweather.gov/\">Aviation</a> </li> <li> <a href=\"http://www.tsunami.gov\">Tsunami</a> </li> <li> <a href=\"http://mag.ncep.noaa.gov/NCOMAGWEB/appcontroller\">Forecast Models</a> </li> <li> <a href=\"http://water.weather.gov/ahps/\">Water</a> </li> <li> <a href=\"http://www.nws.noaa.gov/gis\">GIS</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/coop/\">Cooperative Observers</a> </li> <li> <a href=\"http://www.nws.noaa.gov/skywarn/\">Storm Spotters</a> </li> <li> <a href=\"http://wiki.citizen.apps.gov/nws_developers/index.php/Main_Page\">For Developers</a> </li> <li> <a href=\"http://economics.noaa.gov\">Facts and Figures</a> </li></ul> </div>\r\n </li>\r\n <li>\t\r\n <div class=\"topMenuNavList section-link\">\r\n \t<a href=\"http://www.weather.gov/news\">NEWS</a> </div>\r\n <div style=\"opacity: 0;\" class=\"sub\">\r\n <ul> <li> <a href=\"/news\">NWS News</a> </li> <li> <a href=\"http://www.nws.noaa.gov/com/weatherreadynation/calendar.html\">Events</a> </li> <li> <a href=\"http://www.weather.gov/socialmedia\">Social Media</a> </li> <li> <a href=\"http://www.nws.noaa.gov/om/brochures.shtml\">Pubs/Brochures/Booklets </a> </li> <li> <a href=\"http://www.nws.noaa.gov/pa/nws_contacts.php\">NWS Media Contacts</a> </li></ul> </div>\r\n </li>\r\n <li>\t\r\n <div class=\"topMenuNavList section-link\">\r\n \t<a href=\"http://www.weather.gov/search\">SEARCH</a> </div>\r\n <div style=\"opacity: 0;\" class=\"sub\">\r\n <ul class=\"no-links\">\r\n <li><!-- Begin search code -->\r\n <div id=\"site-search\">\r\n <form method=\"get\" action=\"http://search.usa.gov/search\" style=\"margin-bottom: 0; margin-top: 0;\">\r\n <input type=\"hidden\" name=\"v:project\" value=\"firstgov\" /> \r\n <label for=\"query\">Search For</label> \r\n <input type=\"text\" name=\"query\" id=\"query\" size=\"12\" /> \r\n <input type=\"submit\" value=\"Go\" />\r\n <p>\r\n <input type=\"radio\" name=\"affiliate\" checked=\"checked\" value=\"nws.noaa.gov\" id=\"nws\" /> \r\n <label for=\"nws\" class=\"search-scope\">NWS</label> \r\n <input type=\"radio\" name=\"affiliate\" value=\"noaa.gov\" id=\"noaa\" /> \r\n <label for=\"noaa\" class=\"search-scope\">All NOAA</label>\r\n </p>\r\n </form>\r\n </div>\r\n </li>\r\n </ul> </div>\r\n </li>\r\n <li class=\"last\">\t\r\n <div class=\"topMenuNavList section-link\">\r\n \t<a href=\"http://www.weather.gov/about\">ABOUT</a> </div>\r\n <div style=\"opacity: 0;\" class=\"sub\">\r\n <ul> <li> <a href=\"http://www.weather.gov/about\">About NWS</a> </li> <li> <a href=\"http://www.weather.gov/organization\">Organization</a> </li> <li> <a href=\"http://www.nws.noaa.gov/sp\">Strategic Plan</a> </li> <li> <a href=\"https://sites.google.com/a/noaa.gov/nws-best-practices/\">For NWS Employees</a> </li> <li> <a href=\"http://www.nws.noaa.gov/ia/home.htm\">International</a> </li> <li> <a href=\"http://www.weather.gov/organization\">National Centers</a> </li> <li> <a href=\"http://www.nws.noaa.gov/tg\">Products and Services</a> </li> <li> <a href=\"http://www.weather.gov/contact\">Contact Us</a> </li> <li> <a href=\"http://www.nws.noaa.gov/glossary\">Glossary</a> </li></ul> </div>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n\r\n \r\n\t\r\n\t<div class=\"center-content\">\r\n\t\t\r\n\t\t\t\t<div class=\"one-sixth-first\">\r\n\t\t\t<div id=\"forecast-lookup\">\r\n\t\t\t\t<form name=\"getForecast\" id=\"getForecast\" action=\"http://forecast.weather.gov/zipcity.php\" method=\"get\">\r\n <label for=\"inputstring\">Local forecast by <br>\"City, St\" or ZIP code</label>\r\n <input id=\"inputstring\" name=\"inputstring\" type=\"text\" value=\"Enter location ...\" onclick=\"this.value=''\" />\r\n <input name=\"btnSearch\" id=\"btnSearch\" type=\"submit\" value=\"Go\" />\r\n <div id=\"txtError\">\r\n <div id=\"errorNoResults\" style=\"display:none;\">Sorry, the location you searched for was not found. Please try another search.</div>\r\n <div id=\"errorMultipleResults\" style=\"display:none\">Multiple locations were found. Please select one of the following:</div>\r\n <div id=\"errorChoices\" style=\"display:none\"></div>\r\n <input id=\"btnCloseError\" type=\"button\" value=\"Close\" style=\"display:none\" />\r\n </div>\r\n <div id=\"txtHelp\"><a style=\"text-decoration: underline;\" href=\"javascript:void(window.open('http://weather.gov/ForecastSearchHelp.html','locsearchhelp','status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,height=500,width=530').focus());\">Location Help</a></div>\r\n </form>\r\n\r\n\t\t\t</div><!-- <div id=\"forecast-lookup\"> -->\r\n\t\t</div><!-- <div class=\"one-sixth-first\"> -->\r\n\t\r\n\t\t<div class=\"five-sixth-last\"><div id=\"topnews\"><h1 style='font-size:11pt;'>Major Winter Storm Continues to Impact Northeast</h1><p>The major winter storm that has brought more than two feet of snow strong winds across parts of the Northeast and New England continues to impact the region Saturday morning. Heavy snow, along with strong wind gusts, are expected to continue across much of New England early Saturday morning, before beginning to slowly taper off from west to east later in the morning and into the afternoon. <br /><a href='http://1.usa.gov/11qoD8L' target='_blank'>Read More...</a></p></div></div>\r\n\t\t\r\n \t<script language=javascript>document.title =' 7-Day Forecast for Latitude 34.1\\u00B0N and Longitude 118.42\\u00B0W (Elev. 774 ft)';</script><script type=\"text/javascript\" src=\"JavaScript/google_map.js\"></script><script type=\"text/javascript\"> var smap=1; var gmsite = 'lox'; var gmscale =10; var gmsi=0; var gmlng=''; var gmtype = 'text';</script><div class=\"one-fourth-last\"></div><div class=\"div-full locationHeader\">\n\t<div class=\"five-sixth-first point-forecast-area-title\">4 Miles W Hollywood CA</div>\n\t<div class=\"one-sixth-last locationheader-options\"><a href=\"http://forecast.weather.gov/MapClick.php?lat=34.10&lon=-118.41&FcstType=textr&unit=0&lg=sp\"><b>En Español</b></a></div>\n</div>\n<div class=\"full-width-borderbottom current-conditions\">\n\t<div class=\"one-third-first\">\n\t\t<div class=\"div-half\">\n\t\t\t<p class=\"feature\"><img src=\"/images/wtf/large/sct.png\" alt=\"\" width=\"134\" height=\"134\" /></p>\n\t\t</div>\n\t\t<div class=\"div-half-right\">\n\t\t\t<p class=\"myforecast-current\">Fair</p>\n\t\t\t<p class=\"myforecast-current-lrg\">52°F</p>\n\t\t\t<p><span class=\"myforecast-current-sm\">11°C</span></p>\n\t\t</div>\n\t</div>\n\t<div class=\"one-third-first\">\n\t\t<ul class=\"current-conditions-detail\">\n\t\t\t<li><span class=\"label\">Humidity</span>59%</li>\n\t\t\t<li><span class=\"label\">Wind Speed</span>E 5 MPH</li>\n\t\t\t<li><span class=\"label\">Barometer</span>30.05 in (1017.7 mb)</li>\n\t\t\t<li><span class=\"label\">Dewpoint</span>38°F (3°C)</li>\n\t\t\t<li><span class=\"label\">Visibility</span>10.00 mi</li>\n\t\t</ul>\n<p class=\"current-conditions-timestamp\">Last Update on 09 Feb 9:51 am PST </p><br>\t</div>\n\t<div class=\"one-third-last\">\n\t\t<p style=\"font-size: 8pt;\">Current conditions at</p>\n\t\t<p class=\"current-conditions-location\">Santa Monica, Santa Monica Municipal Airport (KSMO)</p>\n\t\t<p> Lat: 34.01583 Lon: -118.45139 Elev: 174ft.<br /></p>\n\t\t<div class=\"current-conditions-extra\">\n\t\t\t<p><a href=\"http://www.wrh.noaa.gov/total_forecast/other_obs.php?wfo=lox&zone=CAZ041\">More Local Wx</a> | <a href=\"http://www.wrh.noaa.gov/mesowest/getobext.php?wfo=lox&sid=KSMO&num=72&raw=0\">3 Day History</a> | <a href=http://mobile.weather.gov/index.php?lat=34.01583&lon=-118.45139>Mobile Weather</a></p>\n\t\t</div>\n<!-- AddThis Button BEGIN -->\n\t\t<div class=\"addthis_toolbox addthis_default_style \">\n\t\t\t<a href=\"http://www.addthis.com/bookmark.php?v=250&pubid=xa-4b05b2d91f18c9cc\" class=\"addthis_button_compact\">Share</a>\n\t\t\t<span class=\"addthis_separator\">|</span>\n\t\t\t<a class=\"addthis_button_preferred_1\"></a>\n\t\t\t<a class=\"addthis_button_preferred_2\"></a>\n\t\t\t<a class=\"addthis_button_preferred_3\"></a>\n\t\t\t<a class=\"addthis_button_preferred_4\"></a>\n\t\t\t<a class=\"addthis_button_preferred_5\"></a>\n\t\t</div>\n\t\t<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4b05b2d91f18c9cc\"></script>\n<!-- AddThis Button END -->\n\t</div>\n</div>\n<div class=\"partial-width-borderbottom point-forecast-icons\">\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Today<br><br></p>\n <p><img src=\"/images/wtf/medium/few.png\" width=\"86\" height=\"86\" alt=\"Sunny\" title=\"Sunny\" /></p>\n <p>Sunny<br><br></p>\n <p class=\"point-forecast-icons-high\">High: 55 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Tonight<br><br></p>\n <p><img src=\"/images/wtf/medium/nfew.png\" width=\"86\" height=\"86\" alt=\"Mostly Clear\" title=\"Mostly Clear\" /></p>\n <p>Mostly<br>Clear<br></p>\n <p class=\"point-forecast-icons-low\">Low: 42 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Sunday<br><br></p>\n <p><img src=\"/images/wtf/medium/few.png\" width=\"86\" height=\"86\" alt=\"Sunny\" title=\"Sunny\" /></p>\n <p>Sunny<br><br></p>\n <p class=\"point-forecast-icons-high\">High: 58 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Sunday<br>Night</p>\n <p><img src=\"/images/wtf/medium/nfew.png\" width=\"86\" height=\"86\" alt=\"Mostly Clear\" title=\"Mostly Clear\" /></p>\n <p>Mostly<br>Clear<br></p>\n <p class=\"point-forecast-icons-low\">Low: 44 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Monday<br><br></p>\n <p><img src=\"/images/wtf/medium/few.png\" width=\"86\" height=\"86\" alt=\"Sunny\" title=\"Sunny\" /></p>\n <p>Sunny<br><br></p>\n <p class=\"point-forecast-icons-high\">High: 60 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Monday<br>Night</p>\n <p><img src=\"/images/wtf/medium/nfew.png\" width=\"86\" height=\"86\" alt=\"Mostly Clear\" title=\"Mostly Clear\" /></p>\n <p>Mostly<br>Clear<br></p>\n <p class=\"point-forecast-icons-low\">Low: 45 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Tuesday<br><br></p>\n <p><img src=\"/images/wtf/medium/few.png\" width=\"86\" height=\"86\" alt=\"Sunny\" title=\"Sunny\" /></p>\n <p>Sunny<br><br></p>\n <p class=\"point-forecast-icons-high\">High: 64 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Tuesday<br>Night</p>\n <p><img src=\"/images/wtf/medium/nfew.png\" width=\"86\" height=\"86\" alt=\"Mostly Clear\" title=\"Mostly Clear\" /></p>\n <p>Mostly<br>Clear<br></p>\n <p class=\"point-forecast-icons-low\">Low: 46 °F</p>\n </div>\n <div class=\"one-ninth-first\">\n <p class=\"txt-ctr-caps\">Wednesday<br><br></p>\n <p><img src=\"/images/wtf/medium/few.png\" width=\"86\" height=\"86\" alt=\"Sunny\" title=\"Sunny\" /></p>\n <p>Sunny<br><br></p>\n <p class=\"point-forecast-icons-high\">High: 66 °F</p>\n </div>\n</div>\n<div class=\"partial-width-borderbottom\">\n\t<div class=\"two-third-first point-forecast-7-day\">\n<div class=\"hazardous-conditions\">\n<h1>Hazardous Weather Conditions</h1>\n<ul><li><a href=\"showsigwx.php?warnzone=CAZ041&warncounty=CAC037&firewxzone=CAZ241&local_place1=&product1=Hazardous+Weather+Outlook\">Hazardous Weather Outlook</a></li>\n</ul>\n</div>\n\t\t<h1>7-DAY FORECAST</h1>\n <ul class=\"point-forecast-7-day\">\n <li class=\"row-odd\"><span class=\"label\">Today</span> Sunny, with a high near 55. South wind around 5 mph. </li>\n <li class=\"row-even\"><span class=\"label\">Tonight</span> Mostly clear, with a low around 42. South wind around 5 mph becoming east after midnight. </li>\n <li class=\"row-odd\"><span class=\"label\">Sunday</span> Sunny, with a high near 58. Calm wind becoming south around 5 mph in the morning. </li>\n <li class=\"row-even\"><span class=\"label\">Sunday Night</span> Mostly clear, with a low around 44. South wind around 5 mph becoming north in the evening. </li>\n <li class=\"row-odd\"><span class=\"label\">Monday</span> Sunny, with a high near 60. North northeast wind around 5 mph becoming calm in the morning. </li>\n <li class=\"row-even\"><span class=\"label\">Monday Night</span> Mostly clear, with a low around 45.</li>\n <li class=\"row-odd\"><span class=\"label\">Tuesday</span> Sunny, with a high near 64.</li>\n <li class=\"row-even\"><span class=\"label\">Tuesday Night</span> Mostly clear, with a low around 46.</li>\n <li class=\"row-odd\"><span class=\"label\">Wednesday</span> Sunny, with a high near 66.</li>\n <li class=\"row-even\"><span class=\"label\">Wednesday Night</span> Mostly clear, with a low around 48.</li>\n <li class=\"row-odd\"><span class=\"label\">Thursday</span> Sunny, with a high near 70.</li>\n <li class=\"row-even\"><span class=\"label\">Thursday Night</span> Mostly clear, with a low around 49.</li>\n <li class=\"row-odd\"><span class=\"label\">Friday</span> Sunny, with a high near 73.</li>\n </ul>\n\t\t<p> </p>\n\t\t<h1>ADDITIONAL FORECASTS AND INFORMATION</h1>\n\t\t<p class=\"myforecast-location\"><a href=\"MapClick.php?zoneid=CAZ041\">Zone Area Forecast for Los Angeles County Coast including Downtown Los Angeles, CA</a></p>\n\t\t<div class=\"div-full\">\n\t\t\t<p> </p>\n\t\t\t<div class=\"div-third\"><a href=\"http://forecast.weather.gov/product.php?site=NWS&issuedby=LOX&product=AFD&format=CI&version=1&glossary=1\">Forecast Discussion</a><br />\n\t\t\t\t<a href=\"MapClick.php?lat=34.10000&lon=-118.41&unit=0&lg=english&FcstType=text&TextType=2\">Printable Forecast</a><br />\n\t\t\t\t<a href=\"MapClick.php?lat=34.10000&lon=-118.41&unit=0&lg=english&FcstType=text&TextType=1\">Text Only Forecast</a></div>\n\t\t\t<div class=\"div-third\"><a href=\"MapClick.php?lat=34.10000&lon=-118.41&unit=0&lg=english&FcstType=graphical\">Hourly Weather Graph</a><br />\n\t\t\t\t<a href=\"MapClick.php?lat=34.10000&lon=-118.41&unit=0&lg=english&FcstType=digital\">Tabular Forecast</a><br />\n\t\t\t\t<a href=\"afm/PointClick.php?lat=34.10000&lon=-118.41000\">Quick Forecast</a></div>\n\t\t\t<div class=\"div-third\"><a href=\"http://weather.gov/aq/probe_aq_data.php?latitude=34.10000&longitude=-118.41000\">Air Quality Forecasts</a><br/><a href=\"http://forecast.weather.gov/MapClick.php?lat=34.10&lon=-118.41&FcstType=text&unit=1&lg=en\">International System of Units</a><br />\n\t\t\t\t<a href=\"http://www.srh.weather.gov/srh/jetstream/webweather/pinpoint_max.htm\">About Point Forecasts</a><br />\n\t\t\t<a href=\"http://www.wrh.noaa.gov/forecast/wxtables/index.php?lat=34.10000&lon=-118.41000\">Forecast Weather Table Interface</a>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"div-full\">\n\t\t\t<div class=\"div-third\"><br>\n\t\t\t<a href=\"http://www.wrh.noaa.gov/mesowest/mwmap.php?map=lox\" target=\"_self\">Observation Map (Regional)</a><br />\n\t\t\t<a href=\"http://www.wrh.noaa.gov/mesowest/mwmap.php?map=la\" target=\"_self\">Observation Map (Los Angeles)</a><br />\n\t\t\t</div>\n\t\t\t<div class=\"div-third\"><br>\n\t\t\t<a href=\"http://www.wrh.noaa.gov/warnings.php?wfo=lox\" target=\"_self\">Warnings</a><br />\n\t\t\t<a href=\"http://www.wrh.noaa.gov/forecasts/graphical/sectors/lox.php\" target=\"_self\">Experimental Graphical Forecasts</a><br />\n\t\t\t</div>\n\t\t\t<div class=\"div-third\"><br>\n\t\t\t<a href=\"http://www.wrh.noaa.gov/lox/getprod.php?pil=qps&sid=lox&format=pre\" target=\"_self\">Quantitative Precipitation Forecast</a><br />\n\t\t\t<a href=\"http://www.weather.gov/climate/index.php?wfo=lox\" target=\"_self\">Climatology</a><br />\n\t\t\t</div>\n\t\t\t<p> </p>\n\t\t</div>\n\t</div>\n\t<div class=\"one-third-last point-forecast-right\">\n\t\t<div id=\"point-forecast-info\">\n\t\t\t<h2 class=\"wfo-label\"><a href=http://www.wrh.noaa.gov/lox>NWS Los Angeles/Oxnard, CA</a></h2>\n\t\t\t<ul class=\"point-forecast-info\">\n\t\t\t\t<li><span class=\"label\">Point Forecast:</span> 4 Miles W Hollywood CA<br>34.1°N 118.42°W (Elev. 774 ft)</li>\n\t\t\t\t<li><span class=\"label\"><a href=\"http://www.weather.gov/glossary/index.php?word=Last+update\">Last Update</a>:</span> 10:21 am PST Feb 9, 2013</li>\n\t\t\t\t<li><span class=\"label\"><a href=\"http://www.weather.gov/glossary/index.php?word=forecast+valid+for\">Forecast Valid</a>:</span> 11am PST Feb 9, 2013-6pm PST Feb 15, 2013<p><a href=\"http://forecast.weather.gov/product.php?site=NWS&issuedby=LOX&product=AFD&format=CI&version=1&glossary=1\">Forecast Discussion</a></p>\n\t\t\t\t<p class=\"forecast-downloads\"><a href=\"MapClick.php?lat=34.10000&lon=-118.41&unit=0&lg=english&FcstType=kml\"><img src=\"/images/wtf/kml_badge.png\" width=\"45\" height=\"17\" alt=\"Get as KML\" /></a> <a href=\"MapClick.php?lat=34.10000&lon=-118.41&unit=0&lg=english&FcstType=dwml\"><img src=\"/images/wtf/xml_badge.png\" width=\"45\" height=\"17\" alt=\"Get as XML\" /></a></p>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</div>\n<div class='point-forecast-map'><div class='point-forecast-map-header'>Click Map for Forecast<div class='disclaimer'><a href='http://www.weather.gov/credits.php#googlemapping'>Disclaimer</a></div></div><form name=\"littleform\" method=\"post\" action=\"#\"><div id=\"gmap\"><noscript><center><br><br><b>Map function requires Javascript and a compatible browser.</b></center></noscript></div><div class=\"point-forecast-map-footer\"><img src=\"/images/wtf/maplegend.gif\" width=\"240\" height=\"16\" alt=\"Map Legend\"><p><strong>Lat/Lon:</strong> 34.1°N 118.42°W <strong>Elevation:</strong> 774 ft</p></div></form></div>\t\t<div id=\"radar\">\n\t\t\t<h2>RADAR & SATELLITE IMAGES</h2>\n\t\t\t<div class=\"div-full\"><a href=\"http://radar.weather.gov/radar.php?rid=vtx&product=N0R&overlay=11101111&loop=no\"><img src=\"http://radar.weather.gov/Thumbs/VTX_Thumb.gif\" class=\"radar-thumb\" alt=\"Link to Local Radar Data\" title=\"Link to Local Radar Data\"></a> <a href=\"http://www.wrh.noaa.gov/satellite/?wfo=lox\"><img src=\"http://sat.wrh.noaa.gov/satellite/4km/WR/IR4.thumbnail.jpg\" class=\"satellite-thumb\" alt=\"Link to Satellite Data\" title=\"Link to Satellite Data\"></a></div>\n\t\t</div>\n\t\t<div id=\"hourly\">\n\t\t\t<h2>HOURLY WEATHER GRAPH </h2>\n\t\t\t<p class=\"feature\"><a href=\"MapClick.php?lat=34.10000&lon=-118.41&unit=0&lg=english&FcstType=graphical\"><img src=\"/images/wtf/medium/hourlyweather.png\" width=\"300\" height=\"158\" /></a></p>\n\t\t</div>\n\t\t<div id=\"ndfd\">\n\t\t\t<h2>NATIONAL DIGITAL FORECAST DATABASE</h2>\n\t\t\t<p><a href=\"http://www.weather.gov/forecasts/graphical/sectors/pacsouthwest.php?element=MaxT\"><img src=\"http://www.weather.gov/forecasts/graphical/images/thumbnail/latest_MaxMinT_pacsouthwest_thumbnail.png\" border=\"0\" alt=\"National Digital Forecast Database Maximum Temperature Forecast\" title=\"National Digital Forecast Database Maximum Temperature Forecast\" width=\"147\" height=\"150\"></a> <a href=\"http://www.weather.gov/forecasts/graphical/sectors/pacsouthwest.php?element=Wx\"><img src=\"http://www.weather.gov/forecasts/graphical/images/thumbnail/latest_Wx_pacsouthwest_thumbnail.png\" border=\"0\" alt=\"National Digital Forecast Database Weather Element Forecast\" title=\"National Digital Forecast Database Weather Element Forecast\" width=\"147\" height=\"150\"></a></p>\n\t\t</div>\n\t</div>\n</div>\n<script language='javascript'>window.load = load_google_map(34.10000, -118.41000, 34.084, -118.432, 34.106, -118.437, 34.11, -118.41, 34.088, -118.405, 11);</script>\r\n\r\n\t\t<!-- <div class=\"full-width-first\">\r\n\t\t\t\t\t <div class=\"full-width-first communication-links\">\r\n \t<div class =\"one-third-first nopad\">\r\n \t<div class=\"myforecast-current\" style=\"float:left;padding:0px 20px 0px 0px;\">\r\n \t<a style=\"text-decoration:none;\" href=\"http://twitter.com/usNWSgov\" target=\"_blank\">\r\n \t\t<img src=\"/css/images/twitter.png\" width=\"16\" height=\"16\" /> Follow us on Twitter\r\n \t</a>\r\n \t</div>\r\n \t<div class=\"myforecast-current\" style=\"float:left;padding:0px 20px 0px 0px;\">\r\n \t<a style=\"text-decoration:none;\" href=\"http://www.facebook.com/US.National.Weather.Service.gov\" target=\"_blank\">\r\n \t\t<img src=\"/css/images/fb.png\" width=\"16\" height=\"16\" /> Follow us on Facebook\r\n \t</a>\r\n </div>\r\n \t </div>\r\n <div class =\"one-half-last nopad\">\r\n \t<span class=\"txt-rt myforecast-current\">\r\n \t<div class=\"myforecast-current\" style=\"float:left;padding:0px 20px 0px 0px;\">\r\n \t\t<a href=\"/rss_page.php?site_name=nws\" target=\"_blank\" style=\"text-decoration:none;font-size:11px;\">\r\n\t\t\t\t\t\t\t<img src=\"/css/images/rss.png\" width=\"16\" height=\"16\" /> NWS RSS Feed\r\n\t\t\t\t\t\t</a>\r\n \t</div>\r\n \t<a href=\"http://www.weather.gov/cgi-bin/nwsexit.pl?url=https://service.govdelivery.com/service/multi_subscribe.html%3Fcode=USNWS\" class=\"icon\">\r\n \t\t\t\t<img src=\"/css/images/email.png\" title=\"Sign Up For Email Notifications\" alt=\"Sign Up For Email Notifications\" width=\"16\" height=\"16\" />\r\n \t\t\t</a> \r\n\t\t\t\t\r\n\t\t\t\t\t<form action=\"https://public.govdelivery.com/accounts/USNWS/subscribers/qualify\" class=\"govdelivery\" method=\"get\"> \r\n \t\t\t<label for=\"email\" style=\"display:none;\">Sign up for Email Notifications</label>\r\n \t\t\t<input id=\"email\" name=\"email\" type=\"text\" value=\"Sign Up for Email Notifications\" onFocus=\"this.value='';\"/>\r\n \t\t\t<input class=\"form_button\" name=\"commit\" type=\"submit\" value=\"Subscribe\" /> \r\n\t\t\t\t\t</form>\r\n \t</span>\r\n </div>\r\n </div>\r\n \t\t<div style=\"clear:both;\"></div>\r\n\t\r\n\t\t</div>\r\n\t\t-->\r\n\t\t\r\n\t\t<div style=\"clear:both;\"></div>\r\n\t\t\r\n\t</div><!-- <div class=\"center-content\"> -->\r\n\r\n</div><!-- end of <div class=\"center\"> -->\r\n\r\n<!-- sitemap area -->\r\n<div class=\"footer\">\r\n\t\t\t<style type=\"text/css\">\r\n\t\t.footer-column-head a:link, .footer-column-head a:visited {\r\n\t\tcolor: #ED7A08;\t\t\r\n\t\t}\r\n\t\t</style>\r\n\t\t<div class=\"footer-content\">\r\n\t\t\t\t\t\t\t<div class=\"footer-column\" style=\"padding:10px 10px;\">\r\n \t\t\t\t\t<p>\r\n\t\t\t\t\t<span class=\"footer-column-head\">\r\n\t\t\t\t\t\t<a href=\"http://alerts.weather.gov\">ACTIVE ALERTS</a>\r\n\t\t\t\t\t</span><br />\r\n\t\t\t\t\t \t\t\t\t<a href=\" http://alerts.weather.gov\">Warnings By State</a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.hpc.ncep.noaa.gov/ww.shtml\">Excessive Rainfall and Winter Weather Forecasts</a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://water.weather.gov/ahps/?current_color=flood¤t_type=all&fcst_type=obs&conus_map=d_map\">River Flooding </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov\">Latest Warnings</a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.spc.noaa.gov/products/outlook/\">Thunderstorm/Tornado Outlook </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nhc.noaa.gov/\">Hurricanes </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.spc.noaa.gov/products/fire_wx/\">Fire Weather Outlooks </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.cpc.ncep.noaa.gov/products/stratosphere/uv_index/uv_alert.shtml\">UV Alerts </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.drought.gov/\">Drought </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.swpc.noaa.gov/alerts/index.html\">Space Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/nwr/\">NOAA Weather Radio </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://alerts.weather.gov/\">NWS CAP Feeds </a><br />\r\n \t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t\t\t<p> </p>\r\n\t\t\t\t\t<p class=\"footer-column-head\">\r\n \t\t\t\t\t<a href=\" http://www.nws.noaa.gov/climate/\">PAST WEATHER</a>\r\n \t\t\t\t</p>\r\n \t\t\t\t<p>\r\n \t\t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/climate/\">Past Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.cpc.ncep.noaa.gov/products/MD_index.shtml\">Climate Monitoring </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/climate/\">Heating/Cooling Days </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/climate/\">Monthly Temps </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/climate/\">Records </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://aa.usno.navy.mil/\">Astronomical Data </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.ncdc.noaa.gov/oa/mpp/\">Certified Weather Data </a><br />\r\n \t\t\t \t\t\t\t</p>\r\n \t\t\t\t \t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div class=\"footer-column\" style=\"padding:10px 10px;\">\r\n \t\t\t\t\t<p>\r\n\t\t\t\t\t<span class=\"footer-column-head\">\r\n\t\t\t\t\t\t<a href=\"http://www.weather.gov/current\">CURRENT CONDITIONS</a>\r\n\t\t\t\t\t</span><br />\r\n\t\t\t\t\t \t\t\t\t<a href=\" http://www.weather.gov/Radar\">Radar </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.cpc.ncep.noaa.gov/products/monitoring_and_data/\">Climate Monitoring </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://water.weather.gov/ahps/\">River Levels </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://water.weather.gov/precip/\">Observed Precipitation </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.nws.noaa.gov/om/osd/portal.shtml\">Surface Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://weather.noaa.gov/fax/barotrop.shtml\">Upper Air </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.ndbc.noaa.gov/\">Marine and Buoy Reports </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nohrsc.nws.gov/interactive/html/map.html\">Snow Cover </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.goes.noaa.gov\">Satellite </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.swpc.noaa.gov/\">Space Weather </a><br />\r\n \t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t\t\t<p> </p>\r\n\t\t\t\t\t<p class=\"footer-column-head\">\r\n \t\t\t\t\t<a href=\"http://weather.gov/forecastmaps\">FORECAST</a>\r\n \t\t\t\t</p>\r\n \t\t\t\t<p>\r\n \t\t\t\t \t\t\t\t<a href=\" http://www.weather.gov/\">Local Forecast </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.spc.noaa.gov/\">Severe Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.hpc.ncep.noaa.gov/\">Current Outlook Maps </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.cpc.ncep.noaa.gov/products/Drought\">Drought </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://radar.srh.noaa.gov/fire/\">Fire Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.hpc.ncep.noaa.gov/\">Fronts/Precipitation Maps </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/forecasts/graphical/\">Current Graphical Forecast Maps </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://water.weather.gov/ahps/forecasts.php\">Rivers </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/om/marine/home.htm\">Marine </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.opc.ncep.noaa.gov/marine_areas.php\">Offshore and High Seas</a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nhc.noaa.gov/\">Hurricanes </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://aviationweather.gov\">Aviation Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.cpc.ncep.noaa.gov/products/OUTLOOKS_index.html\">Climatic Outlook </a><br />\r\n \t\t\t \t\t\t\t</p>\r\n \t\t\t\t \t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div class=\"footer-column\" style=\"padding:10px 10px;\">\r\n\t\t\t\t\t<span class=\"footer-column-head\">\r\n\t\t\t\t\t\t<a href=\"http://www.weather.gov/informationcenter\">INFORMATION CENTER</a>\r\n\t\t\t\t\t</span><br />\r\n\t\t\t\t\t \t\t\t\t<a href=\" http://www.spaceweather.gov\">Space Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.tsunami.gov\">Tsunami</a><br />\r\n \t\t\t \t\t\t\t<a href=\"https://wiki.citizen.apps.gov/nws_developers/index.php/Main_Page\">For Developers </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.nws.noaa.gov/skywarn/\">Storm Spotters </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/om/coop/\">Cooperative Observers </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.nws.noaa.gov/gis\">GIS</a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://water.weather.gov/ahps/\">Water </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://mag.ncep.noaa.gov/NCOMAGWEB/appcontroller\">Forecast Models </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.aviationweather.gov/\">Aviation </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.weather.gov/fire\">Fire Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.nws.noaa.gov/climate\">Climate </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/om/marine/home.htm\">Marine </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.noaawatch.gov/briefing.php\">Daily Briefing </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.economics.noaa.gov\">Facts and Figures </a><br />\r\n \t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div class=\"footer-column\" style=\"padding:10px 10px;\">\r\n\t\t\t\t\t<span class=\"footer-column-head\">\r\n\t\t\t\t\t\t<a href=\"http://weather.gov/safety\">WEATHER SAFETY</a>\r\n\t\t\t\t\t</span><br />\r\n\t\t\t\t\t \t\t\t\t<a href=\"http://www.weather.gov/nwr/\">NOAA Weather Radio</a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.weather.gov/stormready/\">StormReady</a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.nws.noaa.gov/om/heat/index.shtml\">Heat </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.lightningsafety.noaa.gov/\">Lightning </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nhc.noaa.gov/prepare/\">Hurricanes </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/severeweather/index.shtml\">Thunderstorms </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/severeweather/index.shtml\">Tornadoes </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/severeweather/index.shtml\">Severe Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.ripcurrents.noaa.gov/\">Rip Currents </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/severeweather/index.shtml\">Floods </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/winter/index.shtml\">Winter Weather </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/os/uv/\">Ultra Violet Radiation </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/airquality/\">Air Quality </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/hazstats.shtml\">Damage/Fatality/Injury Statistics </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.redcross.org/\">Red Cross </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.fema.gov/\">Federal Emergency Management Agency (FEMA) </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/brochures.shtml\">Brochures </a><br />\r\n \t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div class=\"footer-column\" style=\"padding:10px 10px;\">\r\n \t\t\t\t\t<p>\r\n\t\t\t\t\t<span class=\"footer-column-head\">\r\n\t\t\t\t\t\t<a href=\"http://weather.gov/news\">NEWS</a>\r\n\t\t\t\t\t</span><br />\r\n\t\t\t\t\t \t\t\t\t<a href=\" http://weather.gov/news\">Newsroom</a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://weather.gov/socialmedia\">Social Media </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://www.nws.noaa.gov/com/weatherreadynation/calendar.html\">Events</a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/brochures.shtml\">Pubs/Brochures/Booklets </a><br />\r\n \t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t\t\t<p> </p>\r\n\t\t\t\t\t<p class=\"footer-column-head\">\r\n \t\t\t\t\t<a href=\"http://weather.gov/education\">EDUCATION</a>\r\n \t\t\t\t</p>\r\n \t\t\t\t<p>\r\n \t\t\t\t \t\t\t\t<a href=\" http://www.economics.noaa.gov\">NOAA Economics </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.education.noaa.gov/Weather_and_Atmosphere/\">NOAA Education Resources </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/glossary/\">Glossary </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.srh.noaa.gov/srh/jetstream/\">JetStream </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/training/\">NWS Training Portal </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.lib.noaa.gov/\">NOAA Library </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/reachout/kidspage.shtml\">Play Time for Kids </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.education.noaa.gov/Weather_and_Atmosphere/\">For Students </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.nws.noaa.gov/om/edures.shtml\">For Teachers </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/brochures.shtml\">Brochures </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/om/reachout/links.shtml\">Other Links </a><br />\r\n \t\t\t \t\t\t\t</p>\r\n \t\t\t\t \t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div class=\"footer-column\" style=\"padding:10px 10px;\">\r\n\t\t\t\t\t<span class=\"footer-column-head\">\r\n\t\t\t\t\t\t<a href=\"http://weather.gov/about\">ABOUT</a>\r\n\t\t\t\t\t</span><br />\r\n\t\t\t\t\t \t\t\t\t<a href=\"http://weather.gov/organization\">Organization </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/sp/\">Strategic Plan </a><br />\r\n \t\t\t \t\t\t\t<a href=\"https://sites.google.com/a/noaa.gov/nws-best-practices/\">For NWS Employees </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/ia/home.htm\">International </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://weather.gov/organization\">National Centers </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/tg/\">Products and Services </a><br />\r\n \t\t\t \t\t\t\t<a href=\" http://www.weather.gov/glossary/\">Glossary </a><br />\r\n \t\t\t \t\t\t\t<a href=\"http://weather.gov/contact\">Contact Us </a><br />\r\n \t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\r\n</div><!-- end of <div class=\"footer\"> -->\r\n\t\t\r\n<!-- legal footer area -->\r\n<div class=\"footer-legal\">\r\n\t\t\t<div class=\"footer-legal-content\">\r\n\t\t\t<div class=\"footer-legal-gov\">\r\n\t\t\t\t<a href=\"http://www.usa.gov\"><img src=\"/css/images/usa_gov.png\" width=\"110\" height=\"30\" /></a>\r\n\t\t\t</div> \r\n\t\t\t\r\n\t\t\t<div class=\"footer-legal-column\">\r\n \t\t\t\t<p> \r\n <a href=\"http://www.commerce.gov\">US Dept of Commerce</a><br />\r\n \t\t\t\t<a href=\"http://www.noaa.gov\">National Oceanic and Atmospheric Administration</a><br />\r\n \t\t\t\t<a href=\"http://www.weather.gov\">National Weather Service</a><br />\r\n \t\t\t\t<a href=\"http://weather.gov/lox\">Los Angeles, CA</a><br /> \t\t\t</p>\r\n \t\t\t</div>\r\n \t\t\t\r\n \t\t\t<div class=\"footer-legal-column2\">\r\n \t\t\t\t<a href=\"http://weather.gov/disclaimer\">Disclaimer</a><br />\r\n \t\t\t\t<a href=\"http://www.cio.noaa.gov/Policy_Programs/info_quality.html\">Information Quality</a><br />\r\n \t\t\t\t<a href=\"http://weather.gov/help\">Help</a><br />\r\n \t\t\t\t<a href=\"http://www.weather.gov/glossary\">Glossary</a>\r\n \t\t\t</div>\r\n\r\n \t\t\t<div class=\"footer-legal-column3\">\r\n \t\t\t\t<a href=\"http://weather.gov/privacy\">Privacy Policy</a><br />\r\n \t\t\t\t<a href=\"http://www.rdc.noaa.gov/~foia\">Freedom of Information Act (FOIA)</a><br />\r\n \t\t\t\t<a href=\"http://weather.gov/about\">About Us</a><br />\r\n \t\t\t\t<a href=\"http://weather.gov/careers\">Career Opportunities</a>\r\n \t\t\t</div>\r\n \t\t</div>\r\n\t\r\n</div><!-- end of <div class=\"footer-legal\"> -->\r\n\t\t\r\n\r\n</body>\r\n</html>"},"http_version":null},"recorded_at":"Sat, 09 Feb 2013 18:43:04 GMT"},{"request":{"method":"get","uri":"http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php?format=24%20hourly&numDays=7&zipCodeList=90210","body":{"encoding":"UTF-8","string":""},"headers":{}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["Apache/2.2.15 (Red Hat)"],"Content-Length":["7879"],"Content-Type":["text/xml"],"Cache-Control":["max-age=163"],"Expires":["Sat, 26 Oct 2013 14:45:02 GMT"],"Date":["Sat, 26 Oct 2013 14:42:19 GMT"],"Connection":["keep-alive"]},"body":{"encoding":"UTF-8","string":"<?xml version=\"1.0\"?>\n<dwml version=\"1.0\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd\">\n <head>\n <product srsName=\"WGS 1984\" concise-name=\"dwmlByDay\" operational-mode=\"official\">\n <title>NOAA's National Weather Service Forecast by 24 Hour Period</title>\n <field>meteorological</field>\n <category>forecast</category>\n <creation-date refresh-frequency=\"PT1H\">2013-10-26T14:42:17Z</creation-date>\n </product>\n <source>\n <more-information>http://www.nws.noaa.gov/forecasts/xml/</more-information>\n <production-center>Meteorological Development Laboratory<sub-center>Product Generation Branch</sub-center></production-center>\n <disclaimer>http://www.nws.noaa.gov/disclaimer.html</disclaimer>\n <credit>http://www.weather.gov/</credit>\n <credit-logo>http://www.weather.gov/images/xml_logo.gif</credit-logo>\n <feedback>http://www.weather.gov/feedback.php</feedback>\n </source>\n </head>\n <data>\n <location>\n <location-key>point1</location-key>\n <point latitude=\"34.10\" longitude=\"-118.41\"/>\n </location>\n <moreWeatherInformation applicable-location=\"point1\">http://forecast.weather.gov/MapClick.php?textField1=34.10&textField2=-118.41</moreWeatherInformation>\n <time-layout time-coordinate=\"local\" summarization=\"24hourly\">\n <layout-key>k-p24h-n7-1</layout-key>\n <start-valid-time>2013-10-26T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-27T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-27T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-28T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-28T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-29T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-29T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-30T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-30T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-31T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-31T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-11-01T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-11-01T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-11-02T06:00:00-07:00</end-valid-time>\n </time-layout>\n <time-layout time-coordinate=\"local\" summarization=\"12hourly\">\n <layout-key>k-p12h-n14-2</layout-key>\n <start-valid-time>2013-10-26T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-26T18:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-26T18:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-27T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-27T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-27T18:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-27T18:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-28T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-28T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-28T18:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-28T18:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-29T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-29T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-29T18:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-29T18:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-30T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-30T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-30T18:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-30T18:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-31T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-31T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-31T18:00:00-07:00</end-valid-time>\n <start-valid-time>2013-10-31T18:00:00-07:00</start-valid-time>\n <end-valid-time>2013-11-01T06:00:00-07:00</end-valid-time>\n <start-valid-time>2013-11-01T06:00:00-07:00</start-valid-time>\n <end-valid-time>2013-11-01T18:00:00-07:00</end-valid-time>\n <start-valid-time>2013-11-01T18:00:00-07:00</start-valid-time>\n <end-valid-time>2013-11-02T06:00:00-07:00</end-valid-time>\n </time-layout>\n <time-layout time-coordinate=\"local\" summarization=\"24hourly\">\n <layout-key>k-p1h-n1-3</layout-key>\n <start-valid-time>2013-10-26T08:00:00-07:00</start-valid-time>\n <end-valid-time>2013-10-26T09:00:00-07:00</end-valid-time>\n </time-layout>\n <parameters applicable-location=\"point1\">\n <temperature type=\"maximum\" units=\"Fahrenheit\" time-layout=\"k-p24h-n7-1\">\n <name>Daily Maximum Temperature</name>\n <value>80</value>\n <value>75</value>\n <value>63</value>\n <value>63</value>\n <value>69</value>\n <value>73</value>\n <value>78</value>\n </temperature>\n <temperature type=\"minimum\" units=\"Fahrenheit\" time-layout=\"k-p24h-n7-1\">\n <name>Daily Minimum Temperature</name>\n <value>59</value>\n <value>56</value>\n <value>52</value>\n <value>53</value>\n <value>54</value>\n <value>56</value>\n <value xsi:nil=\"true\"/>\n </temperature>\n <probability-of-precipitation type=\"12 hour\" units=\"percent\" time-layout=\"k-p12h-n14-2\">\n <name>12 Hourly Probability of Precipitation</name>\n <value>4</value>\n <value>4</value>\n <value>3</value>\n <value>7</value>\n <value>37</value>\n <value>48</value>\n <value>17</value>\n <value>13</value>\n <value>13</value>\n <value>6</value>\n <value>5</value>\n <value>5</value>\n <value>5</value>\n <value xsi:nil=\"true\"/>\n </probability-of-precipitation>\n <weather time-layout=\"k-p24h-n7-1\">\n <name>Weather Type, Coverage, and Intensity</name>\n <weather-conditions weather-summary=\"Mostly Sunny\"/>\n <weather-conditions weather-summary=\"Partly Sunny\"/>\n <weather-conditions weather-summary=\"Chance Rain Showers\">\n <value coverage=\"chance\" intensity=\"light\" weather-type=\"rain showers\" qualifier=\"none\"/>\n </weather-conditions>\n <weather-conditions weather-summary=\"Partly Sunny\"/>\n <weather-conditions weather-summary=\"Mostly Sunny\"/>\n <weather-conditions weather-summary=\"Mostly Sunny\"/>\n <weather-conditions weather-summary=\"Mostly Sunny\"/>\n </weather>\n <conditions-icon type=\"forecast-NWS\" time-layout=\"k-p24h-n7-1\">\n <name>Conditions Icons</name>\n <icon-link>http://www.nws.noaa.gov/weather/images/fcicons/few.jpg</icon-link>\n <icon-link>http://www.nws.noaa.gov/weather/images/fcicons/sct.jpg</icon-link>\n <icon-link>http://www.nws.noaa.gov/weather/images/fcicons/hi_shwrs50.jpg</icon-link>\n <icon-link>http://www.nws.noaa.gov/weather/images/fcicons/sct.jpg</icon-link>\n <icon-link>http://www.nws.noaa.gov/weather/images/fcicons/few.jpg</icon-link>\n <icon-link>http://www.nws.noaa.gov/weather/images/fcicons/few.jpg</icon-link>\n <icon-link>http://www.nws.noaa.gov/weather/images/fcicons/few.jpg</icon-link>\n </conditions-icon>\n <hazards time-layout=\"k-p1h-n1-3\">\n <name>Watches, Warnings, and Advisories</name>\n <hazard-conditions>\n <hazard hazardCode=\"FG.Y\" phenomena=\"Dense Fog\" significance=\"Advisory\" hazardType=\"long duration\">\n <hazardTextURL>http://forecast.weather.gov/wwamap/wwatxtget.php?cwa=lox&wwa=Dense%20Fog%20Advisory</hazardTextURL>\n </hazard>\n </hazard-conditions>\n </hazards>\n </parameters>\n </data>\n</dwml>\n"},"http_version":null},"recorded_at":"Sat, 26 Oct 2013 14:42:19 GMT"},{"request":{"method":"get","uri":"http://w1.weather.gov/xml/current_obs/KSMO.xml","body":{"encoding":"UTF-8","string":""},"headers":{}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["Apache/2.2.15 (Red Hat)"],"Last-Modified":["Sat, 26 Oct 2013 14:02:19 GMT"],"Accept-Ranges":["bytes"],"Content-Length":["2106"],"Content-Type":["application/xml"],"Date":["Sat, 26 Oct 2013 14:42:19 GMT"],"Connection":["keep-alive"]},"body":{"encoding":"UTF-8","string":"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \r\n<?xml-stylesheet href=\"latest_ob.xsl\" type=\"text/xsl\"?>\r\n<current_observation version=\"1.0\"\r\n\t xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\r\n\t xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n\t xsi:noNamespaceSchemaLocation=\"http://www.weather.gov/view/current_observation.xsd\">\r\n\t<credit>NOAA's National Weather Service</credit>\r\n\t<credit_URL>http://weather.gov/</credit_URL>\r\n\t<image>\r\n\t\t<url>http://weather.gov/images/xml_logo.gif</url>\r\n\t\t<title>NOAA's National Weather Service</title>\r\n\t\t<link>http://weather.gov</link>\r\n\t</image>\r\n\t<suggested_pickup>15 minutes after the hour</suggested_pickup>\r\n\t<suggested_pickup_period>60</suggested_pickup_period>\n\t<location>Santa Monica Muni, CA</location>\n\t<station_id>KSMO</station_id>\n\t<latitude>34.03</latitude>\n\t<longitude>-118.45</longitude>\n\t<observation_time>Last Updated on Oct 26 2013, 6:51 am PDT</observation_time>\r\n <observation_time_rfc822>Sat, 26 Oct 2013 06:51:00 -0700</observation_time_rfc822>\n\t<weather>Fog</weather>\n\t<temperature_string>57.0 F (13.9 C)</temperature_string>\r\n\t<temp_f>57.0</temp_f>\r\n\t<temp_c>13.9</temp_c>\n\t<relative_humidity>96</relative_humidity>\n\t<wind_string>Calm</wind_string>\n\t<wind_dir>North</wind_dir>\n\t<wind_degrees>0</wind_degrees>\n\t<wind_mph>0.0</wind_mph>\n\t<wind_kt>0</wind_kt>\n\t<pressure_string>1018.5 mb</pressure_string>\n\t<pressure_mb>1018.5</pressure_mb>\n\t<pressure_in>30.08</pressure_in>\n\t<dewpoint_string>55.9 F (13.3 C)</dewpoint_string>\r\n\t<dewpoint_f>55.9</dewpoint_f>\r\n\t<dewpoint_c>13.3</dewpoint_c>\n\t<visibility_mi>0.25</visibility_mi>\n \t<icon_url_base>http://forecast.weather.gov/images/wtf/small/</icon_url_base>\n\t<two_day_history_url>http://www.weather.gov/data/obhistory/KSMO.html</two_day_history_url>\n\t<icon_url_name>nfg.png</icon_url_name>\n\t<ob_url>http://www.weather.gov/data/METAR/KSMO.1.txt</ob_url>\n\t<disclaimer_url>http://weather.gov/disclaimer.html</disclaimer_url>\r\n\t<copyright_url>http://weather.gov/disclaimer.html</copyright_url>\r\n\t<privacy_policy_url>http://weather.gov/notice.html</privacy_policy_url>\r\n</current_observation>\n"},"http_version":null},"recorded_at":"Sat, 26 Oct 2013 14:42:19 GMT"}],"recorded_with":"VCR 2.6.0"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
module Barometer
|
4
|
+
describe Noaa::CurrentResponse do
|
5
|
+
let(:forecast_response) { Barometer::Response.new }
|
6
|
+
|
7
|
+
it "parses the timezones correctly" do
|
8
|
+
payload = Barometer::Utils::Payload.new({
|
9
|
+
'observation_time_rfc822' => 'Sun, 14 Apr 2013 10:51:00 -0700',
|
10
|
+
'observation_time' => 'Last Updated on Apr 14 2013, 10:51 am PDT'
|
11
|
+
})
|
12
|
+
response = Noaa::CurrentResponse.new(forecast_response).parse(payload)
|
13
|
+
|
14
|
+
utc_observed_at = Time.utc(2013,04,14,17,51,00)
|
15
|
+
utc_stale_at = Time.utc(2013,04,14,18,51,00)
|
16
|
+
|
17
|
+
expect( response.current.observed_at.utc ).to eq utc_observed_at
|
18
|
+
expect( response.current.stale_at.utc ).to eq utc_stale_at
|
19
|
+
expect( response.timezone.to_s ).to eq 'PDT'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
module Barometer
|
4
|
+
describe Noaa::ForecastResponse do
|
5
|
+
it "parses the timezones correctly" do
|
6
|
+
payload = Barometer::Utils::Payload.new({
|
7
|
+
'time_layout' => [
|
8
|
+
{
|
9
|
+
'layout_key'=> 'k-p12h-n14-2',
|
10
|
+
'start_valid_time' => ['2013-02-09T06:00:00-08:00'],
|
11
|
+
'end_valid_time' => ['2013-02-09T18:00:00-08:00']
|
12
|
+
}
|
13
|
+
],
|
14
|
+
'parameters' => {
|
15
|
+
'temperature' => [
|
16
|
+
{'value'=>['55'], '@type'=>'maximum'},
|
17
|
+
{'@type'=>'minimum'}
|
18
|
+
],
|
19
|
+
'probability_of_precipitation' => { 'value' => [] },
|
20
|
+
'weather' => { 'weather_conditions' => [] },
|
21
|
+
'conditions_icon' => { 'icon_link' => [] }
|
22
|
+
}
|
23
|
+
})
|
24
|
+
response = Noaa::ForecastResponse.new.parse(payload)
|
25
|
+
|
26
|
+
utc_starts_at = Time.utc(2013,2,9,14,0,0)
|
27
|
+
utc_ends_at = Time.utc(2013,2,10,2,0,0)
|
28
|
+
|
29
|
+
expect( response.forecast[0].starts_at.utc ).to eq utc_starts_at
|
30
|
+
expect( response.forecast[0].ends_at.utc ).to eq utc_ends_at
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/noaa_spec.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
module Barometer
|
4
|
+
describe Noaa, vcr: {
|
5
|
+
cassette_name: 'Noaa'
|
6
|
+
} do
|
7
|
+
|
8
|
+
it "auto-registers this weather service as :noaa" do
|
9
|
+
expect( Barometer::WeatherService.source(:noaa) ).to eq Barometer::Noaa
|
10
|
+
end
|
11
|
+
|
12
|
+
describe ".call" do
|
13
|
+
let(:query) { build_query.tap{|q|q.stub(add_conversion: nil)} }
|
14
|
+
|
15
|
+
subject { Noaa.call(query) }
|
16
|
+
|
17
|
+
before do
|
18
|
+
query.stub(:convert!).and_return do |*formats|
|
19
|
+
if formats.include?(:noaa_station_id)
|
20
|
+
Barometer::ConvertedQuery.new("KSMO", :station_id)
|
21
|
+
elsif formats.include?(:zipcode)
|
22
|
+
Barometer::ConvertedQuery.new("90210", :zipcode)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "asks the query to convert to accepted formats" do
|
28
|
+
query.should_receive(:convert!).with(:zipcode, :coordinates)
|
29
|
+
subject
|
30
|
+
end
|
31
|
+
|
32
|
+
it "adds a coordinate conversion to the query" do
|
33
|
+
query.should_receive(:add_conversion).with(:coordinates, '34.1,-118.41')
|
34
|
+
subject
|
35
|
+
end
|
36
|
+
|
37
|
+
it "includes the expected data" do
|
38
|
+
subject.query.should == '90210'
|
39
|
+
subject.format.should == :zipcode
|
40
|
+
subject.should be_metric
|
41
|
+
|
42
|
+
should have_data(:current, :observed_at).as_format(:time)
|
43
|
+
should have_data(:current, :stale_at).as_format(:time)
|
44
|
+
|
45
|
+
should have_data(:current, :humidity).as_format(:float)
|
46
|
+
should have_data(:current, :condition).as_format(:string)
|
47
|
+
should have_data(:current, :icon).as_format(:string)
|
48
|
+
should have_data(:current, :temperature).as_format(:temperature)
|
49
|
+
# should have_data(:current, :wind_chill).as_format(:temperature)
|
50
|
+
should have_data(:current, :dew_point).as_format(:temperature)
|
51
|
+
should have_data(:current, :wind).as_format(:vector)
|
52
|
+
should have_data(:current, :pressure).as_format(:pressure)
|
53
|
+
should have_data(:current, :visibility).as_format(:distance)
|
54
|
+
|
55
|
+
should have_data(:location, :name).as_value("Santa Monica Muni, CA")
|
56
|
+
should have_data(:location, :city).as_value("Santa Monica Muni")
|
57
|
+
should have_data(:location, :state_code).as_value("CA")
|
58
|
+
should have_data(:location, :country_code).as_value("US")
|
59
|
+
should have_data(:location, :latitude).as_value(34.10)
|
60
|
+
should have_data(:location, :longitude).as_value(-118.41)
|
61
|
+
|
62
|
+
should have_data(:station, :id).as_value("KSMO")
|
63
|
+
should have_data(:station, :name).as_value("Santa Monica Muni, CA")
|
64
|
+
should have_data(:station, :city).as_value("Santa Monica Muni")
|
65
|
+
should have_data(:station, :state_code).as_value("CA")
|
66
|
+
should have_data(:station, :country_code).as_value("US")
|
67
|
+
should have_data(:station, :latitude).as_value(34.10)
|
68
|
+
should have_data(:station, :longitude).as_value(-118.41)
|
69
|
+
|
70
|
+
should have_data(:timezone, :to_s).as_format(/^P[DS]T$/i)
|
71
|
+
|
72
|
+
subject.forecast.size.should == 14
|
73
|
+
should have_forecast(:starts_at).as_format(:time)
|
74
|
+
should have_forecast(:ends_at).as_format(:time)
|
75
|
+
should have_forecast(:icon).as_format(:string)
|
76
|
+
should have_forecast(:condition).as_format(:string)
|
77
|
+
should have_forecast(:pop).as_format(:float)
|
78
|
+
should have_forecast(:high).as_format(:temperature)
|
79
|
+
should have_forecast(:low).as_format(:temperature)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'pry'
|
3
|
+
require 'vcr'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
require 'barometer/support'
|
6
|
+
|
7
|
+
require_relative '../lib/barometer/noaa'
|
8
|
+
|
9
|
+
Dir['./spec/support/**/*.rb'].sort.each {|f| require f}
|
10
|
+
|
11
|
+
VCR.configure do |config|
|
12
|
+
config.cassette_library_dir = 'spec/cassettes'
|
13
|
+
config.hook_into :webmock
|
14
|
+
config.default_cassette_options = { record: :none, serialize_with: :json }
|
15
|
+
config.configure_rspec_metadata!
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
20
|
+
config.include Barometer::Support::Matchers
|
21
|
+
config.include Barometer::Support::Factory
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: barometer-noaa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Gangl
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: barometer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A barometer adapter for Noaa weather
|
42
|
+
email:
|
43
|
+
- mark@attackcorp.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- barometer-noaa.gemspec
|
54
|
+
- lib/barometer/noaa.rb
|
55
|
+
- lib/barometer/noaa/current_api.rb
|
56
|
+
- lib/barometer/noaa/current_query.rb
|
57
|
+
- lib/barometer/noaa/current_response.rb
|
58
|
+
- lib/barometer/noaa/forecast_api.rb
|
59
|
+
- lib/barometer/noaa/forecast_query.rb
|
60
|
+
- lib/barometer/noaa/forecast_response.rb
|
61
|
+
- lib/barometer/noaa/response/current_location.rb
|
62
|
+
- lib/barometer/noaa/response/current_station.rb
|
63
|
+
- lib/barometer/noaa/response/current_weather.rb
|
64
|
+
- lib/barometer/noaa/response/forecasted_weather.rb
|
65
|
+
- lib/barometer/noaa/response/location.rb
|
66
|
+
- lib/barometer/noaa/response/timezone.rb
|
67
|
+
- lib/barometer/noaa/version.rb
|
68
|
+
- spec/cassettes/Noaa.json
|
69
|
+
- spec/noaa/current_response_spec.rb
|
70
|
+
- spec/noaa/forecast_response_spec.rb
|
71
|
+
- spec/noaa_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
homepage: https://github.com/attack/barometer-noaa
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.9.2
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: A barometer adapter for Noaa weather
|
97
|
+
test_files:
|
98
|
+
- spec/cassettes/Noaa.json
|
99
|
+
- spec/noaa/current_response_spec.rb
|
100
|
+
- spec/noaa/forecast_response_spec.rb
|
101
|
+
- spec/noaa_spec.rb
|
102
|
+
- spec/spec_helper.rb
|