Split a large set of meteorological data into days for caculating Growth Degree Days
- October 11, 2015
- 3 replies
- 5735 views
Dear experts, I'm a third year Agronomy major from Costa Rica. I'm calculating degree days built up for every day in a given data set with over 7 000 observations. Each observation is an hourly average so 24 observations make for 1 day. There are around 300 days in my data set. Growing Degree Days is a measure of acumulated energy in a system during 1 day and it is calculated as follows:
Max T = Highest temperature measured from 0000 to 2400; Min T = Lowest temperature measured from 0000 to 2400; Tbase = Minimum temperature required for crop growth (specified by literature)
GDD = (Max T - Min T)/2 - Tbase
So, what I want to do is grab my data set, split it into 300 or so chunks of 24 observations. Out of those 24 observations I need to calculate the maximum and the minimum. With those values determined I can now calculate GDD. I need the algorithm to store that value in a matrix and move to the next 24 observations. If the first day is from obs 0(start) to obs 23(end), the second day is from 24 (start+24) to 47 (end + 24). The algorithm would take care of changing the start and end positions so that the determination of maximum and minimum temperature is done for each day in the data set. Once the loop reaches the last of the 7000 or so observations it should print the matrix with around 300 calculations of GDD. I'm also interested in having a matrix of acumulated GDD but that will be for later.
Right now what I'm being unable to do is instruct the algorithm to break down the spread sheet into chunks of 24 observations so that I can run the max and min loops through it. I'm attaching what I have done so far.
I'm pretty knew to the language but I understand the operation logic.
Thank you oh great wizards of Mathcad! In return I offer my gratitude and consultation of agriculture related experiments and methods.
Sergio

