lizzieinvancouver / magnoliaubc

0 stars 0 forks source link

Temperature data and GDD #4

Open ngoj1 opened 3 weeks ago

ngoj1 commented 3 weeks ago

Hi Lizzie,

Here's an update on the climate data for the Magnolia project. Please feel free to respond whenever you can because I think the garden is highly preoccupied with other business right now anyway.

Here's what I've found when comparing the original temperate dataset from Environment Canada with the GHCN data:

  1. I tried comparing with data from Tsawwassen as it was one of the only few other weather stations that had data spanning from the mid 1900s to 2024, but I think the distance is too far and that reflected in the warmer T_avg values (by around 3 degC on average).

  2. I then looked at GHCN data for the airport to see if it was the same as what I had initially used, and found this: image tempDifference

The second image displays the difference between the daily T_avg values reported by GHCN and Environment Canada, showing that their datasets either merged or one took over sometime during 2002.

  1. I then looked at how temperatures were changing over the years within each season: seasonTrends I designated spring as March, April, and May (and so on for the other seasons).

I'm probably interpreting this wrong because I remember getting hounded by my TA in BIOL 412 about F-statistic and p-values for linear regressions, but it seems that only summer had a significant non-zero slope (F-statistic p-value of 0.0231 for alpha = 0.05). Here's what the console says:

`> summary(summermodel)

Call: lm(formula = avg_temperature ~ year, data = szn.summer)

Residuals: Min 1Q Median 3Q Max -0.87576 -0.48210 0.03165 0.22950 1.35813

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) -34.89129 21.92107 -1.592 0.1216
year 0.02611 0.01092 2.390 0.0231 *

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.5974 on 31 degrees of freedom Multiple R-squared: 0.1556, Adjusted R-squared: 0.1284 F-statistic: 5.713 on 1 and 31 DF, p-value: 0.0231`

  1. I remember somehow figuring out the GDD function way back when you first sent it to me but I must have forgotten how you explained it to me because now I can't seem to understand the different components, so whenever you're free I would greatly appreciate another rundown as to how I specify the threshold temperature and the steps following that.

Thank you very much! Hope you are enjoying your time abroad.

lizzieinvancouver commented 3 weeks ago

@ngoj1 Thanks for your work on this! It looks like GHCN has a gap in the data. Is that correct? That's understandable and not a big deal. I suggest plotting the GHCN versus EnvCanada max and min daily temperatures with a 1:1 line on top to really compare though. I suspect they are similar enough though...

If you could put the summary(lm()) output for each 3 month period in this issue for both min and max temperatures (so 8 total), that would be helpful. Please bracket your code using the<> in the menu so it is easier to read.

lizzieinvancouver commented 3 weeks ago

@ngoj1 There are lots of ways to make GDD -- here's some code with one example in it and I bet Deirdre, Mao and Ken have other examples. I would use 5 C as your base temperature, but make it easy to change that.

ngoj1 commented 2 weeks ago

Yes. there is indeed a gap in the GHCN data unfortunately.

plotting the GHCN versus EnvCanada max and min daily temperatures with a 1:1 line on top to really compare though.

Minimum temperature comparison: minTempPlotComparison

Maximum temperature comparison: maxTempPlotComparison

put the summary(lm()) output for each 3 month period in this issue for both min and max temperatures (so 8 total), that would be helpful.

(I wasn't sure what you meant by <> in the menu so I used backticks instead, please let me know how to format it the way you like!)

> # winter temp trend
> summary(lm(min_temperature~year, szn.winter))

Call:
lm(formula = min_temperature ~ year, data = szn.winter)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.6643 -0.5558  0.2035  0.7282  2.0898 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)
(Intercept)  1.7953936 38.6204114   0.046    0.963
year        -0.0001778  0.0192378  -0.009    0.993

Residual standard error: 1.101 on 32 degrees of freedom
Multiple R-squared:  2.67e-06,  Adjusted R-squared:  -0.03125 
F-statistic: 8.545e-05 on 1 and 32 DF,  p-value: 0.9927

> summary(lm(max_temperature~year, szn.winter))

Call:
lm(formula = max_temperature ~ year, data = szn.winter)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.5435 -0.5106  0.1900  0.4724  2.1768 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept) 54.88575   31.70064   1.731    0.093 .
year        -0.02380    0.01579  -1.507    0.142  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.9033 on 32 degrees of freedom
Multiple R-squared:  0.06627,   Adjusted R-squared:  0.0371 
F-statistic: 2.271 on 1 and 32 DF,  p-value: 0.1416

