Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How to display (in any graphic representation) the maximum and minimum temperatures for one city in one of these selected time periods over the 5-day period? The time periods are:

  • Morning (06:00 to 12:00)
  • Afternoon (12:00 to 16:00)
  • Evening (16:00 to 20:00)
  • Night (20:00 to 06:00 the next day).

I'd like the x-axis to show the date and the y-axis to show temperatures.

I already wrote a small bit of code which can find the mean in a given time interval

Mean[Select[
  Flatten[
   WeatherData[
    "Your_City_Name", 
    "Temperature", {{2012, 11, 5, 6, 0}, {2012, 11, 5, 12, 0}}]
   , 1], NumberQ
  ]
 ]
share|improve this question
add comment

1 Answer

It appears WeatherData does not provide max and min temperatures on a smaller timescale than daily.

londoncoordinates = CityData["London", "Coordinates"];
londonweatherstation = WeatherData[londoncoordinates, "NearestStation"];

DateListPlot[{
  {DatePlus[#1, {12, "Hour"}], #2} & @@@ 
   WeatherData[londonweatherstation,
    "MinTemperature", {{2012, 11, 5}, {2012, 11, 10}, "Day"}],
  {DatePlus[#1, {12, "Hour"}], #2} & @@@ 
   WeatherData[londonweatherstation,
    "MaxTemperature", {{2012, 11, 5}, {2012, 11, 10}, "Day"}],
  WeatherData[londonweatherstation, "Temperature",
   {{2012, 11, 5, 6, 0}, {2012, 11, 10, 6, 0}}]}, Joined -> True,
 Filling -> {1 -> {{2}, LightYellow}}]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.