How to Query the Average of the Three Hottest Consecutive Days in a Water Year?

  • Context: Undergrad 
  • Thread starter Thread starter jacquestardie
  • Start date Start date
  • Tags Tags
    Maximum Value
Click For Summary
SUMMARY

This discussion focuses on constructing a SQL query to calculate the average temperature of the three hottest consecutive days within a specified water year, utilizing temperature data recorded every 15 minutes. The proposed solution involves selecting a specific site, determining the hottest temperature for each day, calculating degree days, and identifying the three-day span with the highest temperature change. The user seeks feedback on the efficiency of this approach and requests guidance on formulating a SQL query to find the highest rate of change over three days.

PREREQUISITES
  • SQL query construction
  • Understanding of temperature data aggregation
  • Knowledge of degree day calculations
  • Familiarity with time-series data analysis
NEXT STEPS
  • Research SQL window functions for calculating moving averages
  • Learn about temperature data normalization techniques
  • Explore SQL queries for identifying maximum values over a specified period
  • Investigate performance optimization strategies for large datasets in SQL
USEFUL FOR

Data analysts, environmental scientists, and database developers interested in time-series analysis and temperature data management.

jacquestardie
Messages
1
Reaction score
0
First, let me describe my problem:

I'm trying to create a query within a database that will output the average of the three hottest consecutive days within a certain water year. The data is being pulled from a set of temperature loggers that record temperature every 15minutes.

My tentative solution:


1. Since I'm pulling data for a specific site, out of a database made of many sites, I first need to select the site. Duh.

2. Select Water Year.

3. Select the hottest temperature within each day. IE, somewhere around 2 oclock, per day.

3. Calculate degree days (simply the cumulative temperature at the site)

4. Determine largest change in a three day span, within the degree day data set.

5. Select that period with the greatest change.

6. Average Temperatures.

7. Celebrate?


Conclusion:
So, while I think that should work, I have a feeling it may not be the most efficient solution. If any of you have any suggestions or comments, I'd be very grateful to hear them. Specifically, if anyone can comment on how a SQL Query for the highest rate-of-change within a 3 day period, and how that would look, I'd be eternally grateful!

Thanks in advance!
Jacques
 
Physics news on Phys.org
This question cannot be answered without knowledge of the table structures and how you define "hottest" among 96 temperature data a day.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
784
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 23 ·
Replies
23
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 9 ·
Replies
9
Views
29K