[Purdue-pm] followup to last night's meeting

Mark Senn mark at senn.us
Fri Dec 16 20:55:01 PST 2016


Joe Kline wrote on 2016-12-16 at 14:31:
|   that is partly helpful.
|
|  I want hourly data and looks to be daily data.
|
|  My data set is approximately 43x365.25x24 (since the KLAF data only 
goes
|  back to January 01, 1973 midnight).

Type each Mathematica code line below followed by Shift-Enter.

# Get Purdue Airport temperature data for 2016-12-15 0200 to 2100.
wd = WeatherData["KLAF", "Temperature",  {{2016, 12, 15, 2,0,0}, {2016, 
12, 15, 21,0,0}}]
# The data is shown---there were 20 entries, the first at 02:54:00, the 
last at 20:54:00.

# Plot the data.  The "PlotMarkers->Automatic" marks each data point 
with a dot.
DateListPlot[wd, PlotMarkers -> Automatic]

# Show the second element of wd.
wd[[2]]

# Left click on "show all" to show all the data.
# Note that there is a "Missing[NotAvailable]" entry.

# Show the times of the readings in an integer representing number of 
seconds.
times = Flatten[wd[[2,2]]]

# Convert the times to a human readable form.
 FromUnixTime /@ times

# Left click on "show all" to show the human readable times.
# A total of twenty times are shown.

# Get weather data for 1970 through the present.
wd = WeatherData["KLAF", "Temperature", {{1970, 1, 1, 0, 0, 0}, 
DateList[]}]
# The first entry returned was for one hour before 1973-01-01 0100.
# (I don't write 0000 because some people think that's at the end of the
# day instead of the beginning.)
# A short summary of the time series produced is printed.
# It stated that 440,960 points were returned.

# Ask Mathematica how many hours it has been since January 1, 1973
# using it's natural language interface.
= how many hours ago was 1am, January 1, 1973?
# The result was 385,343.  My guess is it is working ok.  I can't 
explain
# the difference between 385,343 hours and 440,960 points offhand
# but I'll but there is an explanation for it and data is taken 
somewhere
# around once an hour when everything is working ok.

Typing, for example
     = how many hours ago was 1am, January 1, 1973?
in Mathematica uses WolframAlpha technology to answer the question.
You can go to wolframalpha.com and ask it questions
using natural language---you don't need to prefix questions with a "="
though.

-mark





More information about the Purdue-pm mailing list