# A question about WeatherData and missing dates

Posted 14 days ago
266 Views
|
9 Replies
|
4 Total Likes
|
 Dear All,The year 2019 has 365 days. The "WeatherData" output shows 357 data for Istanbul city. How do I use the Datepath command or any other commands to find the missing dates? I appreciate your time. Alex
9 Replies
Sort By:
Posted 14 days ago
 Hello friends, here is one way: {dateStart, dateEnd} = DateObject /@ {{2019, 1, 1, 0, 0, 0}, {2019, 12, 31, 0, 0, 0}}; data = WeatherData["Istambul", "WindSpeed", {dateStart, dateEnd, "Day"}]; allDays = DateRange[dateStart, dateEnd]; DateObject /@ Complement[DateString /@ allDays, DateString /@ data["Dates"]] 
Posted 13 days ago
 Hi Dr.Schachner,That is a great solution. I found the missing dates easily. Thank you so much.For filling up the missing dates, interpolating is a good way? Regards,
Posted 13 days ago
 Hi Alex,glad to help (and please just call me Henrik)! Yes, I think interpolation is a good way. And data["PathFunction"] gives already the respective InterpolatingFunction. Regards -- Henrik
Posted 12 days ago
 I appreciate your help, Henrik. I tried to fill in the missing data for 23rd January. I got a strange value! It is the same for other dates. In[16]:= data["PathFunction"]; In[15]:= %8[23] Out[15]= Quantity[249937., ("Kilometers")/("Hours")] 
Posted 12 days ago
 Alex,You need to pass an AbsoluteTime to the PathFunction. data["PathFunction"][AbsoluteTime[{2019, 1, 23}]] (* Quantity[13.52, ("Kilometers")/("Hours")] *) 
Posted 11 days ago
 Many thanks, Rohit.
Posted 13 days ago
 Hi Henrik,I was wondering why the conversion to DateString is required. Here is why allDays[[1]] // InputForm (* DateObject[{2019, 1, 1, 0, 0, 0.}, "Instant", "Gregorian", -5.] *) data["Dates"][[1]] // InputForm (* DateObject[{2019, 1, 1, 0, 0, 0}, "Instant", "Gregorian", -5.] *) The DateObject generated by DateRange has Real seconds 0. while the DateObject in WeatherData has Integer seconds 0. Even though the date specifications passed to DateRange have Integer seconds. This seems like an oversight or bug in the implementation of DateRange. Thanks for revealing this, I will keep it in mind when dealing with DateRange.
Posted 13 days ago
 Hi Rohit,I freely admit that I could not make sense of why these DateObject[] do not work in combination with Complement[] - now I know, many thanks! Regards -- Henrik
Posted 14 days ago
 Alex,I had the same problem several times. Thank you for the inquiry.Cheers,