While it may seem like an easily-answered question, sometimes it is not completely obvious what exact time periods are covered by a given weather query and how the weather metrics are calculated. The fact is that the traditional standards and customs of weather reporting make up a standard that although logical may not always appear to be consistent. In this short article, I will explain the standards and how we apply them in Visual Crossing Weather. It is my hope that this will resolve any confusion that you may have on this topic. But if you have further questions, please put them in the comments below or email our support team.
Two Types of Weather Queries and Times
There are fundamentally two types of weather queries, Range Queries and Observation Queries. Understanding how these two types of queries behave and when to apply each type is the key to understanding the time periods and other characteristics of every possible weather query.
One other thing to note before we dive in is that in Visual Crossing Weather times are always reported in local time based on the location queried. That is, if there is a weather report for New York City for 5:00pm on a specific day, it will show the conditions when the clocks in New York showed 5:00pm on that day. Note that many places around the world observe some form of daylight savings time (DST) that means local time drifts with respect to UTC, and Visual Crossing Weather goes to great effort to account for these time changes properly.
Visual Crossing Weather believes that using local times make consuming weather data much easier and intuitive However, some other weather data services do not follow this standard. In fact, many services are inconsistent about which time standards they follow and even vary their results depending on the query types and the local state of DST. So you are encouraged to careful when considering the times supplied by other data providers.
What is a Range Query?
As the name implies, a Range Query is a query that requests weather data that covers a range of dates or times. Most Range Queries can be easily identified because they obviously specify a date range. For example, a query that requests data from July 1 through July 31, 2020 obviously is requesting a range of data. This would be the same as query for specific week or a specific year.
A weather history summary report is also a form of Range Query. While you might not specify a range directly, the break-by values provide the data ranges. For example, you may create a summary query broken by week. In this case, your output will contains rows such as “week 1, “week 2,” “week 3,” etc. Thus the range of each row is one 7-day week based its position in the year.
Finally, a single day history query is also a form of Range Query. Even though you may specify the same date as the start and end date, the fact that you are specifying a range in your query makes it Range Query. For example, if you query the weather for July 4, 2020 by specifying 7/4/2020 for both the start and end date, you are actually telling the weather engine to run a query from just after the midnight transition to July 4 (12:00:01 am on 7/4/2020) until just before the midnight transition into July 5 (11:59:59 pm on 7/4/2020). In the output of this query, you don’t want a direct observation of the conditions at midnight. Instead you want the weather engine to calculate a summary record for the 24-hour period that was 7/4/2020.
What is an Observation Query?
Observation Queries are ones in which the query requests weather at a specific point in time. This type of query is most common in hourly and sub-hourly history reports. The goal of the query is to get an accurate view of the conditions at the specifically requested point in time.
A example of an Observation Query is an hourly weather history or forecast query. In this query, the expected results are a record for each hour containing the weather conditions as close as possible to the hour in question. This is the case whether your query contains a single hour or even if your query contains a range of dates during which you want the hour-by-hour records. This is also true for sub-hourly queries as well.
By way of a concrete example, an Observation Query could request hourly weather records for July 4th, 2020. You would expect to get 24 records, one for each hour. In the case of the 1:00 am record, you would get the conditions as close a possible to 1:00 am at the desired location. The same is true for the 2:00 am record, the 3:00 am record, and so on.
Weather Forecast Queries
Let’s apply these query types to weather forecast queries. Hourly weather forecasts are a relatively easy case to understand since hourly forecasts are always Observation Queries. Forecasts attempt to predict the weather conditions at a specific location and period in time. For example, an hourly forecast for 8:00 am contains the weather conditions expected to happen at 8:00 am at the given location. The Temperature is the predicted 8:00 am temperature as is the Humidity and most other weather metrics. Precipitation is a bit more complex as the precipitation metric must always be a sum over some period. In the case of an hourly forecast, that period is the hour before the time given. In our example, all precipitation expected during that one hour period between 7 am and 8 am will be counted. However, the sister metric, Chance of Precipitation, is the percentage chance that there will be precipitation exactly at the 8:00 am reporting time.
A daily forecast, however, has the properties of a Range Query. The implicit range of the query is the 24 hours period that represents a single, calendar day. For example, the daily forecast for July 4th describes the conditions expected between just after the midnight transition to July 4 (12:00:01 am on 7/4) and just before the midnight transition into July 5 (11:59:59 pm on 7/4). Weather metrics such as Minimum Temperature, Maximum Temperature, and (average) Temperature are reported based on looking at the expected temperatures over the entire 24-hour period and finding the minimum, maximum, and average respectively. The same is true for other metrics such as humidity and wind speed. Precipitation is calculated over the entire day-long period as well. exactly as described in the hourly forecast case only over this 24-hour period instead of a single hour. This is the same standard that your TV meteorologist has used for decades. So it makes natural sense to most people.
Weather History Data
The situation gets more complex with weather history data since both Range Queries and Observation Queries apply depending upon the query details.
If you execute a history query requesting data that is summarized over a range of time or days, then the Range Query rules apply. You will get an aggregate of the conditions over the period requested. For example, the Temperature weather metric will give you the average temperature over the requested range while the Minimum Temperature and Maximum Temperature will provide the minimum and maximum values respectively over that same range. Weather metrics such as precipitation and snow fall will be aggregated over the requested range also and reported as a single value.
Observation Queries rules apply in cases such as hourly and sub-hourly history queries where you want to see the weather conditions at a specific point in time. For weather metrics such as Temperature, the Visual Crossing Weather engine finds the observation as close as possible to the requested historical observation time and location. Interpolation is done as necessary to find the best data for the query.
As in forecast, some weather metrics such as Precipitation and Snow Fall don’t make sense in terms of an instantaneous observation. Instead they must always be aggregated over some time period. For historical Observation Queries, this is resolved by looking backwards during a window that is the length of the query period. For example, an hourly query result will report the entire precipitation for the one-hour window immediately before that specific hour. Likewise, a sub-hourly query with a reporting period of 15-mins will report just the precipitation accumulated during the 15-minute period before the observation.
Often times it helps clarify when we look a few specific examples.
Query: Hourly weather forecasts for the next 15 days.
Result: This is an Observation Query. The result will contain one record for each hour in each day during the 15-day forecast period. For each hourly record, the Temperature will give the predicted temperature at the beginning of that hour. For example, the 9:00am report will provide the predicted Temperature, Humidity, etc. at 9:00. Since Precipitation must be aggregated over a period, it will be summed for the hour immediately before the reported time. In our 9:00am example, the precipitation given will be for the 60-minute period between 8:00am and 9:00am.
Query: Daily weather forecasts for the next 15 days.
Result: This is an Range Query. The result will contain one record for each day in the 15-day forecast period. For each daily record, the Temperature will give the average temperature during the 24-hour day reported. The Maximum and Minimum Temperatures, humidity, precipitation, etc. will likewise be calculated over the entire day-long period.
Query: Daily historical weather data from 7/1/2020 to 7/15/2020
Results: This is a Range Query. The result will contain one record for each day in the period (15 records). For each daily record, the Temperature will give the average temperature during the day reported. The Maximum and Minimum Temperatures will likewise be the max and min respectively during that individual day. Precipitation will be a sum of the total precipitation during that day also.
Query: Hourly historical weather data from 7/1/2020 to 7/15/2020
Results: This is an Observation Query. The result will contain one record for each hour of each day in the period (15 days * 24 hours = 360 records). For each hourly record, the Temperature will give an observed value as close as possible to the hour reported. There will be no Maximum and Minimum Temperature reports since this is an observation query. Precipitation will be a sum of the total precipitation reported during the period starting one hour before the reported hour and ending at the reported hour.
Query: Sub-hourly historical weather data from 7/1/2020 to 7/15/2020 reported every 15 minutes
Results: This is an Observation Query. The result will be similar to the hourly query above except that the reporting period is every 15 minutes instead of every hour. The result data will contain one record for each 15-minute period of each hour of each day in the overall period (15 days * 24 hours * 4 period per hour = 1440 records). For each record, the Temperature will give an observed value as close as possible to the exact time reported. Again there will be no Maximum and Minimum Temperatures since this is an observation query. Precipitation will be a sum of the total precipitation reported during the 15-minute period starting 15 minutes before the reported time and ending at the reported time.
I hope that this article has accomplished its goal of clarifying the exact query periods for various types of Visual Crossing Weather queries. If you are familiar with other weather services or weather reporting in general, you will find that these rules match industry standards and customs.
If you have any questions about this topic or need further clarification, please let us know in the comments below. Alternately, you can always email us your questions on this or any other weather topic. We look forward to hearing from you!