3
$\begingroup$

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
  ]
 ]
$\endgroup$
3
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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