Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 44 additions & 27 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,74 @@
= noaa
#noaa

* http://github.com/outoftime/noaa
- [http://github.com/outoftime/noaa](ttp://github.com/outoftime/noaa)

== Description:
##Description:

noaa is a library that provides an API for the National Oceanic and Atmospheric Association's weather
data feeds. It currently provides access to two types of data: current conditions (through NOAA::CurrentConditions) and
daily forecasts (through NOAA::Forecast).

== Features:
##Features:

- Find both current conditions and daily forecasts using lat/lng.
- Access all relevant data returned by the NOAA using a simple and intuitive API

== Requirements:
##Requirements:

- libxml-ruby >= 0.9.7 (if there is demand, I could look into allowing REXML as a fallback - shoot me an email)
- geokit >= 1.5.0

== Installation:
##Installation:

sudo gem sources --add http://gems.github.com (only if you haven't done this before)
sudo gem install outoftime-noaa
sudo noaa-update-stations
```bash
sudo gem install noaa
```

== Usage:

# Get current conditions
conditions = NOAA.current_conditions(lat, lng)
puts "The temperature is currently #{conditions.temperature} degrees, with #{conditions.weather_description.downcase} conditions."

# Get closest weather station, then get current conditions
# See discussion in documentation of NOAA.current_conditions
# for why this is a good idea
station_id = NOAA::Station.closest_to(lat, lng).id
# persist the station id wherever...
conditions = NOAA.current_conditions_for_station(station_id)
```bash
sudo noaa-update-stations
```

# Get four-day forecast
forecast = NOAA.forecast(4, lat, lng) # This method should not be called more than once an hour for a given lat/lng
['today', 'tomorrow', (Date.today + 2).to_s, (Date.today + 3).to_s].each_with_index do |date, i|
puts "The high for #{date} will be #{forecast[i].high}"
end
##Usage:

###Get current conditions

```ruby
conditions = NOAA.current_conditions(lat, lng)
puts "The temperature is currently #{conditions.temperature} degrees, with #{conditions.weather_description.downcase} conditions."
```


###Get closest weather station, then get current conditions

```ruby
# See discussion in documentation of NOAA.current_conditions
# for why this is a good idea
station_id = NOAA::Station.closest_to(lat, lng).id
# persist the station id wherever...
conditions = NOAA.current_conditions_at_station(station_id)
```



### Get four-day forecast

```ruby
forecast = NOAA.forecast(4, lat, lng) # This method should not be called more than once an hour for a given lat/lng
['today', 'tomorrow', (Date.today + 2).to_s, (Date.today + 3).to_s].each_with_index do |date, i|
puts "The high for #{date} will be #{forecast[i].high}"
end
```

See the API documentation for further discussion.

== Contact:
##Contact:

Mat Brown (mat@patch.com)

I'm always open to feature requests, bugs, and patches.

== License:
##License:

(The MIT License)

Expand Down
2 changes: 1 addition & 1 deletion noaa.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.description = %q{Ruby API for National Oceanic and Atmospheric Administration weather data}
s.email = %q{mat@patch.com}
s.executables = ["noaa-update-stations"]
s.files = Dir.glob('{bin,lib,test,data}/**/*') + %w(CHANGELOG README)
s.files = Dir.glob('{bin,lib,test,data}/**/*') + %w(CHANGELOG README.md)
s.has_rdoc = true
s.homepage = %q{http://github.com/outoftime/noaa}
s.post_install_message = %q{Be sure to update the weather station list:
Expand Down