I need to calculate some growing degree unit data using the daily max and min air temp. I would assume do the following in a program compiled in sequential mode:
1) Make a non-written datatable to calculate the daily max and min at 1440 minutes
2) Use the Fieldnames parameter to name the daily max and min values
3) Call the datatable in the Program section before the final daily output
4) Calculate the growing degree units
5) Call the daily datatable and use the sample parameter to display the daily min and max temps and the growing degree day units.
Let me know if there is some other way, perhaps easier to do this.
Thanks!
Program as follows using previous example:
'Program author: Larry Treadaway
SequentialMode
Public TRHData(2)
Public BattV
Public STC2
Public STC8
Public WS_ms
Public WS_mph
Public WD
Public Rain
Public SlrW
Public SlrMJ
Public Sat_VP
Public VP
Public VPD
Public RH_decml
Public ETo_24
Public ETo_mm
Public ETo_in
Public MxAT
Public MxAT_F
Public MnAT
Public MnAT_F
Public GDUnits
Alias TRHData(1)=Air_Temp_2M
Alias TRHData(2)=Rel_Humd_2m
Alias BattV=Battery_Voltage_Minimum
Alias STC2=Soil_Temperature_2_in
Alias STC8=Soil_Temperature_8_in
Alias WS_mph=Wind_Speed_3_m
Alias WD=Wind_Direction_3_m
Alias Rain=Precipitation_in
Alias SlrW=Solar_Radiation_Wm2
Alias SlrMJ=Solar_Radiation_MJm2
Alias Sat_VP=Sat_Vapor_Press
Alias VP=Vapor_Press
Alias VPD=Vapor_Press_Deficite
Alias ETo_24=Evapotranspiration_24_hr
Alias GDUnits=Growing Degree Days-Corn
'Input Constant Values based on Location of Weather Station
'These values for (insert location name)
Const Altitude=37
Const Latitude=29.88
Const Longitude=82.42
Units BattV=Volts
Units STC2=Deg C
Units STC8=Deg C
Units Air_Temp_2M=Deg C
Units Rel_Humd_2m=%
Units WS_mph=miles per hour
Units WD=degrees
Units Rain=inches
Units SlrW=W/m^2
Units SlrMJ=MJoules/m^2
Units Sat_VP=kPa
Units VP=kPa
Units VPD=kPa
Units ETo_24=inches
DataTable(ETos,true,48)
DataInterval(0,60,Min,10)
ETsz (Air_Temp_2M,Rel_Humd_2m,WS_ms,SlrMJ,Longitude,Latitude,Altitude,3,0,FP2,False)
FieldNames ("ETos_mm,Clear_Sky_Rad")
EndTable
DataTable (Hourly,True,-1)
DataInterval (0,60,Min,10)
Average (1,STC2,FP2,False)
Minimum (1,STC2,FP2,False,False)
Maximum (1,STC2,FP2,False,False)
Average (1,STC8,FP2,False)
Minimum (1,STC8,FP2,False,False)
Maximum (1,STC8,FP2,False,False)
Average (1,Air_Temp_2M,FP2,False)
Minimum (1,Air_Temp_2M,FP2,False,False)
Maximum (1,Air_Temp_2M,FP2,False,False)
Average (1,Rel_Humd_2m,FP2,False)
Minimum (1,Rel_Humd_2m,FP2,False,False)
Maximum (1,Rel_Humd_2m,FP2,False,False)
WindVector (1,WS_mph,WD,FP2,False,0,0,1)
Minimum (1,WS_mph,FP2,False,False)
Maximum (1,WS_mph,FP2,False,False)
Totalize (1,Rain,FP2,False)
Average (1,Sat_VP,FP2,False)
Average (1,VP,FP2,False)
Average (1,VPD,FP2,False)
Average (1,SlrW,FP2,False)
Sample (1,ETo_in,FP2)
FieldNames ("ETos_mm,Clear_Sky_Rad")
Sample (1,BattV,FP2)
EndTable
DataTable(GDU,false,-1)
DataInterval(0,1440,Min,10)
Minimum (1,Air_Temp_2M,FP2,False,False)
FieldNames ("MinAT")
Maximum (1,Air_Temp_2M,FP2,False,False)
FieldNames ("MaxAT")
EndTable
DataTable (Daily,True,-1)
DataInterval (0,1440,Min,10)
Average (1,STC2,FP2,False)
Minimum (1,STC2,FP2,False,False)
Maximum (1,STC2,FP2,False,False)
Average (1,STC8,FP2,False)
Minimum (1,STC8,FP2,False,False)
Maximum (1,STC8,FP2,False,False)
Average (1,Air_Temp_2M,FP2,False)
Minimum (1,Air_Temp_2M,FP2,False,False)
Maximum (1,Air_Temp_2M,FP2,False,False)
Average (1,Rel_Humd_2m,FP2,False)
Minimum (1,Rel_Humd_2m,FP2,False,False)
Maximum (1,Rel_Humd_2m,FP2,False,False)
WindVector (1,WS_mph,WD,FP2,False,0,0,1)
Minimum (1,WS_mph,FP2,False,False)
Maximum (1,WS_mph,FP2,False,False)
Totalize (1,Rain,FP2,False)
Average (1,Sat_VP,FP2,False)
Average (1,VP,FP2,False)
Average (1,VPD,FP2,False)
Average (1,SlrW,FP2,False)
Sample (1,ETo_24,FP2)
Sample (1,GDUnits,FP2)
EndTable
BeginProg
Scan (15,Sec,3,0)
Battery (BattV)
Therm107 (STC2,1,1,Vx1,0,250,1.0,0)
Therm107 (STC8,1,1,Vx1,0,250,1.0,0)
SDI12Recorder (Air_Temp_2M,1,0,"M!",1.0,0)
SatVP (Sat_VP,Air_Temp_2M)
RH_decml=0.01*Rel_Humd_2m
VP=RH_decml*Sat_VP
VPD=Sat_VP-VP
PulseCount (WS_ms,1,1,2,1,0.799,0.2811)
If WS_ms=0.2811 Then WS_ms=0
WS_mph=WS_ms*2.237
BrHalf (WD,1,mV2500,4,Vx1,1,2500,True,0,250,720,0)
If WD>=360 Then WD=0
PulseCount (Rain,1,2,2,0,0.01,0)
VoltDiff (SlrW,1,mV7_5,3,True ,0,250,1.0,0)
If SlrW<0 Then SlrW=0
SlrMJ=SlrW*0.003
SlrW=SlrW*200
CallTable ETos
If ETos.Output(1,1) Then
ETo_mm = ETos.ETos_mm
If ETo_mm = NAN Then ETo_mm = 0
ETo_in=ETo_mm*0.03937
ETo_24 = ETo_in + ETo_24
EndIf
CallTable Hourly
CallTable GDU
If GDU.Output(1,1) Then
MxAT=GDU.MaxAT
MxAT_F=(MxAT*1.8)+32
MnAT_F=GDU.MinAT
MnAT_F=(MnAT*1.8)+32
If MxAT_F>86 Then MxAT_F=86
If MnAT_F<50 Then MnAT_F=50
GDUnits=((MxAT_F+MnAT_F)/2)-50
EndIf
If GDUnits<0 Then GDUnits=0
CallTable Daily
If Daily.Output(1,1) Then
ETo_24 = 0
EndIf
NextScan
EndProg