Skip to content

Commit 21c24b4

Browse files
committed
ditch yahoo weather
1 parent cc2941a commit 21c24b4

File tree

3 files changed

+48
-45
lines changed

3 files changed

+48
-45
lines changed

advanced_data/noaa_weather.rb

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
require 'picrate'
2+
# Loading XML Data
3+
# by Martin Prout
4+
#
5+
# This example demonstrates how to use loadXML
6+
# to retrieve data from an XML document via a URL
7+
Weather = Struct.new(:location, :weather, :celsius, :fahrenheit)
8+
9+
class NOAAWeather < Processing::App
10+
attr_reader :weather
11+
NOAA = 'KMIA' # NOAA Weather Miami Airport
12+
def setup
13+
sketch_title "NOAA's National Weather Service"
14+
# font = create_font('Times Roman', 26)
15+
# font = create_font('Merriweather-Light.ttf', 28)
16+
# text_font(font)
17+
# The URL for the XML document
18+
19+
fo = "https://w1.weather.gov/xml/current_obs/display.php?stid=%s"
20+
url = format(fo, NOAA)
21+
# Load the XML document
22+
xml = loadXML(url)
23+
@weather = Weather.new(
24+
xml.get_child('location'),
25+
xml.get_child('weather'),
26+
xml.get_child('temp_f'),
27+
xml.get_child('temp_c')
28+
)
29+
end
30+
31+
def draw
32+
background(255)
33+
fill(0)
34+
# Display all the stuff we want to display
35+
text(format("Location: %s", weather.location.get_content), width * 0.15, height * 0.36)
36+
text(format("Temperature: %s Fahrenheit", weather.fahrenheit.get_content), width * 0.15, height * 0.5)
37+
text(format("Temperature: %s Celsius", weather.celsius.get_content), width * 0.15, height * 0.66)
38+
text(format('Weather: %s', weather.weather.get_content), width * 0.15, height * 0.82)
39+
no_loop
40+
end
41+
42+
def settings
43+
size 600, 360
44+
end
45+
end
46+
47+
NOAAWeather.new

advanced_data/yahoo_weather.rb

-43
This file was deleted.

external_library/java/handy/preset_style_demo.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ class PresetStyleDemo < Processing::App
3838
# ---------------------------- Processing methods -----------------------------
3939
def settings
4040
size(1200, 800)
41-
# Should work with all Processing 3 renderers.
41+
# Should work with all Processing renderers.
4242
# size(1200, 800, P2D)
4343
# size(1200, 800, P3D)
44-
# size(1200, 800, FX2D)
4544
pixelDensity(displayDensity) # Use platform's maximum display density.
4645
end
4746

0 commit comments

Comments
 (0)