> # winter temp trend
> summary(lm(min_temperature~year, szn.winter))

Call:
lm(formula = min_temperature ~ year, data = szn.winter)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.6643 -0.5558  0.2035  0.7282  2.0898 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)
(Intercept)  1.7953936 38.6204114   0.046    0.963
year        -0.0001778  0.0192378  -0.009    0.993

Residual standard error: 1.101 on 32 degrees of freedom
Multiple R-squared:  2.67e-06,  Adjusted R-squared:  -0.03125 
F-statistic: 8.545e-05 on 1 and 32 DF,  p-value: 0.9927

> summary(lm(max_temperature~year, szn.winter))

Call:
lm(formula = max_temperature ~ year, data = szn.winter)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.5435 -0.5106  0.1900  0.4724  2.1768 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept) 54.88575   31.70064   1.731    0.093 .
year        -0.02380    0.01579  -1.507    0.142  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.9033 on 32 degrees of freedom
Multiple R-squared:  0.06627,   Adjusted R-squared:  0.0371 
F-statistic: 2.271 on 1 and 32 DF,  p-value: 0.1416

> # spring temp trend
> summary(lm(min_temperature~year, szn.spring))

Call:
lm(formula = min_temperature ~ year, data = szn.spring)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.36269 -0.48305 -0.01212  0.55348  1.63382 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept) 22.226849  27.480258   0.809    0.425
year        -0.008058   0.013692  -0.588    0.560

Residual standard error: 0.7489 on 31 degrees of freedom
Multiple R-squared:  0.01105,   Adjusted R-squared:  -0.02085 
F-statistic: 0.3463 on 1 and 31 DF,  p-value: 0.5605

> summary(lm(max_temperature~year, szn.spring))

Call:
lm(formula = max_temperature ~ year, data = szn.spring)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.74018 -0.66461  0.01279  0.64879  1.86532 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept) 26.396168  34.182074   0.772    0.446
year        -0.006449   0.017031  -0.379    0.708

Residual standard error: 0.9316 on 31 degrees of freedom
Multiple R-squared:  0.004604,  Adjusted R-squared:  -0.02751 
F-statistic: 0.1434 on 1 and 31 DF,  p-value: 0.7075

> # summer temp trend
> summary(lm(min_temperature~year, szn.summer))

Call:
lm(formula = min_temperature ~ year, data = szn.summer)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.7776 -0.3275 -0.1072  0.3409  1.0277 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)  
(Intercept) -19.316338  18.398789  -1.050   0.3019  
year          0.016288   0.009167   1.777   0.0854 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.5014 on 31 degrees of freedom
Multiple R-squared:  0.09243,   Adjusted R-squared:  0.06315 
F-statistic: 3.157 on 1 and 31 DF,  p-value: 0.08541

> summary(lm(max_temperature~year, szn.summer))

Call:
lm(formula = max_temperature ~ year, data = szn.summer)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.10518 -0.56197  0.00009  0.40499  1.68852 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)  
(Intercept) -50.51392   27.34951  -1.847   0.0743 .
year          0.03595    0.01363   2.638   0.0129 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.7454 on 31 degrees of freedom
Multiple R-squared:  0.1834,    Adjusted R-squared:  0.157 
F-statistic: 6.961 on 1 and 31 DF,  p-value: 0.01292

> # autumn temp trend
> summary(lm(min_temperature~year, szn.autumn))

Call:
lm(formula = min_temperature ~ year, data = szn.autumn)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.95986 -0.48659 -0.01251  0.39160  1.11886 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept) -4.927662  21.517218  -0.229    0.820
year         0.006096   0.010721   0.569    0.574

Residual standard error: 0.5864 on 31 degrees of freedom
Multiple R-squared:  0.01032,   Adjusted R-squared:  -0.0216 
F-statistic: 0.3233 on 1 and 31 DF,  p-value: 0.5737

> summary(lm(max_temperature~year, szn.autumn))

Call:
lm(formula = max_temperature ~ year, data = szn.autumn)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.5697 -0.3417  0.1006  0.2462  1.2242 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept)  1.884375  20.995753   0.090    0.929
year         0.006043   0.010461   0.578    0.568

Residual standard error: 0.5722 on 31 degrees of freedom
Multiple R-squared:  0.01065,   Adjusted R-squared:  -0.02126 
F-statistic: 0.3337 on 1 and 31 DF,  p-value: 0.5677>

@ngoj1 There are lots of ways to make GDD -- here's some code with one example in it and I bet Deirdre, Mao and Ken have other examples. I would use 5 C as your base temperature, but make it easy to change that.

Thank you for this!