JeffHopper

Storing weather forecast data in PI.

Discussion created by JeffHopper on Mar 4, 2014
Latest reply on Mar 2, 2017 by jagdish.konathala

I have a need to be able to store and retrieve hourly weather forecast data for a week out.  I can think of a few ways to do this but wanted to hit up the community to see if there are more, which I'm sure there are:

 

A. 7 tags - each representing a predicted day

 

As I need a week ahead of data, store the values using a 1 week time offset back in time, but store each day in a separate tag.

 

Tags may be:

 

Day0Forcast.OutsideTemp  (for today's forecast)

 

Day1Forcast.OutsideTemp (tomorrow's forecast)

 

...
Day6Forcast.OutsideTemp (one week out)

 

 

 

If today is Mar-4 I'd then store todays Day0 forecast using timestamps -7d or Feb-28.  Tomorrow when I store the values, then they would be using dates of Feb-29.  This allows me to see what the weather prediction was for any day by just adding 7 days to the timestamp.

 

1. Advantage: data isn't overwritten, it is consecutive.

 

2. Disadvantage: a single week's predictions cannot be trended using a single point and it would take some funny business to select values from each tag.

 

3. Disadvantage: the timestamps must be re-interpreted the same way so as stored, they are confusing.  I don't think even AF can apply an implied time offset to the timestamp

 

 

 

 

 

B: 7 tags, each representing a prediction for the week.

 

Here depending on what day of the week today is, I can store the values again using a 7 day time offset but rotate what tag the values get stored to.  If today is Tuesday Mar-4, then I use the Tuesday predictions

 

TuesdayForcast.OutsideTemp  (for today's forecast)

 

WednesdayForcast.OutsideTemp (tomorrow's forecast)

 

...
MondayForcast.OutsideTemp (one week out)

 

1. Advantage: data isn't overwritten, it is consecutive.

 

2. Disadvantage: the timestamps must be re-interpreted the same way so as stored, they are confusing.  I don't think even AF can apply an implied time offset to the timestamp, it can do a time offset fetch to get the data at that time in the archive.

 

Even with storing data using future time stamps, this prediction for each day use case will still exist.

 

 

 

OK, Discuss.

 

 

 

 

Outcomes